autounmask: Add --autounmask-unrestricted-atoms option
authorSebastian Luther <SebastianLuther@gmx.de>
Mon, 19 Sep 2011 11:45:35 +0000 (13:45 +0200)
committerZac Medico <zmedico@gentoo.org>
Mon, 19 Sep 2011 14:10:04 +0000 (07:10 -0700)
The default behavior of --autounmask is now changed back to
the original one, namely to use '=' operators. The
--autounmask-unrestricted-atoms option allows the use of '>='
operators whenever possible. This addresses the issues raised
in bugs 372405, 374331 and 379333.

man/emerge.1
pym/_emerge/depgraph.py
pym/_emerge/help.py
pym/_emerge/main.py

index aa85a7bf27068502b7d1f6f2b4a0e186501cd36e..d6d74e01d9d21a5b4e6b83d7b04da4d1fef79d2f 100644 (file)
@@ -304,6 +304,11 @@ the specified configuration file(s), or enable the
 \fBEMERGE_DEFAULT_OPTS\fR variable may be used to
 disable this option by default in \fBmake.conf\fR(5).
 .TP
+.BR "\-\-autounmask\-unrestricted\-atoms [ y | n ]"
+If \-\-autounmask is enabled, changes using the \'=\' operator
+will be written. With this option, \'>=\' operators will be used
+whenever possible.
+.TP
 .BR "\-\-autounmask\-write [ y | n ]"
 If \-\-autounmask is enabled, changes are written
 to config files, respecting \fBCONFIG_PROTECT\fR and \fB\-\-ask\fR.
index deda441571451793d56f6279d5d94306a53e807a..a5015b8e68620417805539d457f4432f736d00d3 100644 (file)
@@ -5728,6 +5728,8 @@ class depgraph(object):
                """
 
                autounmask_write = self._frozen_config.myopts.get("--autounmask-write", "n") == True
+               autounmask_unrestricted_atoms = \
+                       self._frozen_config.myopts.get("--autounmask-unrestricted-atoms", "n") == True
                quiet = "--quiet" in self._frozen_config.myopts
                pretend = "--pretend" in self._frozen_config.myopts
                ask = "--ask" in self._frozen_config.myopts
@@ -5780,10 +5782,13 @@ class depgraph(object):
                                                keyword = reason.unmask_hint.value
 
                                                unstable_keyword_msg[root].append(self._get_dep_chain_as_comment(pkg))
-                                               if is_latest:
-                                                       unstable_keyword_msg[root].append(">=%s %s\n" % (pkg.cpv, keyword))
-                                               elif is_latest_in_slot:
-                                                       unstable_keyword_msg[root].append(">=%s:%s %s\n" % (pkg.cpv, pkg.metadata["SLOT"], keyword))
+                                               if autounmask_unrestricted_atoms:
+                                                       if is_latest:
+                                                               unstable_keyword_msg[root].append(">=%s %s\n" % (pkg.cpv, keyword))
+                                                       elif is_latest_in_slot:
+                                                               unstable_keyword_msg[root].append(">=%s:%s %s\n" % (pkg.cpv, pkg.metadata["SLOT"], keyword))
+                                                       else:
+                                                               unstable_keyword_msg[root].append("=%s %s\n" % (pkg.cpv, keyword))
                                                else:
                                                        unstable_keyword_msg[root].append("=%s %s\n" % (pkg.cpv, keyword))
 
@@ -5817,10 +5822,13 @@ class depgraph(object):
                                                                comment.splitlines() if line]
                                                        for line in comment:
                                                                p_mask_change_msg[root].append("%s\n" % line)
-                                               if is_latest:
-                                                       p_mask_change_msg[root].append(">=%s\n" % pkg.cpv)
-                                               elif is_latest_in_slot:
-                                                       p_mask_change_msg[root].append(">=%s:%s\n" % (pkg.cpv, pkg.metadata["SLOT"]))
+                                               if autounmask_unrestricted_atoms:
+                                                       if is_latest:
+                                                               p_mask_change_msg[root].append(">=%s\n" % pkg.cpv)
+                                                       elif is_latest_in_slot:
+                                                               p_mask_change_msg[root].append(">=%s:%s\n" % (pkg.cpv, pkg.metadata["SLOT"]))
+                                                       else:
+                                                               p_mask_change_msg[root].append("=%s\n" % pkg.cpv)
                                                else:
                                                        p_mask_change_msg[root].append("=%s\n" % pkg.cpv)
 
@@ -5840,10 +5848,13 @@ class depgraph(object):
                                        else:
                                                adjustments.append("-" + flag)
                                use_changes_msg[root].append(self._get_dep_chain_as_comment(pkg, unsatisfied_dependency=True))
-                               if is_latest:
-                                       use_changes_msg[root].append(">=%s %s\n" % (pkg.cpv, " ".join(adjustments)))
-                               elif is_latest_in_slot:
-                                       use_changes_msg[root].append(">=%s:%s %s\n" % (pkg.cpv, pkg.metadata["SLOT"], " ".join(adjustments)))
+                               if autounmask_unrestricted_atoms:
+                                       if is_latest:
+                                               use_changes_msg[root].append(">=%s %s\n" % (pkg.cpv, " ".join(adjustments)))
+                                       elif is_latest_in_slot:
+                                               use_changes_msg[root].append(">=%s:%s %s\n" % (pkg.cpv, pkg.metadata["SLOT"], " ".join(adjustments)))
+                                       else:
+                                               use_changes_msg[root].append("=%s %s\n" % (pkg.cpv, " ".join(adjustments)))
                                else:
                                        use_changes_msg[root].append("=%s %s\n" % (pkg.cpv, " ".join(adjustments)))
 
@@ -5857,10 +5868,13 @@ class depgraph(object):
                                is_latest, is_latest_in_slot = check_if_latest(pkg)
 
                                license_msg[root].append(self._get_dep_chain_as_comment(pkg))
-                               if is_latest:
-                                       license_msg[root].append(">=%s %s\n" % (pkg.cpv, " ".join(sorted(missing_licenses))))
-                               elif is_latest_in_slot:
-                                       license_msg[root].append(">=%s:%s %s\n" % (pkg.cpv, pkg.metadata["SLOT"], " ".join(sorted(missing_licenses))))
+                               if autounmask_unrestricted_atoms:
+                                       if is_latest:
+                                               license_msg[root].append(">=%s %s\n" % (pkg.cpv, " ".join(sorted(missing_licenses))))
+                                       elif is_latest_in_slot:
+                                               license_msg[root].append(">=%s:%s %s\n" % (pkg.cpv, pkg.metadata["SLOT"], " ".join(sorted(missing_licenses))))
+                                       else:
+                                               license_msg[root].append("=%s %s\n" % (pkg.cpv, " ".join(sorted(missing_licenses))))
                                else:
                                        license_msg[root].append("=%s %s\n" % (pkg.cpv, " ".join(sorted(missing_licenses))))
 
index 1e62ccf1dc7c5ef76575c289ad7a88e3493f1533..f5ff7a367e34140881e6f229c9baf55a26765c03 100644 (file)
@@ -323,6 +323,14 @@ def help(myopts, havecolor=1):
                for line in wrap(desc, desc_width):
                        print(desc_indent + line)
                print()
+               print("       " + green("--autounmask-unrestricted-atoms") + " [ %s | %s ]" % \
+                       (turquoise("y"), turquoise("n")))
+               desc = "If --autounmask is enabled, changes using the '=' operator " + \
+                       "will be written. With this option, '>=' operators will be used " + \
+                       "whenever possible."
+               for line in wrap(desc, desc_width):
+                       print(desc_indent + line)
+               print()
                print("       " + green("--autounmask-write") + " [ %s | %s ]" % \
                        (turquoise("y"), turquoise("n")))
                desc = "If --autounmask is enabled, changes are written " + \
index b6b63e2fd1c86fc1e68bab4e1575105e8e98addf..73d07953e00bb44a312f47d22ede6b6dec83e5ea 100644 (file)
@@ -431,6 +431,7 @@ def insert_optional_args(args):
        default_arg_opts = {
                '--ask'                  : y_or_n,
                '--autounmask'           : y_or_n,
+               '--autounmask-unrestricted-atoms' : y_or_n,
                '--autounmask-write'     : y_or_n,
                '--buildpkg'             : y_or_n,
                '--complete-graph'       : y_or_n,
@@ -603,6 +604,12 @@ def parse_opts(tmpcmdline, silent=False):
                        "choices" : true_y_or_n
                },
 
+               "--autounmask-unrestricted-atoms": {
+                       "help"    : "write autounmask changes with >= atoms if possible",
+                       "type"    : "choice",
+                       "choices" : true_y_or_n
+               },
+
                "--autounmask-write": {
                        "help"    : "write changes made by --autounmask to disk",
                        "type"    : "choice",
@@ -926,6 +933,9 @@ def parse_opts(tmpcmdline, silent=False):
        if myoptions.autounmask in true_y:
                myoptions.autounmask = True
 
+       if myoptions.autounmask_unrestricted_atoms in true_y:
+               myoptions.autounmask_unrestricted_atoms = True
+
        if myoptions.autounmask_write in true_y:
                myoptions.autounmask_write = True