The <eroot> parameter is ineffective for commands that query configuration, since the PORTAGE_CONFIGROOT variable controls the location of configuration files. Therefore, for portageq repos_config, implicitly set PORTAGE_CONFIGROOT equal to the value of the <eroot> parameter. Note that this works correctly for both prefix and non-prefix systems, because both EROOT and PORTAGE_CONFIGROOT are supposed to include the EPREFIX offset.
Bug: https://bugs.gentoo.org/648062 --- bin/portageq | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/bin/portageq b/bin/portageq index 0ac124fde..c7a0e1554 100755 --- a/bin/portageq +++ b/bin/portageq @@ -62,6 +62,12 @@ def eval_atom_use(atom): atom = atom.evaluate_conditionals(use) return atom + +def uses_configroot(function): + function.uses_configroot = True + return function + + def uses_eroot(function): function.uses_eroot = True return function @@ -696,6 +702,7 @@ docstrings['gentoo_mirrors'] = """ gentoo_mirrors.__doc__ = docstrings['gentoo_mirrors'] +@uses_configroot @uses_eroot def repositories_configuration(argv): if len(argv) < 1: @@ -710,6 +717,7 @@ docstrings['repositories_configuration'] = """<eroot> repositories_configuration.__doc__ = docstrings['repositories_configuration'] +@uses_configroot @uses_eroot def repos_config(argv): return repositories_configuration(argv) @@ -1425,6 +1433,14 @@ def main(argv): os.environ["ROOT"] = root + if getattr(function, "uses_configroot", False): + os.environ["PORTAGE_CONFIGROOT"] = eroot + # Disable RepoConfigLoader location validation, allowing raw + # configuration to pass through, since repo locations are not + # necessarily expected to exist if the configuration comes + # from a chroot. + portage._sync_mode = True + args = argv[2:] try: -- 2.13.6