From 80d0ee5b641ff9c387cd8f831ebdce239927f37f Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 21 Aug 2009 21:37:08 +0000 Subject: [PATCH] Add support for --selective=n, so it can be used to remove selective behavior that may have been implied by some other option like --update. svn path=/main/trunk/; revision=14120 --- man/emerge.1 | 5 ++++- pym/_emerge/create_depgraph_params.py | 15 ++++++++++++++- pym/_emerge/help.py | 7 +++++-- pym/_emerge/main.py | 13 ++++++++++++- 4 files changed, 35 insertions(+), 5 deletions(-) diff --git a/man/emerge.1 b/man/emerge.1 index 47d1efafd..178198810 100644 --- a/man/emerge.1 +++ b/man/emerge.1 @@ -446,9 +446,12 @@ be enabled under normal circumstances. For currently supported \fBDEPEND\fR variable. However, behavior may change for new \fBEAPI\fRs when related extensions are added in the future. .TP -.BR "\-\-selective" +.BR "\-\-selective"[=n] This is similar to the \fB\-\-noreplace\fR option, except that it does not take precedence over options such as \fB\-\-newuse\fR. +Some options, such as \fB\-\-update\fR, imply \fB\-\-selective\fR. +Use \fB\-\-selective=n\fR if you want to forcefully disable +\fB\-\-selective\fR, regardless of options like \fB\-\-update\fR. .TP .BR "\-\-skipfirst" This option is only valid when used with \fB\-\-resume\fR. It removes the diff --git a/pym/_emerge/create_depgraph_params.py b/pym/_emerge/create_depgraph_params.py index 9381fb955..188dc6f96 100644 --- a/pym/_emerge/create_depgraph_params.py +++ b/pym/_emerge/create_depgraph_params.py @@ -2,6 +2,9 @@ # Distributed under the terms of the GNU General Public License v2 # $Id$ +import logging +from portage.util import writemsg_level + def create_depgraph_params(myopts, myaction): #configure emerge engine parameters # @@ -23,7 +26,7 @@ def create_depgraph_params(myopts, myaction): "--newuse" in myopts or \ "--reinstall" in myopts or \ "--noreplace" in myopts or \ - "--selective" in myopts: + myopts.get("--selective", "n") != "n": myparams["selective"] = True if "--emptytree" in myopts: myparams["empty"] = True @@ -34,5 +37,15 @@ def create_depgraph_params(myopts, myaction): myparams["deep"] = myopts["--deep"] if "--complete-graph" in myopts: myparams["complete"] = True + if myopts.get("--selective") == "n": + # --selective=n can be used to remove selective + # behavior that may have been implied by some + # other option like --update. + myparams.pop("selective", None) + + if '--debug' in myopts: + writemsg_level('\n\nmyparams %s\n\n' % myparams, + noiselevel=-1, level=logging.DEBUG) + return myparams diff --git a/pym/_emerge/help.py b/pym/_emerge/help.py index 448ef1adf..cbd1fe491 100644 --- a/pym/_emerge/help.py +++ b/pym/_emerge/help.py @@ -467,9 +467,12 @@ def help(myopts, havecolor=1): for line in wrap(desc, desc_width): print desc_indent + line print - print " " + green("--selective") + print " " + green("--selective") + "[=%s]" % turquoise("n") desc = "This is similar to the --noreplace option, except that it " + \ - "does not take precedence over options such as --newuse." + "does not take precedence over options such as --newuse. " + \ + "Some options, such as --update, imply --selective. " + \ + "Use --selective=n if you want to forcefully disable " + \ + "--selective, regardless of options like --update." for line in wrap(desc, desc_width): print desc_indent + line print diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py index 8e9a8a22a..c5a16ff42 100644 --- a/pym/_emerge/main.py +++ b/pym/_emerge/main.py @@ -52,7 +52,7 @@ options=[ "--nospinner", "--oneshot", "--onlydeps", "--pretend", "--quiet", "--resume", -"--searchdesc", "--selective", +"--searchdesc", "--skipfirst", "--tree", "--update", @@ -377,6 +377,7 @@ def insert_optional_args(args): '--getbinpkgonly' : ('n',), '--jobs' : valid_integers, '--root-deps' : ('rdeps',), + '--selective' : ('n',), '--usepkg' : ('n',), '--usepkgonly' : ('n',), } @@ -584,6 +585,13 @@ def parse_opts(tmpcmdline, silent=False): "choices" :("True", "rdeps") }, + "--selective": { + "help" : "similar to the --noreplace but does not take " + \ + "precedence over options such as --newuse", + "type" : "choice", + "choices" : ("True", "n") + }, + "--usepkg": { "shortopt" : "-k", "help" : "use binary packages", @@ -656,6 +664,9 @@ def parse_opts(tmpcmdline, silent=False): if myoptions.root_deps == "True": myoptions.root_deps = True + if myoptions.selective == "True": + myoptions.selective = True + if myoptions.deep is not None: deep = None if myoptions.deep == "True": -- 2.26.2