--autounmask: show note suggesting how to disable
authorZac Medico <zmedico@gentoo.org>
Fri, 3 Jun 2011 22:27:24 +0000 (15:27 -0700)
committerZac Medico <zmedico@gentoo.org>
Fri, 3 Jun 2011 22:27:24 +0000 (15:27 -0700)
Now that --autounmask is enabled by default, people are dealing with
local masks that trigger unsatisfied dependencies often complain about
--autounmask behavior being inappropriate for their situation.
Therefore, show a helpful note when the autounmask code is triggered
and --quiet is not enabled:

  NOTE: This --autounmask behavior can be disabled by setting
        EMERGE_DEFAULT_OPTS="--autounmask=n" in make.conf.

pym/_emerge/depgraph.py

index b60fd19fb7f120eee2174902cb2fbf6c9814f00a..0b4be4f7faaadee8b196b188bca99d4e00493a60 100644 (file)
@@ -5587,6 +5587,7 @@ class depgraph(object):
                """
 
                autounmask_write = self._frozen_config.myopts.get("--autounmask-write", "n") == True
+               quiet = "--quiet" in self._frozen_config.myopts
                pretend = "--pretend" in self._frozen_config.myopts
                ask = "--ask" in self._frozen_config.myopts
                enter_invalid = '--ask-enter-invalid' in self._frozen_config.myopts
@@ -5857,6 +5858,21 @@ class depgraph(object):
                                except PortageException:
                                        problems.append("!!! Failed to write '%s'\n" % file_to_write_to)
 
+               if not quiet and \
+                       (unstable_keyword_msg or \
+                       p_mask_change_msg or \
+                       use_changes_msg or \
+                       license_msg):
+                       msg = [
+                               "",
+                               "NOTE: This --autounmask behavior can be disabled by setting",
+                               "      EMERGE_DEFAULT_OPTS=\"--autounmask=n\" in make.conf."
+                       ]
+                       for line in msg:
+                               if line:
+                                       line = colorize("INFORM", line)
+                               writemsg_stdout(line + "\n", noiselevel=-1)
+
                if ask and write_to_file and file_to_write_to:
                        prompt = "\nWould you like to add these " + \
                                "changes to your config files?"