summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/_emerge/FakeVartree.py19
-rw-r--r--pym/_emerge/depgraph.py6
2 files changed, 19 insertions, 6 deletions
diff --git a/pym/_emerge/FakeVartree.py b/pym/_emerge/FakeVartree.py
index 97675708b..e6ec15fc3 100644
--- a/pym/_emerge/FakeVartree.py
+++ b/pym/_emerge/FakeVartree.py
@@ -36,11 +36,15 @@ class FakeVartree(vartree):
global updates are necessary (updates are performed when necessary if there
is not a matching ebuild in the tree). Instances of this class are not
populated until the sync() method is called."""
- def __init__(self, root_config, pkg_cache=None):
+ def __init__(self, root_config, pkg_cache=None, pkg_root_config=None):
self._root_config = root_config
+ if pkg_root_config is None:
+ pkg_root_config = self._root_config
+ self._pkg_root_config = pkg_root_config
if pkg_cache is None:
pkg_cache = {}
real_vartree = root_config.trees["vartree"]
+ self._real_vardb = real_vartree.dbapi
portdb = root_config.trees["porttree"].dbapi
self.root = real_vartree.root
self.settings = real_vartree.settings
@@ -177,12 +181,17 @@ class FakeVartree(vartree):
real_vardb.flush_cache()
def _pkg(self, cpv):
- root_config = self._root_config
- real_vardb = root_config.trees["vartree"].dbapi
+ """
+ The RootConfig instance that will become the Package.root_config
+ attribute can be overridden by the FakeVartree pkg_root_config
+ constructory argument, since we want to be consitent with the
+ depgraph._pkg() method which uses a specially optimized
+ RootConfig that has a FakeVartree instead of a real vartree.
+ """
pkg = Package(cpv=cpv, built=True, installed=True,
metadata=zip(self._db_keys,
- real_vardb.aux_get(cpv, self._db_keys)),
- root_config=root_config,
+ self._real_vardb.aux_get(cpv, self._db_keys)),
+ root_config=self._pkg_root_config,
type_name="installed")
try:
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index db85c2ea3..94e55e173 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -101,7 +101,8 @@ class _frozen_depgraph_config(object):
self.trees[myroot][tree] = trees[myroot][tree]
self.trees[myroot]["vartree"] = \
FakeVartree(trees[myroot]["root_config"],
- pkg_cache=self._pkg_cache)
+ pkg_cache=self._pkg_cache,
+ pkg_root_config=self.roots[myroot])
self.pkgsettings[myroot] = portage.config(
clone=self.trees[myroot]["vartree"].settings)
@@ -3066,6 +3067,9 @@ class depgraph(object):
operation = "merge"
if installed or onlydeps:
operation = "nomerge"
+ # Ensure that we use the specially optimized RootConfig instance
+ # that refers to FakeVartree instead of the real vartree.
+ root_config = self._frozen_config.roots[root_config.root]
pkg = self._frozen_config._pkg_cache.get(
(type_name, root_config.root, cpv, operation))
if pkg is None and onlydeps and not installed: