diff options
-rw-r--r-- | pym/portage/__init__.py | 8 | ||||
-rw-r--r-- | pym/portage/tests/resolver/ResolverPlayground.py | 16 |
2 files changed, 8 insertions, 16 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index d3df6e323..7f781cf17 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -479,7 +479,7 @@ def portageexit(): if data.secpass > 1 and os.environ.get("SANDBOX_ON") != "1": close_portdbapi_caches() -def create_trees(config_root=None, target_root=None, trees=None): +def create_trees(config_root=None, target_root=None, trees=None, env=None): if trees is None: trees = {} else: @@ -490,9 +490,11 @@ def create_trees(config_root=None, target_root=None, trees=None): portdbapi.portdbapi_instances.remove(portdb) del trees[myroot]["porttree"], myroot, portdb - eprefix = os.environ.get("__PORTAGE_TEST_EPREFIX") + if env is None: + env = os.environ + eprefix = env.get("__PORTAGE_TEST_EPREFIX") settings = config(config_root=config_root, target_root=target_root, - config_incrementals=portage.const.INCREMENTALS, _eprefix=eprefix) + env=env, _eprefix=eprefix) settings.lock() myroots = [(settings["ROOT"], settings)] diff --git a/pym/portage/tests/resolver/ResolverPlayground.py b/pym/portage/tests/resolver/ResolverPlayground.py index ec6f63166..4bbd03318 100644 --- a/pym/portage/tests/resolver/ResolverPlayground.py +++ b/pym/portage/tests/resolver/ResolverPlayground.py @@ -476,8 +476,10 @@ class ResolverPlayground(object): portdir_overlay.append(path) env = { + "__PORTAGE_TEST_EPREFIX": self.eprefix, "ACCEPT_KEYWORDS": "x86", "DISTDIR" : self.distdir, + "PKGDIR": os.path.join(self.eroot, "usr/portage/packages"), "PORTDIR": self.portdir, "PORTDIR_OVERLAY": " ".join(portdir_overlay), 'PORTAGE_TMPDIR' : os.path.join(self.eroot, 'var/tmp'), @@ -490,19 +492,7 @@ class ResolverPlayground(object): if 'PORTAGE_GRPNAME' in os.environ: env['PORTAGE_GRPNAME'] = os.environ['PORTAGE_GRPNAME'] - settings = config(_eprefix=self.eprefix, env=env) - settings.lock() - - trees = { - self.root: { - "vartree": vartree(settings=settings), - "porttree": portagetree(self.root, settings=settings), - "bintree": binarytree(self.root, - os.path.join(self.eroot, "usr/portage/packages"), - settings=settings) - } - } - + trees = portage.create_trees(env=env) for root, root_trees in trees.items(): settings = root_trees["vartree"].settings settings._init_dirs() |