Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: bin/
Date: Mon, 26 Mar 2018 17:44:05
Message-Id: 1522086170.382f4be415394886026ccd5dcd08ca96ecda31fa.zmedico@gentoo
1 commit: 382f4be415394886026ccd5dcd08ca96ecda31fa
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Fri Mar 23 16:29:13 2018 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Mon Mar 26 17:42:50 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=382f4be4
7
8 portageq repos_config: fix <eroot> parameter (bug 648062)
9
10 The <eroot> parameter is ineffective for commands that query
11 configuration, since the PORTAGE_CONFIGROOT variable controls
12 the location of configuration files. Therefore, for portageq
13 repos_config, implicitly set PORTAGE_CONFIGROOT equal to the
14 value of the <eroot> parameter. Note that this works correctly
15 for both prefix and non-prefix systems, because both EROOT and
16 PORTAGE_CONFIGROOT are supposed to include the EPREFIX offset.
17
18 Bug: https://bugs.gentoo.org/648062
19
20 bin/portageq | 18 +++++++++++++++++-
21 1 file changed, 17 insertions(+), 1 deletion(-)
22
23 diff --git a/bin/portageq b/bin/portageq
24 index 0ac124fde..e9b8b20e0 100755
25 --- a/bin/portageq
26 +++ b/bin/portageq
27 @@ -1,5 +1,5 @@
28 #!/usr/bin/python -b
29 -# Copyright 1999-2016 Gentoo Foundation
30 +# Copyright 1999-2018 Gentoo Foundation
31 # Distributed under the terms of the GNU General Public License v2
32
33 from __future__ import print_function, unicode_literals
34 @@ -62,6 +62,12 @@ def eval_atom_use(atom):
35 atom = atom.evaluate_conditionals(use)
36 return atom
37
38 +
39 +def uses_configroot(function):
40 + function.uses_configroot = True
41 + return function
42 +
43 +
44 def uses_eroot(function):
45 function.uses_eroot = True
46 return function
47 @@ -696,6 +702,7 @@ docstrings['gentoo_mirrors'] = """
48 gentoo_mirrors.__doc__ = docstrings['gentoo_mirrors']
49
50
51 +@uses_configroot
52 @uses_eroot
53 def repositories_configuration(argv):
54 if len(argv) < 1:
55 @@ -710,6 +717,7 @@ docstrings['repositories_configuration'] = """<eroot>
56 repositories_configuration.__doc__ = docstrings['repositories_configuration']
57
58
59 +@uses_configroot
60 @uses_eroot
61 def repos_config(argv):
62 return repositories_configuration(argv)
63 @@ -1425,6 +1433,14 @@ def main(argv):
64
65 os.environ["ROOT"] = root
66
67 + if getattr(function, "uses_configroot", False):
68 + os.environ["PORTAGE_CONFIGROOT"] = eroot
69 + # Disable RepoConfigLoader location validation, allowing raw
70 + # configuration to pass through, since repo locations are not
71 + # necessarily expected to exist if the configuration comes
72 + # from a chroot.
73 + portage._sync_mode = True
74 +
75 args = argv[2:]
76
77 try: