commit: 60c6e9b0f094ff68c364d9c6fb38faff23cb734f Author: Florian Schmaus <flow <AT> gentoo <DOT> org> AuthorDate: Sat Nov 15 11:13:08 2025 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Mon Nov 24 21:31:56 2025 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=60c6e9b0
Do not export profile-specific PMS USE_EXPAND_* variables in EAPI 9 Second part of a two part commit set that makes portage stop exporting further PMS variables. Those are the "dynamic" PMS variables of the list found at https://bugs.gentoo.org/948001#c2 Closes: https://bugs.gentoo.org/948001 Signed-off-by: Florian Schmaus <flow <AT> gentoo.org> Part-of: https://github.com/gentoo/portage/pull/1512 Closes: https://github.com/gentoo/portage/pull/1512 Signed-off-by: Sam James <sam <AT> gentoo.org> lib/portage/package/ebuild/doebuild.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/lib/portage/package/ebuild/doebuild.py b/lib/portage/package/ebuild/doebuild.py index 4fd399e97d..7eda47b7b3 100644 --- a/lib/portage/package/ebuild/doebuild.py +++ b/lib/portage/package/ebuild/doebuild.py @@ -2271,14 +2271,27 @@ def spawn( mysettings["PORTAGE_EBUILD_EXTRA_SOURCE"] = ebuild_extra_source_path with open(ebuild_extra_source_path, mode="w") as f: - for var_name in unexported_env_vars: - var_value = mysettings.environ().get(var_name) + + def unexport_var(var_name: str): + var_value = env.get(var_name) if var_value is None: - continue + return quoted_var_value = shlex.quote(var_value) f.write(f"{var_name}={quoted_var_value}\n") del env[var_name] + for var_name in unexported_env_vars: + unexport_var(var_name) + + # All variables named in USE_EXPAND and USE_EXPAND_UNPREFIXED + for use_expand in ("USE_EXPAND", "USE_EXPAND_UNPREFIXED"): + for v in mysettings.get(use_expand, "").split(): + unexport_var(v) + + # USE_EXPAND_VALUES_${v}, where ${v} is a value in USE_EXPAND_IMPLICIT + for v in mysettings.get("USE_EXPAND_IMPLICIT", "").split(): + unexport_var(f"USE_EXPAND_VALUES_{v}") + env["PORTAGE_EBUILD_EXTRA_SOURCE"] = str(ebuild_extra_source_path) else: # Pre EAPI 9 behavior, all PMS variables are simply exported into the ebuild's environment.
