Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Cc: Zac Medico <zmedico@g.o>
Subject: [gentoo-portage-dev] [PATCH] portageq repos_config: fix <eroot> parameter (bug 648062)
Date: Sat, 24 Mar 2018 01:37:14
Message-Id: 20180324013648.8234-1-zmedico@gentoo.org
1 The <eroot> parameter is ineffective for commands that query
2 configuration, since the PORTAGE_CONFIGROOT variable controls
3 the location of configuration files. Therefore, for portageq
4 repos_config, implicitly set PORTAGE_CONFIGROOT equal to the
5 value of the <eroot> parameter. Note that this works correctly
6 for both prefix and non-prefix systems, because both EROOT and
7 PORTAGE_CONFIGROOT are supposed to include the EPREFIX offset.
8
9 Bug: https://bugs.gentoo.org/648062
10 ---
11 bin/portageq | 16 ++++++++++++++++
12 1 file changed, 16 insertions(+)
13
14 diff --git a/bin/portageq b/bin/portageq
15 index 0ac124fde..c7a0e1554 100755
16 --- a/bin/portageq
17 +++ b/bin/portageq
18 @@ -62,6 +62,12 @@ def eval_atom_use(atom):
19 atom = atom.evaluate_conditionals(use)
20 return atom
21
22 +
23 +def uses_configroot(function):
24 + function.uses_configroot = True
25 + return function
26 +
27 +
28 def uses_eroot(function):
29 function.uses_eroot = True
30 return function
31 @@ -696,6 +702,7 @@ docstrings['gentoo_mirrors'] = """
32 gentoo_mirrors.__doc__ = docstrings['gentoo_mirrors']
33
34
35 +@uses_configroot
36 @uses_eroot
37 def repositories_configuration(argv):
38 if len(argv) < 1:
39 @@ -710,6 +717,7 @@ docstrings['repositories_configuration'] = """<eroot>
40 repositories_configuration.__doc__ = docstrings['repositories_configuration']
41
42
43 +@uses_configroot
44 @uses_eroot
45 def repos_config(argv):
46 return repositories_configuration(argv)
47 @@ -1425,6 +1433,14 @@ def main(argv):
48
49 os.environ["ROOT"] = root
50
51 + if getattr(function, "uses_configroot", False):
52 + os.environ["PORTAGE_CONFIGROOT"] = eroot
53 + # Disable RepoConfigLoader location validation, allowing raw
54 + # configuration to pass through, since repo locations are not
55 + # necessarily expected to exist if the configuration comes
56 + # from a chroot.
57 + portage._sync_mode = True
58 +
59 args = argv[2:]
60
61 try:
62 --
63 2.13.6