Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not export PMS variables in EAPI 9 #1407

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Flowdalic
Copy link
Member

Instead of passing PMS variables as part of the process environment, we pass them via a file that is later sourced by the ebuild's bash.

Since, for example, A is usually the greatest contributor to the process environment, removing it from the process environment significantly avoids running into MAX_ARG_STRLEN when spawning a new child process.

This means that A and other PMS variables are no longer exported in the ebuild and hence unavaiable to child processes. However, A is mostly used as part of the default_src_unpack function and there A does not need to be exported.

This started as a change that only unexported A, but was later extended to most PMS variables as suggested by ulm in https://bugs.gentoo.org/721088#c23.

Thanks to Zac Medico for helpful input on this change.

Closes: https://bugs.gentoo.org/721088

@Flowdalic Flowdalic force-pushed the pass-env-via-file-dont-export-pms-vars branch from 13610de to 6753aea Compare December 30, 2024 15:44
@Flowdalic Flowdalic changed the title WIP: Do not export PMS variables in EAPI 9 Do not export PMS variables in EAPI 9 Dec 30, 2024
@Flowdalic Flowdalic force-pushed the pass-env-via-file-dont-export-pms-vars branch 5 times, most recently from 879a6fb to 67106ed Compare December 30, 2024 18:40
lib/portage/const.py Outdated Show resolved Hide resolved
@Flowdalic Flowdalic force-pushed the pass-env-via-file-dont-export-pms-vars branch 2 times, most recently from 4ba182a to a8e44e3 Compare December 31, 2024 09:20
@Flowdalic Flowdalic force-pushed the pass-env-via-file-dont-export-pms-vars branch from a8e44e3 to 834f78c Compare January 1, 2025 14:24
Flowdalic added a commit to Flowdalic/gentoo that referenced this pull request Jan 1, 2025
Once a future EAPI does no longer export PMS variables (bug #721088 and
[1]), we need to explicitly ensure that those are exported to helper
commands which expect certain PMS variables in their process
environment.

While the portage ebuild is usually deliberately not using the latest
EAPI, it may be a good idea to make it explicit that the _compat_upgrade
helpers expect ED in their process environment.

1: gentoo/portage#1407

Signed-off-by: Florian Schmaus <[email protected]>
gentoo-bot pushed a commit to gentoo/gentoo that referenced this pull request Jan 1, 2025
Once a future EAPI does no longer export PMS variables (bug #721088 and
[1]), we need to explicitly ensure that those are exported to helper
commands which expect certain PMS variables in their process
environment.

While the portage ebuild is usually deliberately not using the latest
EAPI, it may be a good idea to make it explicit that the _compat_upgrade
helpers expect ED in their process environment.

1: gentoo/portage#1407

Signed-off-by: Florian Schmaus <[email protected]>
Closes: #39934
Signed-off-by: Sam James <[email protected]>
@Flowdalic Flowdalic force-pushed the pass-env-via-file-dont-export-pms-vars branch 2 times, most recently from bed117b to 7ef309a Compare January 7, 2025 13:19
@Flowdalic Flowdalic force-pushed the pass-env-via-file-dont-export-pms-vars branch 5 times, most recently from 5562b8e to ba9955e Compare January 8, 2025 18:37
@Flowdalic Flowdalic force-pushed the pass-env-via-file-dont-export-pms-vars branch 4 times, most recently from c3264d6 to b4201dd Compare January 9, 2025 10:18
@Flowdalic Flowdalic force-pushed the pass-env-via-file-dont-export-pms-vars branch 2 times, most recently from 7e3bcb2 to 6e5e977 Compare January 9, 2025 12:32
Instead of passing PMS variables as part of the process environment,
we pass them via a file that is later sourced by the ebuild's
bash.

Since, for example, A is usually the greatest contributor to the
process environment, removing it from the process environment
significantly avoids running into MAX_ARG_STRLEN when spawning a new
child process.

This means that A and other PMS variables are no longer exported in
the ebuild and hence unavaiable to child processes. However, A is
mostly used as part of the default_src_unpack function and there A
does not need to be exported.

This started as a change that only unexported A, but was later
extended to most PMS variables as suggested by ulm in
https://bugs.gentoo.org/721088#c23.

Thanks to Zac Medico for helpful input on this change, and to Eli
Schwartz for suggesting that (bash) helpers should simply source the
environment file introduced by this change.

Closes: https://bugs.gentoo.org/721088
Signed-off-by: Florian Schmaus <[email protected]>
@Flowdalic Flowdalic force-pushed the pass-env-via-file-dont-export-pms-vars branch from 6e5e977 to 4f097cd Compare January 9, 2025 12:35
# exists if we are processing a phase that is in
# _phase_func_map. But better safe than sorry.
if mysettings.get("EBUILD_PHASE") in _phase_func_map.keys() and os.path.isdir(
t
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could probably make this just mysettings.get("EBUILD_PHASE") != "depend".

@@ -8,6 +8,15 @@ if ___eapi_has_version_functions; then
source "${PORTAGE_BIN_PATH}/eapi7-ver-funcs.sh" || exit 1
fi

if [[ -v PORTAGE_EBUILD_EXTRA_SOURCE ]]; then
source "${PORTAGE_EBUILD_EXTRA_SOURCE}" || exit 1
# We delierbately do not unset PORTABE_EBUILD_EXTRA_SOURCE, so
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/delierbately/deliberately/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants