commit:     c471775e3d89c9d3c13e660222858ad3818db954
Author:     Raul E Rangel <rrangel <AT> chromium <DOT> org>
AuthorDate: Thu Mar 21 16:41:38 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Dec 16 03:21:43 2025 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=c471775e

save-build-env: Strip out MAKEOPTS and NINJAOPTS

MAKEOPTS and NINJAOPTS contains a host specific value. If the same
package is built on a host with different core counts, the binpkgs will
have different hashes. This change drops MAKEOPTS after src_install so
that it's not included in final environment.gz. This change also adds
them to the special_env_vars.py so that we always have the most up to
date version of these variables.

Bug: https://bugs.gentoo.org/914441
Bug: https://bugs.gentoo.org/736794
Signed-off-by: Raul E Rangel <rrangel <AT> chromium.org>
Part-of: https://github.com/gentoo/portage/pull/1311
Signed-off-by: Sam James <sam <AT> gentoo.org>

 bin/save-ebuild-env.sh                                 | 6 ++++++
 lib/portage/package/ebuild/_config/special_env_vars.py | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/bin/save-ebuild-env.sh b/bin/save-ebuild-env.sh
index ace7e41f9c..7e6bd6120e 100644
--- a/bin/save-ebuild-env.sh
+++ b/bin/save-ebuild-env.sh
@@ -41,6 +41,12 @@ __save_ebuild_env() (
                                MAPFILE+=( PYTHONPATH )
                        fi
                fi
+
+               # These variables contains build host specific configuration. We
+               # want binpkgs generated on different sized hosts to be
+               # identical, so strip them from the binpkg. It's also not needed
+               # for installing / removing a package.
+               unset MAKEOPTS NINJAOPTS
        fi
 
        MAPFILE+=(

diff --git a/lib/portage/package/ebuild/_config/special_env_vars.py 
b/lib/portage/package/ebuild/_config/special_env_vars.py
index e4cfc727fc..c952597d59 100644
--- a/lib/portage/package/ebuild/_config/special_env_vars.py
+++ b/lib/portage/package/ebuild/_config/special_env_vars.py
@@ -114,7 +114,9 @@ environ_whitelist = frozenset(
         "HOME",
         "LD_PRELOAD",
         "MAKEFLAGS",
+        "MAKEOPTS",
         "MERGE_TYPE",
+        "NINJAOPTS",
         "NOCOLOR",
         "NO_COLOR",
         "P",

Reply via email to