diff options
-rw-r--r-- | man/emerge.1 | 5 | ||||
-rw-r--r-- | pym/_emerge/depgraph.py | 46 | ||||
-rw-r--r-- | pym/_emerge/help.py | 8 | ||||
-rw-r--r-- | pym/_emerge/main.py | 10 |
4 files changed, 53 insertions, 16 deletions
diff --git a/man/emerge.1 b/man/emerge.1 index aa85a7bf2..d6d74e01d 100644 --- a/man/emerge.1 +++ b/man/emerge.1 @@ -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. diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index deda44157..a5015b8e6 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -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)))) diff --git a/pym/_emerge/help.py b/pym/_emerge/help.py index 1e62ccf1d..f5ff7a367 100644 --- a/pym/_emerge/help.py +++ b/pym/_emerge/help.py @@ -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 " + \ diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py index b6b63e2fd..73d07953e 100644 --- a/pym/_emerge/main.py +++ b/pym/_emerge/main.py @@ -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 |