aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-10-25 08:59:39 (GMT)
committerZac Medico <zmedico@gentoo.org>2011-10-25 08:59:39 (GMT)
commita715b65f7bd36409c1283e6911265d1f4405ab7a (patch)
treef3ad709ca1495be750163ced02fe11562566f910
parentcreate_trees: save target_root for later use (diff)
downloadportage-a715b65f7bd36409c1283e6911265d1f4405ab7a.zip
portage-a715b65f7bd36409c1283e6911265d1f4405ab7a.tar.gz
portage-a715b65f7bd36409c1283e6911265d1f4405ab7a.tar.bz2
Use EROOT instead of ROOT for keys everywhere.
It makes more sense to use EROOT instead of ROOT for keys in mappings like portage.db, since it allows for multiple prefixes to exist simultaneously within the same map without having a key collision. This affects all portageq commands which take a <root> parameter, since that parameter now corresponds to EROOT instead of ROOT. None of this makes any difference for non-prefix users, since EROOT and ROOT are identical when EPREFIX is empty.
-rwxr-xr-xbin/ebuild4
-rwxr-xr-xbin/emaint20
-rwxr-xr-xbin/glsa-check5
-rwxr-xr-xbin/portageq27
-rwxr-xr-xbin/quickpkg24
-rwxr-xr-xbin/regenworld5
-rw-r--r--pym/_emerge/BlockerDB.py4
-rw-r--r--pym/_emerge/Package.py8
-rw-r--r--pym/_emerge/RootConfig.py2
-rw-r--r--pym/_emerge/Scheduler.py11
-rw-r--r--pym/_emerge/actions.py105
-rw-r--r--pym/_emerge/depgraph.py29
-rw-r--r--pym/_emerge/main.py28
-rw-r--r--pym/_emerge/unmerge.py4
-rw-r--r--pym/portage/__init__.py20
-rw-r--r--pym/portage/_global_updates.py2
-rw-r--r--pym/portage/_legacy_globals.py6
-rw-r--r--pym/portage/dbapi/vartree.py14
-rw-r--r--pym/portage/news.py1
-rw-r--r--pym/portage/package/ebuild/doebuild.py6
-rw-r--r--pym/portage/tests/ebuild/test_config.py2
-rw-r--r--pym/portage/tests/ebuild/test_doebuild_spawn.py2
-rw-r--r--pym/portage/tests/emerge/test_simple.py18
-rw-r--r--pym/portage/tests/repoman/test_simple.py2
-rw-r--r--pym/portage/tests/resolver/ResolverPlayground.py4
-rw-r--r--pym/portage/util/env_update.py12
26 files changed, 186 insertions, 179 deletions
diff --git a/bin/ebuild b/bin/ebuild
index 771ccb5..82f0ff9 100755
--- a/bin/ebuild
+++ b/bin/ebuild
@@ -260,14 +260,14 @@ if "merge" in pargs and "noauto" in tmpsettings.features:
try:
metadata = dict(zip(Package.metadata_keys,
- portage.db[portage.settings["ROOT"]][mytree].dbapi.aux_get(
+ portage.db[portage.settings['EROOT']][mytree].dbapi.aux_get(
cpv, Package.metadata_keys, myrepo=myrepo)))
except KeyError:
# aux_get failure, message should have been shown on stderr.
sys.exit(1)
root_config = RootConfig(portage.settings,
- portage.db[portage.settings["ROOT"]], None)
+ portage.db[portage.settings['EROOT']], None)
pkg = Package(built=(pkg_type != "ebuild"), cpv=cpv,
installed=(pkg_type=="installed"),
diff --git a/bin/emaint b/bin/emaint
index fdd01ed..ea26e55 100755
--- a/bin/emaint
+++ b/bin/emaint
@@ -40,15 +40,15 @@ class WorldHandler(object):
self.okay = []
from portage._sets import load_default_config
setconfig = load_default_config(portage.settings,
- portage.db[portage.settings["ROOT"]])
+ portage.db[portage.settings['EROOT']])
self._sets = setconfig.getSets()
def _check_world(self, onProgress):
categories = set(portage.settings.categories)
- myroot = portage.settings["ROOT"]
- self.world_file = os.path.join(portage.settings["EROOT"], portage.const.WORLD_FILE)
+ eroot = portage.settings['EROOT']
+ self.world_file = os.path.join(eroot, portage.const.WORLD_FILE)
self.found = os.access(self.world_file, os.R_OK)
- vardb = portage.db[myroot]["vartree"].dbapi
+ vardb = portage.db[eroot]["vartree"].dbapi
from portage._sets import SETPREFIX
sets = self._sets
@@ -120,8 +120,8 @@ class BinhostHandler(object):
name = staticmethod(name)
def __init__(self):
- myroot = portage.settings["ROOT"]
- self._bintree = portage.db[myroot]["bintree"]
+ eroot = portage.settings['EROOT']
+ self._bintree = portage.db[eroot]["bintree"]
self._bintree.populate()
self._pkgindex_file = self._bintree._pkgindex_file
self._pkgindex = self._bintree._load_pkgindex()
@@ -403,8 +403,8 @@ class MoveInstalled(MoveHandler):
return "moveinst"
name = staticmethod(name)
def __init__(self):
- myroot = portage.settings["ROOT"]
- MoveHandler.__init__(self, portage.db[myroot]["vartree"], portage.db[myroot]["porttree"])
+ eroot = portage.settings['EROOT']
+ MoveHandler.__init__(self, portage.db[eroot]["vartree"], portage.db[eroot]["porttree"])
class MoveBinary(MoveHandler):
@@ -414,8 +414,8 @@ class MoveBinary(MoveHandler):
return "movebin"
name = staticmethod(name)
def __init__(self):
- myroot = portage.settings["ROOT"]
- MoveHandler.__init__(self, portage.db[myroot]["bintree"], portage.db[myroot]["porttree"])
+ eroot = portage.settings['EROOT']
+ MoveHandler.__init__(self, portage.db[eroot]["bintree"], portage.db[eroot]['porttree'])
class VdbKeyHandler(object):
def name():
diff --git a/bin/glsa-check b/bin/glsa-check
index 2f2d555..a840c32 100755
--- a/bin/glsa-check
+++ b/bin/glsa-check
@@ -103,8 +103,9 @@ elif mode == "list" and not params:
# delay this for speed increase
from portage.glsa import *
-vardb = portage.db[portage.settings["ROOT"]]["vartree"].dbapi
-portdb = portage.db["/"]["porttree"].dbapi
+eroot = portage.settings['EROOT']
+vardb = portage.db[eroot]["vartree"].dbapi
+portdb = portage.db[eroot]["porttree"].dbapi
# build glsa lists
completelist = get_glsa_list(portage.settings)
diff --git a/bin/portageq b/bin/portageq
index eaeca60..02f1904 100755
--- a/bin/portageq
+++ b/bin/portageq
@@ -185,7 +185,7 @@ def metadata(argv):
print("ERROR: insufficient parameters!", file=sys.stderr)
sys.exit(2)
- root, pkgtype, pkgspec = argv[0:3]
+ eroot, pkgtype, pkgspec = argv[0:3]
metakeys = argv[3:]
type_map = {
"ebuild":"porttree",
@@ -195,10 +195,8 @@ def metadata(argv):
print("Unrecognized package type: '%s'" % pkgtype, file=sys.stderr)
sys.exit(1)
trees = portage.db
- if os.path.realpath(root) == os.path.realpath(portage.settings["ROOT"]):
- root = portage.settings["ROOT"] # contains the normalized $ROOT
try:
- values = trees[root][type_map[pkgtype]].dbapi.aux_get(
+ values = trees[eroot][type_map[pkgtype]].dbapi.aux_get(
pkgspec, metakeys)
writemsg_stdout(''.join('%s\n' % x for x in values), noiselevel=-1)
except KeyError:
@@ -250,9 +248,9 @@ def owners(argv):
return 2
from portage import catsplit, dblink
- settings = portage.settings
- root = settings["ROOT"]
- vardb = portage.db[root]["vartree"].dbapi
+ eroot = argv[0]
+ vardb = portage.db[eroot]["vartree"].dbapi
+ root = portage.settings['ROOT']
cwd = None
try:
@@ -451,7 +449,8 @@ def best_visible(argv):
noiselevel=-1)
return 2
- db = portage.db[portage.settings["ROOT"]][type_map[pkgtype]].dbapi
+ eroot = argv[0]
+ db = portage.db[eroot][type_map[pkgtype]].dbapi
try:
atom = portage.dep_expand(atom, mydb=db, settings=portage.settings)
@@ -461,7 +460,7 @@ def best_visible(argv):
return 2
root_config = RootConfig(portage.settings,
- portage.db[portage.settings["ROOT"]], None)
+ portage.db[eroot], None)
if hasattr(db, "xmatch"):
cpv_list = db.xmatch("match-all-cpv-only", atom)
@@ -839,7 +838,13 @@ def main():
sys.stderr.write("Run portageq with --help for info\n")
sys.stderr.flush()
sys.exit(os.EX_USAGE)
- os.environ["ROOT"] = sys.argv[2]
+ eprefix = os.environ.get("__PORTAGE_TEST_EPREFIX")
+ eroot = portage.util.normalize_path(sys.argv[2])
+ if eprefix:
+ root = eroot[:1-len(eprefix)]
+ else:
+ root = eroot
+ os.environ["ROOT"] = root
args = sys.argv[2:]
if args and sys.hexversion < 0x3000000 and not isinstance(args[0], unicode):
@@ -848,7 +853,7 @@ def main():
try:
if uses_root:
- args[0] = portage.settings["ROOT"]
+ args[0] = portage.settings['EROOT']
retval = function(args)
if retval:
sys.exit(retval)
diff --git a/bin/quickpkg b/bin/quickpkg
index ced2468..d908c03 100755
--- a/bin/quickpkg
+++ b/bin/quickpkg
@@ -31,8 +31,9 @@ from portage._sets import load_default_config, SETPREFIX
def quickpkg_atom(options, infos, arg, eout):
settings = portage.settings
- root = portage.settings["ROOT"]
- trees = portage.db[root]
+ root = portage.settings['ROOT']
+ eroot = portage.settings['EROOT']
+ trees = portage.db[eroot]
vartree = trees["vartree"]
vardb = vartree.dbapi
bintree = trees["bintree"]
@@ -65,10 +66,7 @@ def quickpkg_atom(options, infos, arg, eout):
for cpv in matches:
excluded_config_files = []
bintree.prevent_collision(cpv)
- cat, pkg = portage.catsplit(cpv)
- dblnk = dblink(cat, pkg, root,
- vartree.settings, treetype="vartree",
- vartree=vartree)
+ dblnk = vardb._dblink(cpv)
have_lock = False
try:
dblnk.lockdb()
@@ -101,7 +99,7 @@ def quickpkg_atom(options, infos, arg, eout):
contents = dblnk.getcontents()
protect = None
if not include_config:
- confprot = ConfigProtect(root,
+ confprot = ConfigProtect(eroot,
shlex_split(settings.get("CONFIG_PROTECT", "")),
shlex_split(settings.get("CONFIG_PROTECT_MASK", "")))
def protect(filename):
@@ -161,8 +159,8 @@ def quickpkg_atom(options, infos, arg, eout):
infos["missing"].append(arg)
def quickpkg_set(options, infos, arg, eout):
- root = portage.settings["ROOT"]
- trees = portage.db[root]
+ eroot = portage.settings['EROOT']
+ trees = portage.db[eroot]
vartree = trees["vartree"]
settings = vartree.settings
@@ -189,8 +187,8 @@ def quickpkg_set(options, infos, arg, eout):
def quickpkg_extended_atom(options, infos, atom, eout):
- root = portage.settings["ROOT"]
- trees = portage.db[root]
+ eroot = portage.settings['EROOT']
+ trees = portage.db[eroot]
vartree = trees["vartree"]
vardb = vartree.dbapi
@@ -222,8 +220,8 @@ def quickpkg_extended_atom(options, infos, atom, eout):
def quickpkg_main(options, args, eout):
- root = portage.settings["ROOT"]
- trees = portage.db[root]
+ eroot = portage.settings['EROOT']
+ trees = portage.db[eroot]
bintree = trees["bintree"]
try:
diff --git a/bin/regenworld b/bin/regenworld
index 6b5af4c..3199fdf 100755
--- a/bin/regenworld
+++ b/bin/regenworld
@@ -47,7 +47,6 @@ def isunwanted(pkgline):
__uniqlist__.append(pkgline)
return True
-root = portage.settings['ROOT']
eroot = portage.settings['EROOT']
world_file = os.path.join(eroot, portage.WORLD_FILE)
@@ -78,7 +77,7 @@ for mykey in syslist:
# drop the asterix
mykey = mykey[1:]
#print("candidate:",mykey)
- mylist = portage.db[root]["vartree"].dbapi.match(mykey)
+ mylist = portage.db[eroot]["vartree"].dbapi.match(mykey)
if mylist:
mykey=portage.cpv_getkey(mylist[0])
if mykey not in realsyslist:
@@ -87,7 +86,7 @@ for mykey in syslist:
for mykey in biglist:
#print("checking:",mykey)
try:
- mylist = portage.db[root]["vartree"].dbapi.match(mykey)
+ mylist = portage.db[eroot]["vartree"].dbapi.match(mykey)
except (portage.exception.InvalidAtom, KeyError):
if "--debug" in sys.argv:
print("* ignoring broken log entry for %s (likely injected)" % mykey)
diff --git a/pym/_emerge/BlockerDB.py b/pym/_emerge/BlockerDB.py
index 0033665..459affd 100644
--- a/pym/_emerge/BlockerDB.py
+++ b/pym/_emerge/BlockerDB.py
@@ -25,7 +25,7 @@ class BlockerDB(object):
self._dep_check_trees = None
self._fake_vartree = fake_vartree
self._dep_check_trees = {
- self._vartree.settings["ROOT"] : {
+ self._vartree.settings["EROOT"] : {
"porttree" : fake_vartree,
"vartree" : fake_vartree,
}}
@@ -36,7 +36,7 @@ class BlockerDB(object):
new_pkg is planned to be installed. This ignores build-time
blockers, since new_pkg is assumed to be built already.
"""
- blocker_cache = BlockerCache(self._vartree.settings["ROOT"],
+ blocker_cache = BlockerCache(None,
self._vartree.dbapi)
dep_keys = ["RDEPEND", "PDEPEND"]
settings = self._vartree.settings
diff --git a/pym/_emerge/Package.py b/pym/_emerge/Package.py
index 9f1be12..f87d593 100644
--- a/pym/_emerge/Package.py
+++ b/pym/_emerge/Package.py
@@ -361,15 +361,15 @@ class Package(Task):
% (portage.output.colorize(cpv_color, self.cpv + _repo_separator + self.repo) , self.type_name)
if self.type_name == "installed":
- if self.root != "/":
- s += " in '%s'" % self.root
+ if self.root_config.settings['ROOT'] != "/":
+ s += " in '%s'" % self.root_config.settings['ROOT']
if self.operation == "uninstall":
s += " scheduled for uninstall"
else:
if self.operation == "merge":
s += " scheduled for merge"
- if self.root != "/":
- s += " to '%s'" % self.root
+ if self.root_config.settings['ROOT'] != "/":
+ s += " to '%s'" % self.root_config.settings['ROOT']
s += ")"
return s
diff --git a/pym/_emerge/RootConfig.py b/pym/_emerge/RootConfig.py
index d84f108..bb0d768 100644
--- a/pym/_emerge/RootConfig.py
+++ b/pym/_emerge/RootConfig.py
@@ -19,7 +19,7 @@ class RootConfig(object):
def __init__(self, settings, trees, setconfig):
self.trees = trees
self.settings = settings
- self.root = self.settings["ROOT"]
+ self.root = self.settings['EROOT']
self.setconfig = setconfig
if setconfig is None:
self.sets = {}
diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py
index 3221b86..bc85a0d 100644
--- a/pym/_emerge/Scheduler.py
+++ b/pym/_emerge/Scheduler.py
@@ -151,7 +151,7 @@ class Scheduler(PollScheduler):
DeprecationWarning, stacklevel=2)
self.settings = settings
- self.target_root = settings["ROOT"]
+ self.target_root = settings["EROOT"]
self.trees = trees
self.myopts = myopts
self._spinner = spinner
@@ -207,10 +207,7 @@ class Scheduler(PollScheduler):
if max_jobs is None:
max_jobs = 1
self._set_max_jobs(max_jobs)
-
- # The root where the currently running
- # portage instance is installed.
- self._running_root = trees["/"]["root_config"]
+ self._running_root = trees[trees._running_eroot]["root_config"]
self.edebug = 0
if settings.get("PORTAGE_DEBUG", "") == "1":
self.edebug = 1
@@ -970,7 +967,7 @@ class Scheduler(PollScheduler):
portage.package.ebuild.doebuild.doebuild_environment(ebuild_path,
"pretend", settings=settings,
- db=self.trees[settings["ROOT"]][tree].dbapi)
+ db=self.trees[settings['EROOT']][tree].dbapi)
prepare_build_dirs(root_config.root, settings, cleanup=0)
vardb = root_config.trees['vartree'].dbapi
@@ -1563,7 +1560,7 @@ class Scheduler(PollScheduler):
return temp_settings
def _deallocate_config(self, settings):
- self._config_pool[settings["ROOT"]].append(settings)
+ self._config_pool[settings['EROOT']].append(settings)
def _main_loop(self):
diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
index edc0afd..5485d75 100644
--- a/pym/_emerge/actions.py
+++ b/pym/_emerge/actions.py
@@ -292,7 +292,7 @@ def action_build(settings, trees, mtimedb,
success, mydepgraph, favorites = backtrack_depgraph(
settings, trees, myopts, myparams, myaction, myfiles, spinner)
except portage.exception.PackageSetNotFound as e:
- root_config = trees[settings["ROOT"]]["root_config"]
+ root_config = trees[settings['EROOT']]['root_config']
display_missing_pkg_set(root_config, e.value)
return 1
@@ -330,7 +330,7 @@ def action_build(settings, trees, mtimedb,
mergecount += 1
if mergecount==0:
- sets = trees[settings["ROOT"]]["root_config"].sets
+ sets = trees[settings['EROOT']]['root_config'].sets
world_candidates = None
if "selective" in myparams and \
not oneshot and favorites:
@@ -440,7 +440,7 @@ def action_build(settings, trees, mtimedb,
if retval == os.EX_OK and not (buildpkgonly or fetchonly or pretend):
if "yes" == settings.get("AUTOCLEAN"):
portage.writemsg_stdout(">>> Auto-cleaning packages...\n")
- unmerge(trees[settings["ROOT"]]["root_config"],
+ unmerge(trees[settings['EROOT']]['root_config'],
myopts, "clean", [],
ldpath_mtimes, autoclean=1)
else:
@@ -463,7 +463,7 @@ def action_config(settings, trees, myopts, myfiles):
sys.exit(1)
print()
try:
- pkgs = trees[settings["ROOT"]]["vartree"].dbapi.match(myfiles[0])
+ pkgs = trees[settings['EROOT']]['vartree'].dbapi.match(myfiles[0])
except portage.exception.AmbiguousPackageName as e:
# Multiple matches thrown from cpv_expand
pkgs = e.args[0]
@@ -501,17 +501,16 @@ def action_config(settings, trees, myopts, myfiles):
else:
print("Configuring pkg...")
print()
- ebuildpath = trees[settings["ROOT"]]["vartree"].dbapi.findname(pkg)
+ ebuildpath = trees[settings['EROOT']]['vartree'].dbapi.findname(pkg)
mysettings = portage.config(clone=settings)
- vardb = trees[mysettings["ROOT"]]["vartree"].dbapi
+ vardb = trees[mysettings['EROOT']]['vartree'].dbapi
debug = mysettings.get("PORTAGE_DEBUG") == "1"
- retval = portage.doebuild(ebuildpath, "config", mysettings["ROOT"],
- mysettings,
+ retval = portage.doebuild(ebuildpath, "config", settings=mysettings,
debug=(settings.get("PORTAGE_DEBUG", "") == 1), cleanup=True,
- mydbapi=trees[settings["ROOT"]]["vartree"].dbapi, tree="vartree")
+ mydbapi = trees[settings['EROOT']]['vartree'].dbapi, tree="vartree")
if retval == os.EX_OK:
- portage.doebuild(ebuildpath, "clean", mysettings["ROOT"],
- mysettings, debug=debug, mydbapi=vardb, tree="vartree")
+ portage.doebuild(ebuildpath, "clean", settings=mysettings,
+ debug=debug, mydbapi=vardb, tree="vartree")
print()
def action_depclean(settings, trees, ldpath_mtimes,
@@ -551,7 +550,7 @@ def action_depclean(settings, trees, ldpath_mtimes,
for x in msg:
portage.writemsg_stdout(colorize("WARN", " * ") + x)
- root_config = trees[settings['ROOT']]['root_config']
+ root_config = trees[settings['EROOT']]['root_config']
vardb = root_config.trees['vartree'].dbapi
args_set = InternalPackageSet(allow_repo=True)
@@ -610,8 +609,9 @@ def calc_depclean(settings, trees, ldpath_mtimes,
debug = '--debug' in myopts
xterm_titles = "notitles" not in settings.features
- myroot = settings["ROOT"]
- root_config = trees[myroot]["root_config"]
+ root_len = len(settings["ROOT"])
+ eroot = settings['EROOT']
+ root_config = trees[eroot]["root_config"]
psets = root_config.setconfig.psets
deselect = myopts.get('--deselect') != 'n'
required_sets = {}
@@ -650,8 +650,8 @@ def calc_depclean(settings, trees, ldpath_mtimes,
resolver_params = create_depgraph_params(myopts, "remove")
resolver = depgraph(settings, trees, myopts, resolver_params, spinner)
resolver._load_vdb()
- vardb = resolver._frozen_config.trees[myroot]["vartree"].dbapi
- real_vardb = trees[myroot]["vartree"].dbapi
+ vardb = resolver._frozen_config.trees[eroot]["vartree"].dbapi
+ real_vardb = trees[eroot]["vartree"].dbapi
if action == "depclean":
@@ -753,7 +753,7 @@ def calc_depclean(settings, trees, ldpath_mtimes,
del e
required_sets['__excluded__'].add("=" + pkg.cpv)
- success = resolver._complete_graph(required_sets={myroot:required_sets})
+ success = resolver._complete_graph(required_sets={eroot:required_sets})
writemsg_level("\b\b... done!\n")
resolver.display_problems()
@@ -939,7 +939,7 @@ def calc_depclean(settings, trees, ldpath_mtimes,
consumers = {}
for lib in pkg_dblink.getcontents():
- lib = lib[len(myroot):]
+ lib = lib[root_len:]
lib_key = linkmap._obj_key(lib)
lib_consumers = consumer_cache.get(lib_key)
if lib_consumers is None:
@@ -1097,7 +1097,7 @@ def calc_depclean(settings, trees, ldpath_mtimes,
writemsg_level("\nCalculating dependencies ")
success = resolver._complete_graph(
- required_sets={myroot:required_sets})
+ required_sets={eroot:required_sets})
writemsg_level("\b\b... done!\n")
resolver.display_problems()
if not success:
@@ -1155,7 +1155,7 @@ def calc_depclean(settings, trees, ldpath_mtimes,
% (priority,), noiselevel=-1, level=logging.DEBUG)
try:
- atoms = resolver._select_atoms(myroot, depstr,
+ atoms = resolver._select_atoms(eroot, depstr,
myuse=node.use.enabled, parent=node,
priority=priority)[node]
except portage.exception.InvalidDependString:
@@ -1228,7 +1228,7 @@ def calc_depclean(settings, trees, ldpath_mtimes,
def action_deselect(settings, trees, opts, atoms):
enter_invalid = '--ask-enter-invalid' in opts
- root_config = trees[settings['ROOT']]['root_config']
+ root_config = trees[settings['EROOT']]['root_config']
world_set = root_config.sets['selected']
if not hasattr(world_set, 'update'):
writemsg_level("World @selected set does not appear to be mutable.\n",
@@ -1327,11 +1327,12 @@ def action_info(settings, trees, myopts, myfiles):
output_buffer = []
append = output_buffer.append
- root_config = trees[settings['ROOT']]['root_config']
+ root_config = trees[settings['EROOT']]['root_config']
+ running_eroot = trees._running_eroot
- append(getportageversion(settings["PORTDIR"], settings["ROOT"],
+ append(getportageversion(settings["PORTDIR"], None,
settings.profile_path, settings["CHOST"],
- trees[settings["ROOT"]]["vartree"].dbapi))
+ trees[settings['EROOT']]["vartree"].dbapi))
header_width = 65
header_title = "System Settings"
@@ -1371,7 +1372,7 @@ def action_info(settings, trees, myopts, myfiles):
"sys-devel/binutils", "sys-devel/libtool", "dev-lang/python"]
myvars += portage.util.grabfile(settings["PORTDIR"]+"/profiles/info_pkgs")
atoms = []
- vardb = trees["/"]["vartree"].dbapi
+ vardb = trees[running_eroot]['vartree'].dbapi
for x in myvars:
try:
x = Atom(x)
@@ -1384,7 +1385,7 @@ def action_info(settings, trees, myopts, myfiles):
myvars = sorted(set(atoms))
- portdb = trees["/"]["porttree"].dbapi
+ portdb = trees[running_eroot]['porttree'].dbapi
main_repo = portdb.getRepositoryName(portdb.porttree_root)
cp_map = {}
cp_max_len = 0
@@ -1427,7 +1428,7 @@ def action_info(settings, trees, myopts, myfiles):
append("%s %s" % \
((cp + ":").ljust(cp_max_len + 1), versions))
- libtool_vers = ",".join(trees["/"]["vartree"].dbapi.match("sys-devel/libtool"))
+ libtool_vers = ",".join(vardb.match("sys-devel/libtool"))
repos = portdb.settings.repositories
if "--verbose" in myopts:
@@ -1506,9 +1507,10 @@ def action_info(settings, trees, myopts, myfiles):
# See if we can find any packages installed matching the strings
# passed on the command line
mypkgs = []
- vardb = trees[settings["ROOT"]]["vartree"].dbapi
- portdb = trees[settings["ROOT"]]["porttree"].dbapi
- bindb = trees[settings["ROOT"]]["bintree"].dbapi
+ eroot = settings['EROOT']
+ vardb = trees[eroot]["vartree"].dbapi
+ portdb = trees[eroot]['porttree'].dbapi
+ bindb = trees[eroot]["bintree"].dbapi
for x in myfiles:
match_found = False
installed_match = vardb.match(x)
@@ -1613,19 +1615,19 @@ def action_info(settings, trees, myopts, myfiles):
continue
if pkg_type == "installed":
- portage.doebuild(ebuildpath, "info", pkgsettings["ROOT"],
- pkgsettings, debug=(settings.get("PORTAGE_DEBUG", "") == 1),
- mydbapi=trees[settings["ROOT"]]["vartree"].dbapi,
+ portage.doebuild(ebuildpath, "info", settings=pkgsettings,
+ debug=(settings.get("PORTAGE_DEBUG", "") == 1),
+ mydbapi=trees[settings['EROOT']]["vartree"].dbapi,
tree="vartree")
elif pkg_type == "ebuild":
- portage.doebuild(ebuildpath, "info", pkgsettings["ROOT"],
- pkgsettings, debug=(settings.get("PORTAGE_DEBUG", "") == 1),
- mydbapi=trees[settings["ROOT"]]["porttree"].dbapi,
+ portage.doebuild(ebuildpath, "info", settings=pkgsettings,
+ debug=(settings.get("PORTAGE_DEBUG", "") == 1),
+ mydbapi=trees[settings['EROOT']]['porttree'].dbapi,
tree="porttree")
elif pkg_type == "binary":
- portage.doebuild(ebuildpath, "info", pkgsettings["ROOT"],
- pkgsettings, debug=(settings.get("PORTAGE_DEBUG", "") == 1),
- mydbapi=trees[settings["ROOT"]]["bintree"].dbapi,
+ portage.doebuild(ebuildpath, "info", settings=pkgsettings,
+ debug=(settings.get("PORTAGE_DEBUG", "") == 1),
+ mydbapi=trees[settings['EROOT']]["bintree"].dbapi,
tree="bintree")
shutil.rmtree(tmpdir)
@@ -1905,7 +1907,7 @@ def action_sync(settings, trees, mtimedb, myopts, myaction):
enter_invalid = '--ask-enter-invalid' in myopts
xterm_titles = "notitles" not in settings.features
emergelog(xterm_titles, " === sync")
- portdb = trees[settings["ROOT"]]["porttree"].dbapi
+ portdb = trees[settings['EROOT']]['porttree'].dbapi
myportdir = portdb.porttree_root
if not myportdir:
myportdir = settings.get('PORTDIR', '')
@@ -2457,8 +2459,8 @@ def action_sync(settings, trees, mtimedb, myopts, myaction):
# Reload the whole config from scratch.
settings, trees, mtimedb = load_emerge_config(trees=trees)
adjust_configs(myopts, trees)
- root_config = trees[settings["ROOT"]]["root_config"]
- portdb = trees[settings["ROOT"]]["porttree"].dbapi
+ root_config = trees[settings['EROOT']]['root_config']
+ portdb = trees[settings['EROOT']]['porttree'].dbapi
if updatecache_flg and \
os.path.exists(os.path.join(myportdir, 'metadata', 'cache')):
@@ -2473,13 +2475,13 @@ def action_sync(settings, trees, mtimedb, myopts, myaction):
# Reload the whole config from scratch.
settings, trees, mtimedb = load_emerge_config(trees=trees)
adjust_configs(myopts, trees)
- portdb = trees[settings["ROOT"]]["porttree"].dbapi
- root_config = trees[settings["ROOT"]]["root_config"]
+ portdb = trees[settings['EROOT']]['porttree'].dbapi
+ root_config = trees[settings['EROOT']]['root_config']
mybestpv = portdb.xmatch("bestmatch-visible",
portage.const.PORTAGE_PACKAGE_ATOM)
mypvs = portage.best(
- trees[settings["ROOT"]]["vartree"].dbapi.match(
+ trees[settings['EROOT']]['vartree'].dbapi.match(
portage.const.PORTAGE_PACKAGE_ATOM))
chk_updated_cfg_files(settings["EROOT"],
@@ -2512,7 +2514,8 @@ def action_uninstall(settings, trees, ldpath_mtimes,
# For backward compat, some actions do not require leading '='.
ignore_missing_eq = action in ('clean', 'unmerge')
root = settings['ROOT']
- vardb = trees[root]['vartree'].dbapi
+ eroot = settings['EROOT']
+ vardb = trees[settings['EROOT']]['vartree'].dbapi
valid_atoms = []
lookup_owners = []
@@ -2550,7 +2553,7 @@ def action_uninstall(settings, trees, ldpath_mtimes,
valid_atoms.append(atom)
elif x.startswith(os.sep):
- if not x.startswith(root):
+ if not x.startswith(eroot):
writemsg_level(("!!! '%s' does not start with" + \
" $ROOT.\n") % x, level=logging.ERROR, noiselevel=-1)
return 1
@@ -2654,13 +2657,13 @@ def action_uninstall(settings, trees, ldpath_mtimes,
sched.settings["PORTAGE_BACKGROUND"] = "1"
sched.settings.backup_changes("PORTAGE_BACKGROUND")
sched.settings.lock()
- sched.pkgsettings[root] = portage.config(clone=sched.settings)
+ sched.pkgsettings[eroot] = portage.config(clone=sched.settings)
if action in ('clean', 'unmerge') or \
(action == 'prune' and "--nodeps" in opts):
# When given a list of atoms, unmerge them in the order given.
ordered = action == 'unmerge'
- unmerge(trees[settings["ROOT"]]['root_config'], opts, action,
+ unmerge(trees[settings['EROOT']]['root_config'], opts, action,
valid_atoms, ldpath_mtimes, ordered=ordered,
scheduler=sched._sched_iface)
rval = os.EX_OK
@@ -2793,7 +2796,7 @@ def relative_profile_path(portdir, abs_profile):
profilever = None
return profilever
-def getportageversion(portdir, target_root, profile, chost, vardb):
+def getportageversion(portdir, _unused, profile, chost, vardb):
profilever = None
if profile:
profilever = relative_profile_path(portdir, profile)
@@ -2983,7 +2986,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[trees._target_root]['vartree'].settings
+ settings = trees[trees._target_eroot]['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/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 1630a72..fc65f61 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -93,13 +93,13 @@ class _frozen_depgraph_config(object):
def __init__(self, settings, trees, myopts, spinner):
self.settings = settings
- self.target_root = settings["ROOT"]
+ self.target_root = settings["EROOT"]
self.myopts = myopts
self.edebug = 0
if settings.get("PORTAGE_DEBUG", "") == "1":
self.edebug = 1
self.spinner = spinner
- self._running_root = trees["/"]["root_config"]
+ self._running_root = trees[trees._running_eroot]["root_config"]
self._opts_no_restart = frozenset(["--buildpkgonly",
"--fetchonly", "--fetch-all-uri", "--pretend"])
self.pkgsettings = {}
@@ -1409,7 +1409,7 @@ class depgraph(object):
if removal_action:
depend_root = myroot
else:
- depend_root = "/"
+ depend_root = self._frozen_config._running_root.root
root_deps = self._frozen_config.myopts.get("--root-deps")
if root_deps is not None:
if root_deps is True:
@@ -1971,13 +1971,14 @@ class depgraph(object):
sets = root_config.sets
depgraph_sets = self._dynamic_config.sets[root_config.root]
myfavorites=[]
- myroot = self._frozen_config.target_root
- dbs = self._dynamic_config._filtered_trees[myroot]["dbs"]
- vardb = self._frozen_config.trees[myroot]["vartree"].dbapi
- real_vardb = self._frozen_config._trees_orig[myroot]["vartree"].dbapi
- portdb = self._frozen_config.trees[myroot]["porttree"].dbapi
- bindb = self._frozen_config.trees[myroot]["bintree"].dbapi
- pkgsettings = self._frozen_config.pkgsettings[myroot]
+ eroot = root_config.root
+ root = root_config.settings['ROOT']
+ dbs = self._dynamic_config._filtered_trees[eroot]["dbs"]
+ vardb = self._frozen_config.trees[eroot]["vartree"].dbapi
+ real_vardb = self._frozen_config._trees_orig[eroot]["vartree"].dbapi
+ portdb = self._frozen_config.trees[eroot]["porttree"].dbapi
+ bindb = self._frozen_config.trees[eroot]["bintree"].dbapi
+ pkgsettings = self._frozen_config.pkgsettings[eroot]
args = []
onlydeps = "--onlydeps" in self._frozen_config.myopts
lookup_owners = []
@@ -1998,7 +1999,7 @@ class depgraph(object):
mytbz2=portage.xpak.tbz2(x)
mykey=mytbz2.getelements("CATEGORY")[0]+"/"+os.path.splitext(os.path.basename(x))[0]
if os.path.realpath(x) != \
- os.path.realpath(self._frozen_config.trees[myroot]["bintree"].getname(mykey)):
+ os.path.realpath(bindb.bintree.getname(mykey)):
writemsg(colorize("BAD", "\n*** You need to adjust PKGDIR to emerge this package.\n\n"), noiselevel=-1)
self._dynamic_config._skip_restart = True
return 0, myfavorites
@@ -2044,7 +2045,7 @@ class depgraph(object):
args.append(PackageArg(arg=x, package=pkg,
root_config=root_config))
elif x.startswith(os.path.sep):
- if not x.startswith(myroot):
+ if not x.startswith(root):
portage.writemsg(("\n\n!!! '%s' does not start with" + \
" $ROOT.\n") % x, noiselevel=-1)
self._dynamic_config._skip_restart = True
@@ -2055,7 +2056,7 @@ class depgraph(object):
elif x.startswith("." + os.sep) or \
x.startswith(".." + os.sep):
f = os.path.abspath(x)
- if not f.startswith(myroot):
+ if not f.startswith(root):
portage.writemsg(("\n\n!!! '%s' (resolved from '%s') does not start with" + \
" $ROOT.\n") % (f, x), noiselevel=-1)
self._dynamic_config._skip_restart = True
@@ -2174,7 +2175,7 @@ class depgraph(object):
for x in lookup_owners:
if not search_for_multiple and os.path.isdir(x):
search_for_multiple = True
- relative_paths.append(x[len(myroot)-1:])
+ relative_paths.append(x[len(root)-1:])
owners = set()
for pkg, relative_path in \
diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index b170ea3..f0f50bd 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -316,7 +316,7 @@ def post_emerge(myaction, myopts, myfiles,
@type myopts: dict
@param myfiles: emerge arguments
@type myfiles: list
- @param target_root: The target ROOT for myaction
+ @param target_root: The target EROOT for myaction
@type target_root: String
@param trees: A dictionary mapping each ROOT to it's package databases
@type trees: dict
@@ -327,7 +327,7 @@ def post_emerge(myaction, myopts, myfiles,
"""
root_config = trees[target_root]["root_config"]
- vardbapi = trees[target_root]["vartree"].dbapi
+ vardbapi = trees[target_root]['vartree'].dbapi
settings = vardbapi.settings
info_mtimes = mtimedb["info"]
@@ -1600,7 +1600,7 @@ def emerge_main(args=None):
# Portage needs to ensure a sane umask for the files it creates.
os.umask(0o22)
settings, trees, mtimedb = load_emerge_config()
- portdb = trees[settings["ROOT"]]["porttree"].dbapi
+ portdb = trees[settings['EROOT']]['porttree'].dbapi
rval = profile_check(trees, myaction)
if rval != os.EX_OK:
return rval
@@ -1618,7 +1618,7 @@ def emerge_main(args=None):
mtimedb.commit()
# Reload the whole config from scratch.
settings, trees, mtimedb = load_emerge_config(trees=trees)
- portdb = trees[settings["ROOT"]]["porttree"].dbapi
+ portdb = trees[settings['EROOT']]['porttree'].dbapi
xterm_titles = "notitles" not in settings.features
if xterm_titles:
@@ -1629,7 +1629,7 @@ def emerge_main(args=None):
# Reload the whole config from scratch so that the portdbapi internal
# config is updated with new FEATURES.
settings, trees, mtimedb = load_emerge_config(trees=trees)
- portdb = trees[settings["ROOT"]]["porttree"].dbapi
+ portdb = trees[settings['EROOT']]['porttree'].dbapi
# NOTE: adjust_configs() can map options to FEATURES, so any relevant
# options adjustments should be made prior to calling adjust_configs().
@@ -1641,9 +1641,9 @@ def emerge_main(args=None):
if myaction == 'version':
writemsg_stdout(getportageversion(
- settings["PORTDIR"], settings["ROOT"],
+ settings["PORTDIR"], None,
settings.profile_path, settings["CHOST"],
- trees[settings["ROOT"]]["vartree"].dbapi) + '\n', noiselevel=-1)
+ trees[settings['EROOT']]['vartree'].dbapi) + '\n', noiselevel=-1)
return 0
elif myaction == 'help':
_emerge.help.help()
@@ -1722,7 +1722,7 @@ def emerge_main(args=None):
print(colorize("BAD", "\n*** emerging by path is broken and may not always work!!!\n"))
break
- root_config = trees[settings["ROOT"]]["root_config"]
+ root_config = trees[settings['EROOT']]['root_config']
if myaction == "list-sets":
writemsg_stdout("".join("%s\n" % s for s in sorted(root_config.sets)))
return os.EX_OK
@@ -1921,7 +1921,7 @@ def emerge_main(args=None):
# SEARCH action
elif "search"==myaction:
validate_ebuild_environment(trees)
- action_search(trees[settings["ROOT"]]["root_config"],
+ action_search(trees[settings['EROOT']]['root_config'],
myopts, myfiles, spinner)
elif myaction in ('clean', 'depclean', 'deselect', 'prune', 'unmerge'):
@@ -1929,16 +1929,16 @@ def emerge_main(args=None):
rval = action_uninstall(settings, trees, mtimedb["ldpath"],
myopts, myaction, myfiles, spinner)
if not (myaction == 'deselect' or buildpkgonly or fetchonly or pretend):
- post_emerge(myaction, myopts, myfiles, settings["ROOT"],
+ post_emerge(myaction, myopts, myfiles, settings['EROOT'],
trees, mtimedb, rval)
return rval
elif myaction == 'info':
# Ensure atoms are valid before calling unmerge().
- vardb = trees[settings["ROOT"]]["vartree"].dbapi
- portdb = trees[settings["ROOT"]]["porttree"].dbapi
- bindb = trees[settings["ROOT"]]["bintree"].dbapi
+ vardb = trees[settings['EROOT']]['vartree'].dbapi
+ portdb = trees[settings['EROOT']]['porttree'].dbapi
+ bindb = trees[settings['EROOT']]["bintree"].dbapi
valid_atoms = []
for x in myfiles:
if is_valid_package_atom(x):
@@ -2001,7 +2001,7 @@ def emerge_main(args=None):
display_news_notification(root_config, myopts)
retval = action_build(settings, trees, mtimedb,
myopts, myaction, myfiles, spinner)
- post_emerge(myaction, myopts, myfiles, settings["ROOT"],
+ post_emerge(myaction, myopts, myfiles, settings['EROOT'],
trees, mtimedb, retval)
return retval
diff --git a/pym/_emerge/unmerge.py b/pym/_emerge/unmerge.py
index 3db3a8b..852ad93 100644
--- a/pym/_emerge/unmerge.py
+++ b/pym/_emerge/unmerge.py
@@ -546,8 +546,8 @@ def unmerge(root_config, myopts, unmerge_action,
emergelog(xterm_titles, "=== Unmerging... ("+y+")")
mysplit = y.split("/")
#unmerge...
- retval = portage.unmerge(mysplit[0], mysplit[1], settings["ROOT"],
- mysettings, unmerge_action not in ["clean","prune"],
+ retval = portage.unmerge(mysplit[0], mysplit[1],
+ settings=mysettings,
vartree=vartree, ldpath_mtimes=ldpath_mtimes,
scheduler=scheduler)
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 3dc9ae5..03ec286 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -482,8 +482,8 @@ def portageexit():
class _trees_dict(dict):
def __init__(self):
super(dict, self).__init__()
- self._running_root = None
- self._target_root = None
+ self._running_eroot = None
+ self._target_eroot = None
def create_trees(config_root=None, target_root=None, trees=None, env=None):
if trees is None:
@@ -503,10 +503,10 @@ 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)]
+ trees._target_eroot = settings['EROOT']
+ myroots = [(settings['EROOT'], settings)]
if settings["ROOT"] == "/":
- trees._running_root = trees._target_root
+ trees._running_eroot = trees._target_eroot
else:
# When ROOT != "/" we only want overrides from the calling
@@ -522,19 +522,19 @@ 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))
+ trees._running_eroot = settings['EROOT']
+ myroots.append((settings['EROOT'], settings))
for myroot, mysettings in myroots:
trees[myroot] = portage.util.LazyItemsDict(trees.get(myroot, {}))
trees[myroot].addLazySingleton("virtuals", mysettings.getvirtuals)
trees[myroot].addLazySingleton(
- "vartree", vartree, myroot, categories=mysettings.categories,
+ "vartree", vartree, categories=mysettings.categories,
settings=mysettings)
trees[myroot].addLazySingleton("porttree",
- portagetree, myroot, settings=mysettings)
+ portagetree, settings=mysettings)
trees[myroot].addLazySingleton("bintree",
- binarytree, myroot, mysettings["PKGDIR"], settings=mysettings)
+ binarytree, pkgdir=mysettings["PKGDIR"], settings=mysettings)
return trees
if VERSION == 'HEAD':
diff --git a/pym/portage/_global_updates.py b/pym/portage/_global_updates.py
index 72fd5c4..5175043 100644
--- a/pym/portage/_global_updates.py
+++ b/pym/portage/_global_updates.py
@@ -37,7 +37,7 @@ def _global_updates(trees, prev_mtimes, quiet=False, if_mtime_changed=True):
"SANDBOX_ACTIVE" in os.environ or \
len(trees) != 1:
return retupd
- root = "/"
+ root = trees._running_eroot
mysettings = trees[root]["vartree"].settings
portdb = trees[root]["porttree"].dbapi
vardb = trees[root]["vartree"].dbapi
diff --git a/pym/portage/_legacy_globals.py b/pym/portage/_legacy_globals.py
index beba785..072b3f7 100644
--- a/pym/portage/_legacy_globals.py
+++ b/pym/portage/_legacy_globals.py
@@ -35,13 +35,15 @@ def _get_legacy_global(name):
constructed.add('db')
del portage._initializing_globals
- settings = portage.db[portage.db._target_root]["vartree"].settings
+ settings = portage.db[portage.db._target_eroot]["vartree"].settings
portage.output._init(config_root=settings['PORTAGE_CONFIGROOT'])
portage.settings = settings
constructed.add('settings')
- portage.root = portage.db._target_root
+ # Since portage.db now uses EROOT for keys instead of ROOT, we make
+ # portage.root refer to EROOT such that it continues works as a key.
+ portage.root = portage.db._target_eroot
constructed.add('root')
# COMPATIBILITY
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index b69b363..f766453 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -147,7 +147,7 @@ class vardbapi(dbapi):
self._fs_lock_count = 0
if vartree is None:
- vartree = portage.db[settings["ROOT"]]["vartree"]
+ vartree = portage.db[settings['EROOT']]['vartree']
self.vartree = vartree
self._aux_cache_keys = set(
["BUILD_TIME", "CHOST", "COUNTER", "DEPEND", "DESCRIPTION",
@@ -1319,7 +1319,7 @@ class dblink(object):
raise TypeError("settings argument is required")
mysettings = settings
- myroot = settings['ROOT']
+ self._eroot = mysettings['EROOT']
self.cat = cat
self.pkg = pkg
self.mycpv = self.cat + "/" + self.pkg
@@ -1327,14 +1327,10 @@ class dblink(object):
self.mysplit[0] = "%s/%s" % (self.cat, self.mysplit[0])
self.treetype = treetype
if vartree is None:
- vartree = portage.db[myroot]["vartree"]
+ vartree = portage.db[self._eroot]["vartree"]
self.vartree = vartree
self._blockers = blockers
self._scheduler = scheduler
-
- # WARNING: EROOT support is experimental and may be incomplete
- # for cases in which EPREFIX is non-empty.
- self._eroot = mysettings['EROOT']
self.dbroot = normalize_path(os.path.join(self._eroot, VDB_PATH))
self.dbcatdir = self.dbroot+"/"+cat
self.dbpkgdir = self.dbcatdir+"/"+pkg
@@ -1343,14 +1339,14 @@ class dblink(object):
self.settings = mysettings
self._verbose = self.settings.get("PORTAGE_VERBOSE") == "1"
- self.myroot=myroot
+ self.myroot = self.settings['ROOT']
self._installed_instance = None
self.contentscache = None
self._contents_inodes = None
self._contents_basenames = None
self._linkmap_broken = False
self._md5_merge_map = {}
- self._hash_key = (self.myroot, self.mycpv)
+ self._hash_key = (self._eroot, self.mycpv)
self._protect_obj = None
self._pipe = pipe
diff --git a/pym/portage/news.py b/pym/portage/news.py
index 1bf0522..13d6832 100644
--- a/pym/portage/news.py
+++ b/pym/portage/news.py
@@ -39,7 +39,6 @@ class NewsManager(object):
def __init__(self, portdb, vardb, news_path, unread_path, language_id='en'):
self.news_path = news_path
self.unread_path = unread_path
- self.target_root = vardb.settings["ROOT"]
self.language_id = language_id
self.config = vardb.settings
self.vdb = vardb
diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
index a2d2c8c..ccea574 100644
--- a/pym/portage/package/ebuild/doebuild.py
+++ b/pym/portage/package/ebuild/doebuild.py
@@ -420,9 +420,9 @@ def doebuild(myebuild, mydo, _unused=None, settings=None, debug=0, listonly=0,
if settings is None:
raise TypeError("settings parameter is required")
mysettings = settings
- myroot = settings["ROOT"]
+ myroot = settings['EROOT']
- if _unused is not None and _unused != mysettings["ROOT"]:
+ if _unused is not None and _unused != mysettings['EROOT']:
warnings.warn("The third parameter of the "
"portage.doebuild() is now unused. Use "
"settings['ROOT'] instead.",
@@ -936,7 +936,7 @@ def doebuild(myebuild, mydo, _unused=None, settings=None, debug=0, listonly=0,
# this phase. This can raise PermissionDenied if
# the current user doesn't have write access to $PKGDIR.
if hasattr(portage, 'db'):
- bintree = portage.db[mysettings["ROOT"]]["bintree"]
+ bintree = portage.db[mysettings['EROOT']]['bintree']
mysettings["PORTAGE_BINPKG_TMPFILE"] = \
bintree.getname(mysettings.mycpv) + \
".%s" % (os.getpid(),)
diff --git a/pym/portage/tests/ebuild/test_config.py b/pym/portage/tests/ebuild/test_config.py
index fe9b648..6eb1361 100644
--- a/pym/portage/tests/ebuild/test_config.py
+++ b/pym/portage/tests/ebuild/test_config.py
@@ -24,7 +24,7 @@ class ConfigTestCase(TestCase):
settings = config(clone=playground.settings)
result = playground.run(["=dev-libs/A-1"])
pkg, existing_node = result.depgraph._select_package(
- playground.root, "=dev-libs/A-1")
+ playground.eroot, "=dev-libs/A-1")
settings.setcpv(pkg)
# clone after setcpv tests deepcopy of LazyItemsDict
diff --git a/pym/portage/tests/ebuild/test_doebuild_spawn.py b/pym/portage/tests/ebuild/test_doebuild_spawn.py
index cafb16d..daa6e75 100644
--- a/pym/portage/tests/ebuild/test_doebuild_spawn.py
+++ b/pym/portage/tests/ebuild/test_doebuild_spawn.py
@@ -36,7 +36,7 @@ class DoebuildSpawnTestCase(TestCase):
'RDEPEND' : '>=app-shells/bash-3.2_p17 >=dev-lang/python-2.6',
'SLOT' : '0',
}
- root_config = playground.trees[playground.root]['root_config']
+ root_config = playground.trees[playground.eroot]['root_config']
pkg = Package(built=False, cpv=cpv, installed=False,
metadata=metadata, root_config=root_config,
type_name='ebuild')
diff --git a/pym/portage/tests/emerge/test_simple.py b/pym/portage/tests/emerge/test_simple.py
index c2c57a3..aaa54d0 100644
--- a/pym/portage/tests/emerge/test_simple.py
+++ b/pym/portage/tests/emerge/test_simple.py
@@ -134,7 +134,7 @@ pkg_info() {
eroot = settings["EROOT"]
trees = playground.trees
root = playground.root
- portdb = trees[root]["porttree"].dbapi
+ portdb = trees[eroot]["porttree"].dbapi
portdir = settings["PORTDIR"]
var_cache_edb = os.path.join(eprefix, "var", "cache", "edb")
cachedir = os.path.join(var_cache_edb, "dep")
@@ -214,14 +214,14 @@ pkg_info() {
emaint_cmd + ("--fix", "all"),
fixpackages_cmd,
regenworld_cmd,
- portageq_cmd + ("match", "/", "dev-libs/A"),
- portageq_cmd + ("best_visible", "/", "dev-libs/A"),
- portageq_cmd + ("best_visible", "/", "binary", "dev-libs/A"),
- portageq_cmd + ("contents", "/", "dev-libs/A-1"),
- portageq_cmd + ("metadata", "/", "ebuild", "dev-libs/A-1", "EAPI", "IUSE", "RDEPEND"),
- portageq_cmd + ("metadata", "/", "binary", "dev-libs/A-1", "EAPI", "USE", "RDEPEND"),
- portageq_cmd + ("metadata", "/", "installed", "dev-libs/A-1", "EAPI", "USE", "RDEPEND"),
- portageq_cmd + ("owners", "/", eroot + "usr"),
+ portageq_cmd + ("match", eroot, "dev-libs/A"),
+ portageq_cmd + ("best_visible", eroot, "dev-libs/A"),
+ portageq_cmd + ("best_visible", eroot, "binary", "dev-libs/A"),
+ portageq_cmd + ("contents", eroot, "dev-libs/A-1"),
+ portageq_cmd + ("metadata", eroot, "ebuild", "dev-libs/A-1", "EAPI", "IUSE", "RDEPEND"),
+ portageq_cmd + ("metadata", eroot, "binary", "dev-libs/A-1", "EAPI", "USE", "RDEPEND"),
+ portageq_cmd + ("metadata", eroot, "installed", "dev-libs/A-1", "EAPI", "USE", "RDEPEND"),
+ portageq_cmd + ("owners", eroot, eroot + "usr"),
emerge_cmd + ("-p", eroot + "usr"),
emerge_cmd + ("-p", "--unmerge", "-q", eroot + "usr"),
emerge_cmd + ("--unmerge", "--quiet", "dev-libs/A"),
diff --git a/pym/portage/tests/repoman/test_simple.py b/pym/portage/tests/repoman/test_simple.py
index 9dae0ef..6c8a61c 100644
--- a/pym/portage/tests/repoman/test_simple.py
+++ b/pym/portage/tests/repoman/test_simple.py
@@ -128,7 +128,7 @@ class SimpleRepomanTestCase(TestCase):
settings = playground.settings
eprefix = settings["EPREFIX"]
eroot = settings["EROOT"]
- portdb = playground.trees[playground.root]["porttree"].dbapi
+ portdb = playground.trees[playground.eroot]["porttree"].dbapi
homedir = os.path.join(eroot, "home")
distdir = os.path.join(eprefix, "distdir")
portdir = settings["PORTDIR"]
diff --git a/pym/portage/tests/resolver/ResolverPlayground.py b/pym/portage/tests/resolver/ResolverPlayground.py
index 4bbd033..57cdebe 100644
--- a/pym/portage/tests/resolver/ResolverPlayground.py
+++ b/pym/portage/tests/resolver/ResolverPlayground.py
@@ -201,7 +201,7 @@ class ResolverPlayground(object):
ebuild_dir = os.path.join(repo_dir, a.cp)
ebuild_path = os.path.join(ebuild_dir, a.cpv.split("/")[1] + ".ebuild")
- portdb = self.trees[self.root]["porttree"].dbapi
+ portdb = self.trees[self.eroot]["porttree"].dbapi
tmpsettings['O'] = ebuild_dir
if not digestgen(mysettings=tmpsettings, myportdb=portdb):
raise AssertionError('digest creation failed for %s' % ebuild_path)
@@ -549,7 +549,7 @@ class ResolverPlayground(object):
return
def cleanup(self):
- portdb = self.trees[self.root]["porttree"].dbapi
+ portdb = self.trees[self.eroot]["porttree"].dbapi
portdb.close_caches()
portage.dbapi.porttree.portdbapi.portdbapi_instances.remove(portdb)
if self.debug:
diff --git a/pym/portage/util/env_update.py b/pym/portage/util/env_update.py
index 65ed2db..1435932 100644
--- a/pym/portage/util/env_update.py
+++ b/pym/portage/util/env_update.py
@@ -46,12 +46,18 @@ def env_update(makelinks=1, target_root=None, prev_mtimes=None, contents=None,
vardbapi = vartree(settings=env).dbapi
else:
if target_root is None:
+ eprefix = portage.settings["EPREFIX"]
target_root = portage.settings["ROOT"]
- if hasattr(portage, "db") and target_root in portage.db:
- vardbapi = portage.db[target_root]["vartree"].dbapi
+ target_eroot = portage.settings['EROOT']
+ else:
+ eprefix = os.environ.get("__PORTAGE_TEST_EPREFIX", "")
+ target_eroot = os.path.join(target_root, eprefix)
+ target_eroot = target_eroot.rstrip(os.sep) + os.sep
+ if hasattr(portage, "db") and target_eroot in portage.db:
+ vardbapi = portage.db[target_eroot]["vartree"].dbapi
else:
settings = config(config_root=target_root,
- target_root=target_root)
+ target_root=target_root, eprefix=eprefix)
target_root = settings["ROOT"]
if env is None:
env = settings