Make emerge display a warning message if FEATURES contains keepwork
authorZac Medico <zmedico@gentoo.org>
Fri, 3 Sep 2010 11:05:54 +0000 (04:05 -0700)
committerZac Medico <zmedico@gentoo.org>
Fri, 3 Sep 2010 11:05:54 +0000 (04:05 -0700)
or keeptemp since these features may confuse users and lead them
to report invalid bugs.

pym/_emerge/main.py

index 4c8a547b5cf683c6302a102133649f33998e15bb..4550726546e662c790f29d7e1bf64e400d9a9fca 100644 (file)
@@ -958,10 +958,25 @@ def parse_opts(tmpcmdline, silent=False):
 
        return myaction, myopts, myfiles
 
+# Warn about features that may confuse users and
+# lead them to report invalid bugs.
+_emerge_features_warn = frozenset(['keeptemp', 'keepwork'])
+
 def validate_ebuild_environment(trees):
+       features_warn = set()
        for myroot in trees:
                settings = trees[myroot]["vartree"].settings
                settings.validate()
+               features_warn.update(
+                       _emerge_features_warn.intersection(settings.features))
+
+       if features_warn:
+               msg = "WARNING: The FEATURES variable contains one " + \
+                       "or more values that should be disabled under " + \
+                       "normal circumstances: %s" % " ".join(features_warn)
+               out = portage.output.EOutput()
+               for line in textwrap.wrap(msg, 65):
+                       out.ewarn(line)
 
 def apply_priorities(settings):
        ionice(settings)