commit:     d0f8b93886d660b6c93aede3e81b3aa988802eb5
Author:     Florian Schmaus <flow <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 27 10:06:05 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Oct  1 21:29:07 2025 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=d0f8b938

Replace FEATURES=export-pms-vars with PORTAGE_DO_NOT_EXPORT_PMS_VARS

The toggle is primary targeted at ebuild authors, to test their
ebuilds under new EAPI rules. It is not something users should care
about, which is what having it in FEATURES suggests. Therefore
refactor it as a toggle of "Portage Development Features".

Bug: https://bugs.gentoo.org/953842
Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>
Part-of: https://github.com/gentoo/portage/pull/1478
Closes: https://github.com/gentoo/portage/pull/1478
Signed-off-by: Sam James <sam <AT> gentoo.org>

 NEWS                                   | 2 ++
 cnf/make.globals                       | 2 +-
 lib/portage/const.py                   | 1 -
 lib/portage/package/ebuild/doebuild.py | 8 +++++---
 man/emerge.1                           | 8 ++++++++
 5 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/NEWS b/NEWS
index 96f2c3f4e9..41161f9c22 100644
--- a/NEWS
+++ b/NEWS
@@ -22,6 +22,8 @@ Bug fixes:
 Cleanups:
 
 * Drop legacy USE=test hacks.
+* Replace FEATURES=export-pms-vars with Portage development feature
+  PORTAGE_DO_NOT_EXPORT_PMS_VARS (bug #953842)
 
 portage-3.0.69.1 (2025-09-15)
 --------------

diff --git a/cnf/make.globals b/cnf/make.globals
index dba24c73c7..94eac65684 100644
--- a/cnf/make.globals
+++ b/cnf/make.globals
@@ -81,7 +81,7 @@ FEATURES="assume-digests binpkg-docompress binpkg-dostrip 
binpkg-logs
           network-sandbox news parallel-fetch pkgdir-index-trusted pid-sandbox
           preserve-libs protect-owned qa-unresolved-soname-deps sandbox strict
           unknown-features-warn unmerge-logs unmerge-orphans userfetch
-          userpriv usersandbox usersync export-pms-vars"
+          userpriv usersandbox usersync"
 
 # Ignore file collisions in /lib/modules since files inside this directory
 # are never unmerged, and therefore collisions must be ignored in order for

diff --git a/lib/portage/const.py b/lib/portage/const.py
index 875b27f717..ecb897bb0a 100644
--- a/lib/portage/const.py
+++ b/lib/portage/const.py
@@ -183,7 +183,6 @@ SUPPORTED_FEATURES = frozenset(
         "distlocks",
         "downgrade-backup",
         "ebuild-locks",
-        "export-pms-vars",
         "fail-clean",
         "fakeroot",
         "fixlafiles",

diff --git a/lib/portage/package/ebuild/doebuild.py 
b/lib/portage/package/ebuild/doebuild.py
index e300736d22..09fab05154 100644
--- a/lib/portage/package/ebuild/doebuild.py
+++ b/lib/portage/package/ebuild/doebuild.py
@@ -2184,12 +2184,14 @@ def spawn(
     eapi = mysettings["EAPI"]
 
     unexported_env_vars = None
-    if "export-pms-vars" not in mysettings.features or not 
eapi_exports_pms_vars(eapi):
+    if not eapi_exports_pms_vars(eapi) or os.environ.get(
+        "PORTAGE_DO_NOT_EXPORT_PMS_VARS"
+    ):
         unexported_env_vars = _unexported_pms_vars
 
     if unexported_env_vars:
-        # Starting with EAPI 9 (or if FEATURES="-export-pms-vars"),
-        # PMS variables should not longer be exported.
+        # Starting with EAPI 9 (or if the PORTAGE_DO_NOT_EXPORT_PMS_VARS env
+        # variable is set) PMS variables should not longer be exported.
 
         phase = mysettings.get("EBUILD_PHASE")
         is_pms_ebuild_phase = phase in _phase_func_map.keys()

diff --git a/man/emerge.1 b/man/emerge.1
index 3231dd81d4..b9f4829939 100644
--- a/man/emerge.1
+++ b/man/emerge.1
@@ -1446,6 +1446,14 @@ statistics about its internal LRU caches.
 .BR PORTAGE_SHOW_HTTP_TRACE
 If this environment variable is set, then Portage will show
 a trace of all HTTP request.
+.TP
+.BR PORTAGE_DO_NOT_EXPORT_PMS_VARS
+If this environment variable is set, then Portage will not export PMS
+variables regardless of the EAPI.  The variables are still available
+to ebuilds; however, they are not exported and therefore not available
+to child processes of the ebuild.  Since EAPI 9, Portage will never
+export PMS variables.  This setting allows testing EAPI < 9 ebuilds
+with the new behavior.
 .SH "REPORTING BUGS"
 Please report any bugs you encounter through our website:
 .LP

Reply via email to