From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/, pym/_emerge/
Date: Tue, 25 Oct 2011 08:25:45 +0000 (UTC) [thread overview]
Message-ID: <25aaf3e69b8ef0e9a21d0d74a9b7b690b76675cd.zmedico@gentoo> (raw)
commit: 25aaf3e69b8ef0e9a21d0d74a9b7b690b76675cd
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 25 08:25:24 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Oct 25 08:25:24 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=25aaf3e6
create_trees: save target_root for later use
---
pym/_emerge/actions.py | 8 +-------
pym/portage/__init__.py | 14 ++++++++++++--
pym/portage/_legacy_globals.py | 10 ++--------
3 files changed, 15 insertions(+), 17 deletions(-)
diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
index 0879510..edc0afd 100644
--- a/pym/_emerge/actions.py
+++ b/pym/_emerge/actions.py
@@ -2983,13 +2983,7 @@ def load_emerge_config(trees=None):
setconfig = load_default_config(settings, root_trees)
root_trees["root_config"] = RootConfig(settings, root_trees, setconfig)
- settings = trees["/"]["vartree"].settings
-
- for myroot in trees:
- if myroot != "/":
- settings = trees[myroot]["vartree"].settings
- break
-
+ settings = trees[trees._target_root]['vartree'].settings
mtimedbfile = os.path.join(settings['EROOT'], portage.CACHE_PATH, "mtimedb")
mtimedb = portage.MtimeDB(mtimedbfile)
portage.output._init(config_root=settings['PORTAGE_CONFIGROOT'])
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 7f781cf..3dc9ae5 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -479,9 +479,15 @@ def portageexit():
if data.secpass > 1 and os.environ.get("SANDBOX_ON") != "1":
close_portdbapi_caches()
+class _trees_dict(dict):
+ def __init__(self):
+ super(dict, self).__init__()
+ self._running_root = None
+ self._target_root = None
+
def create_trees(config_root=None, target_root=None, trees=None, env=None):
if trees is None:
- trees = {}
+ trees = _trees_dict()
else:
# clean up any existing portdbapi instances
for myroot in trees:
@@ -497,8 +503,11 @@ def create_trees(config_root=None, target_root=None, trees=None, env=None):
env=env, _eprefix=eprefix)
settings.lock()
+ trees._target_root = settings['ROOT']
myroots = [(settings["ROOT"], settings)]
- if settings["ROOT"] != "/":
+ if settings["ROOT"] == "/":
+ trees._running_root = trees._target_root
+ else:
# When ROOT != "/" we only want overrides from the calling
# environment to apply to the config that's associated
@@ -513,6 +522,7 @@ def create_trees(config_root=None, target_root=None, trees=None, env=None):
settings = config(config_root=None, target_root="/",
env=clean_env, _eprefix=eprefix)
settings.lock()
+ trees._running_root = settings['ROOT']
myroots.append((settings["ROOT"], settings))
for myroot, mysettings in myroots:
diff --git a/pym/portage/_legacy_globals.py b/pym/portage/_legacy_globals.py
index 615591a..beba785 100644
--- a/pym/portage/_legacy_globals.py
+++ b/pym/portage/_legacy_globals.py
@@ -35,19 +35,13 @@ def _get_legacy_global(name):
constructed.add('db')
del portage._initializing_globals
- settings = portage.db["/"]["vartree"].settings
-
- for root in portage.db:
- if root != "/":
- settings = portage.db[root]["vartree"].settings
- break
-
+ settings = portage.db[portage.db._target_root]["vartree"].settings
portage.output._init(config_root=settings['PORTAGE_CONFIGROOT'])
portage.settings = settings
constructed.add('settings')
- portage.root = root
+ portage.root = portage.db._target_root
constructed.add('root')
# COMPATIBILITY
next reply other threads:[~2011-10-25 8:25 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-25 8:25 Zac Medico [this message]
-- strict thread matches above, loose matches on Subject: below --
2013-08-12 21:25 [gentoo-commits] proj/portage:master commit in: pym/portage/, pym/_emerge/ Zac Medico
2013-07-22 22:32 Arfrever Frehtes Taifersar Arahesis
2012-09-26 2:15 Zac Medico
2012-09-21 18:40 Zac Medico
2012-06-11 5:58 Zac Medico
2012-06-11 5:32 Zac Medico
2012-06-11 0:58 Zac Medico
2011-10-27 3:13 Zac Medico
2011-10-15 6:11 Zac Medico
2011-07-12 23:21 Zac Medico
2011-07-07 4:36 Zac Medico
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=25aaf3e69b8ef0e9a21d0d74a9b7b690b76675cd.zmedico@gentoo \
--to=zmedico@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox