diff --git a/NEWS b/NEWS index d0f5ff4ef6..a380e0c92e 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,13 @@ Release notes take the form of the following optional categories: * Bug fixes * Cleanups +portage-3.0.68 (UNRELEASED) +-------------- + +Features: +* Allow "portageq envvar" to treat a trailing * as a wildcard, matching multiple + variables. Useful for multilib. + portage-3.0.67 (2025-01-22) -------------- diff --git a/bin/portageq b/bin/portageq index 7d521b6ba5..e89c453686 100755 --- a/bin/portageq +++ b/bin/portageq @@ -877,15 +877,22 @@ try: file=sys.stderr, ) - value = portage.settings.get(arg) - if value is None: - value = "" - exit_status = 1 - - if verbose: - print(arg + "=" + shlex.quote(value)) + if arg.endswith("*"): + arg = arg[0:-1] + keys = [key for key in portage.settings.keys() if key.startswith(arg)] else: - print(value) + keys = (arg,) + + for key in keys: + value = portage.settings.get(key) + if value is None: + value = "" + exit_status = 1 + + if verbose: + print(key + "=" + shlex.quote(value)) + else: + print(value) return exit_status @@ -893,6 +900,7 @@ try: "envvar" ] = """+ Returns a specific environment variable as exists prior to ebuild.sh. + Variable names can end with * to match multiple variables. Similar to: emerge --verbose --info | grep -E '^=' """ envvar.__doc__ = docstrings["envvar"] diff --git a/lib/portage/tests/emerge/conftest.py b/lib/portage/tests/emerge/conftest.py index ce86dc4fcd..043c3821c2 100644 --- a/lib/portage/tests/emerge/conftest.py +++ b/lib/portage/tests/emerge/conftest.py @@ -536,6 +536,7 @@ def _generate_all_baseline_commands(playground, binhost): "EROOT", "PORTAGE_CONFIGROOT", "PORTAGE_TMPDIR", + "CHOST*", "USERLAND", ) test_commands["etc-update"] = EtcUpdate()