Gentoo Archives: gentoo-portage-dev

From: Ruud Koolen <redlizard@×××××××××.nl>
To: gentoo-portage-dev@l.g.o
Subject: [gentoo-portage-dev] [PATCH 1/3] Distinguish between portage prefix and package prefix
Date: Mon, 17 Jun 2013 07:23:38
Message-Id: 201306170923.23472.redlizard@redlizard.nl
In Reply to: [gentoo-portage-dev] [PATCH 0/3] Add cross-prefix support by Ruud Koolen
1 This lets portage distinguish between the prefix where portage itself is
2 installed, and the prefix of the packages it is installing. The former is
3 stored in portage.const.EPREFIX and should rarely be overridden (though the
4 PORTAGE_OVERRIDE_EPREFIX environment variable remains), whereas the latter
5 can be found in the EPREFIX variable of a config instance and is much more
6 readily changed.
7 ---
8 bin/dispatch-conf | 2 +-
9 bin/portageq | 2 +-
10 pym/portage/dispatch_conf.py | 2 +-
11 pym/portage/package/ebuild/doebuild.py | 2 +-
12 pym/portage/util/env_update.py | 3 +--
13 5 files changed, 5 insertions(+), 6 deletions(-)
14
15 diff --git a/bin/dispatch-conf b/bin/dispatch-conf
16 index a41464f..10455f4 100755
17 --- a/bin/dispatch-conf
18 +++ b/bin/dispatch-conf
19 @@ -79,7 +79,7 @@ class dispatch:
20 confs = []
21 count = 0
22
23 - config_root = portage.const.EPREFIX or os.sep
24 + config_root = portage.settings["EPREFIX"] or os.sep
25 self.options = portage.dispatch_conf.read_config(MANDATORY_OPTS)
26
27 if "log-file" in self.options:
28 diff --git a/bin/portageq b/bin/portageq
29 index c88ee88..1ae1fe1 100755
30 --- a/bin/portageq
31 +++ b/bin/portageq
32 @@ -1232,7 +1232,7 @@ def main(argv):
33 sys.stderr.write("Run portageq with --help for info\n")
34 sys.stderr.flush()
35 sys.exit(os.EX_USAGE)
36 - eprefix = portage.const.EPREFIX
37 + eprefix = portage.settings["EPREFIX"]
38 eroot = portage.util.normalize_path(argv[2])
39
40 if eprefix:
41 diff --git a/pym/portage/dispatch_conf.py b/pym/portage/dispatch_conf.py
42 index 4c68dfc..570bd8c 100644
43 --- a/pym/portage/dispatch_conf.py
44 +++ b/pym/portage/dispatch_conf.py
45 @@ -43,7 +43,7 @@ def diffstatusoutput(cmd, file1, file2):
46 return (proc.wait(), output)
47
48 def read_config(mandatory_opts):
49 - eprefix = portage.const.EPREFIX
50 + eprefix = portage.settings["EPREFIX"]
51 config_path = os.path.join(eprefix or os.sep, "etc/dispatch-conf.conf")
52 loader = KeyValuePairFileLoader(config_path, None)
53 opts, errors = loader.load()
54 diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
55 index 6de47bb..69463d2 100644
56 --- a/pym/portage/package/ebuild/doebuild.py
57 +++ b/pym/portage/package/ebuild/doebuild.py
58 @@ -159,7 +159,7 @@ def _doebuild_path(settings, eapi=None):
59 # Note: PORTAGE_BIN_PATH may differ from the global constant
60 # when portage is reinstalling itself.
61 portage_bin_path = settings["PORTAGE_BIN_PATH"]
62 - eprefix = settings["EPREFIX"]
63 + eprefix = portage.const.EPREFIX
64 prerootpath = [x for x in settings.get("PREROOTPATH", "").split(":") if x]
65 rootpath = [x for x in settings.get("ROOTPATH", "").split(":") if x]
66 overrides = [x for x in settings.get(
67 diff --git a/pym/portage/util/env_update.py b/pym/portage/util/env_update.py
68 index e9c06c5..289842c 100644
69 --- a/pym/portage/util/env_update.py
70 +++ b/pym/portage/util/env_update.py
71 @@ -46,12 +46,11 @@ def env_update(makelinks=1, target_root=None, prev_mtimes=None, contents=None,
72 if isinstance(env, config):
73 vardbapi = vartree(settings=env).dbapi
74 else:
75 + eprefix = portage.settings["EPREFIX"]
76 if target_root is None:
77 - eprefix = portage.settings["EPREFIX"]
78 target_root = portage.settings["ROOT"]
79 target_eroot = portage.settings['EROOT']
80 else:
81 - eprefix = portage.const.EPREFIX
82 target_eroot = os.path.join(target_root,
83 eprefix.lstrip(os.sep))
84 target_eroot = target_eroot.rstrip(os.sep) + os.sep
85 --
86 1.7.2.5