Warn if FEATURES contains unknown values and don't keep them (bug #326561)
authorSebastian Luther <SebastianLuther@gmx.de>
Sat, 3 Jul 2010 10:58:21 +0000 (12:58 +0200)
committerZac Medico <zmedico@gentoo.org>
Thu, 8 Jul 2010 07:36:55 +0000 (00:36 -0700)
pym/portage/const.py
pym/portage/package/ebuild/config.py

index 445677bd9b3fae9163e549fa919e6901cafd39cb..0865c02f72e068e47685a3f40a5d0c0b95615667 100644 (file)
@@ -82,6 +82,20 @@ EBUILD_PHASES            = ("pretend", "setup", "unpack", "prepare", "configure"
                            "compile", "test", "install",
                            "package", "preinst", "postinst","prerm", "postrm",
                            "nofetch", "config", "info", "other")
+SUPPORTED_FEATURES       = frozenset([
+                           "assume-digests", "buildpkg", "buildsyspkg", "ccache",
+                           "collision-protect", "digest", "distcc", "distlocks",
+                           "fakeroot", "fail-clean", "fixpackages", "getbinpkg",
+                           "installsources", "keeptemp", "keepwork", "lmirror",
+                           "metadata-transfer", "mirror", "multilib-strict", "news",
+                           "noauto", "noclean", "nodoc", "noinfo", "noman", "nostrip"
+                           "notitles", "parallel-fetch", "parse-eapi-ebuild-head",
+                           "parse-eapi-glep-55", "preserve-libs", "protect-owned",
+                           "python-trace", "sandbox", "sesandbox", "severe", "sfperms",
+                           "sign", "skiprocheck", "split-elog", "split-log", "splitdebug",
+                           "strict", "stricter", "suidctl", "test", "test-fail-continue",
+                           "unmerge-logs", "unmerge-orphans", "userfetch", "userpriv",
+                           "usersandbox", "usersync", "webrsync-gpg"])
 
 EAPI                     = 3
 
index 4cded99c94c7cef4e3439289e0f9ba98809688c4..a3a372e71a84d7fd045a661980fe50eb9a093824 100644 (file)
@@ -24,7 +24,8 @@ from portage import bsd_chflags, eapi_is_supported, \
 from portage.const import CACHE_PATH, CUSTOM_PROFILE_PATH, \
        DEPCACHE_PATH, GLOBAL_CONFIG_PATH, INCREMENTALS, MAKE_CONF_FILE, \
        MODULES_FILE_PATH, PORTAGE_BIN_PATH, PORTAGE_PYM_PATH, \
-       PRIVATE_PATH, PROFILE_PATH, USER_CONFIG_PATH, USER_VIRTUALS_FILE
+       PRIVATE_PATH, PROFILE_PATH, SUPPORTED_FEATURES, USER_CONFIG_PATH, \
+       USER_VIRTUALS_FILE
 from portage.data import portage_gid
 from portage.dbapi import dbapi
 from portage.dbapi.porttree import portdbapi
@@ -2182,10 +2183,22 @@ class config(object):
                                                myflags = []
                                                continue
 
+                                       if mykey == "FEATURES":
+                                               if x[:1] in ("+", "-"):
+                                                       val = x[1:]
+                                               else:
+                                                       val = x
+
+                                               if val not in SUPPORTED_FEATURES:
+                                                       writemsg(colorize("BAD",
+                                                               _("FEATURES variable contains an unknown value: %s") % x) \
+                                                               + "\n", noiselevel=-1)
+                                                       continue
+
                                        if x[0]=="+":
                                                # Not legal. People assume too much. Complain.
                                                writemsg(colorize("BAD",
-                                                       _("USE flags should not start with a '+': %s") % x) \
+                                                       _("%s values should not start with a '+': %s") % (mykey,x)) \
                                                        + "\n", noiselevel=-1)
                                                x=x[1:]
                                                if not x: