At some point we may want to stop exporting FEATURES to the ebuild
authorZac Medico <zmedico@gentoo.org>
Sat, 21 Aug 2010 00:31:08 +0000 (17:31 -0700)
committerZac Medico <zmedico@gentoo.org>
Sat, 21 Aug 2010 00:31:08 +0000 (17:31 -0700)
environment, in order to prevent ebuilds from abusing it. In
preparation for that, export it as PORTAGE_FEATURES so that bashrc
users will be able to migrate any FEATURES conditional code to
use this alternative variable.

bin/ebuild.sh
pym/portage/package/ebuild/config.py

index 432da64654edfe53f024f15717802a8a6271194b..de3c80bef30ac118c2e822147c7213a46880514f 100755 (executable)
@@ -1711,7 +1711,7 @@ filter_readonly_variables() {
                filtered_vars="${filtered_vars} ${filtered_sandbox_vars}"
        fi
        if hasq --filter-features $* ; then
-               filtered_vars="${filtered_vars} FEATURES"
+               filtered_vars="${filtered_vars} FEATURES PORTAGE_FEATURES"
        fi
        if hasq --filter-path $* ; then
                filtered_vars+=" PATH"
index 7d824c47f06840ea1126570b7535849f6eae152d..51fc0b157950644c2c1bad0d6fc1dc5c7ad9e1ed 100644 (file)
@@ -233,7 +233,8 @@ class config(object):
                "PORTAGE_BIN_PATH",
                "PORTAGE_BUILDDIR", "PORTAGE_COLORMAP",
                "PORTAGE_CONFIGROOT", "PORTAGE_DEBUG", "PORTAGE_DEPCACHEDIR",
-               "PORTAGE_EBUILD_EXIT_FILE", "PORTAGE_GID", "PORTAGE_GRPNAME",
+               "PORTAGE_EBUILD_EXIT_FILE", "PORTAGE_FEATURES",
+               "PORTAGE_GID", "PORTAGE_GRPNAME",
                "PORTAGE_INST_GID", "PORTAGE_INST_UID",
                "PORTAGE_IPC_DAEMON", "PORTAGE_IUSE",
                "PORTAGE_LOG_FILE", "PORTAGE_MASTER_PID",
@@ -2828,6 +2829,13 @@ class config(object):
                                        if v is not None:
                                                mydict[k] = v
 
+               # At some point we may want to stop exporting FEATURES to the ebuild
+               # environment, in order to prevent ebuilds from abusing it. In
+               # preparation for that, export it as PORTAGE_FEATURES so that bashrc
+               # users will be able to migrate any FEATURES conditional code to
+               # use this alternative variable.
+               mydict["PORTAGE_FEATURES"] = self["FEATURES"]
+
                # Filtered by IUSE and implicit IUSE.
                mydict["USE"] = self.get("PORTAGE_USE", "")