Make emerge --noreplace identical to --selective.
authorZac Medico <zmedico@gentoo.org>
Tue, 19 Jul 2011 08:36:58 +0000 (01:36 -0700)
committerZac Medico <zmedico@gentoo.org>
Tue, 19 Jul 2011 08:36:58 +0000 (01:36 -0700)
This removes a very subtle difference in --noreplace package selection
logic which is not very useful and triggers strange package selection
choices in some cases, as reported in bug #375571.

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

index df576ee10b16c10f37b1cd1cfd3cf14927227d73..4a19bdb269c45588f59e9c3074f6da097d375273 100644 (file)
@@ -488,10 +488,7 @@ Skips the packages specified on the command\-line that have already
 been installed.  Without this option, any packages, ebuilds, or deps
 you specify on the command\-line \fBwill\fR cause Portage to remerge
 the package, even if it is already installed.  Note that Portage will
-not remerge dependencies by default. Also note that this option takes
-precedence over options such as \fB\-\-newuse\fR, preventing a package
-from being reinstalled even though the corresponding USE flag settings
-may have changed.
+not remerge dependencies by default.
 .TP
 .BR "\-\-nospinner"
 Disables the spinner for the session.  The spinner is active when the
@@ -619,8 +616,7 @@ use \fBEMERGE_DEFAULT_OPTS\fR to make
 \fB\-\-oneshot\fR behavior default.
 .TP
 .BR "\-\-selective [ y | n ]"
-This is similar to the \fB\-\-noreplace\fR option, except that it
-does not take precedence over options such as \fB\-\-newuse\fR.
+This is identical to the \fB\-\-noreplace\fR option.
 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.
index f6c2721fa392ed4f9fd5d5d1a97ea1509a98c4d8..219ed7101a2f638e76312b0d7f6b9ffeebc02cff 100644 (file)
@@ -163,6 +163,8 @@ def action_build(settings, trees, mtimedb,
        debug = "--debug" in myopts
        verbose = "--verbose" in myopts
        quiet = "--quiet" in myopts
+       myparams = create_depgraph_params(myopts, myaction)
+
        if pretend or fetchonly:
                # make the mtimedb readonly
                mtimedb.filename = None
@@ -187,7 +189,6 @@ def action_build(settings, trees, mtimedb,
                favorites = mtimedb["resume"].get("favorites")
                if not isinstance(favorites, list):
                        favorites = []
-               myparams = create_depgraph_params(myopts, myaction)
 
                resume_data = mtimedb["resume"]
                mergelist = resume_data["mergelist"]
@@ -286,7 +287,6 @@ def action_build(settings, trees, mtimedb,
                        print(darkgreen("emerge: It seems we have nothing to resume..."))
                        return os.EX_OK
 
-               myparams = create_depgraph_params(myopts, myaction)
                try:
                        success, mydepgraph, favorites = backtrack_depgraph(
                                settings, trees, myopts, myparams, myaction, myfiles, spinner)
@@ -331,7 +331,7 @@ def action_build(settings, trees, mtimedb,
                        if mergecount==0:
                                sets = trees[settings["ROOT"]]["root_config"].sets
                                world_candidates = None
-                               if "--noreplace" in myopts and \
+                               if "selective" in myparams and \
                                        not oneshot and favorites:
                                        # Sets that are not world candidates are filtered
                                        # out here since the favorites list needs to be
@@ -340,7 +340,7 @@ def action_build(settings, trees, mtimedb,
                                        world_candidates = [x for x in favorites \
                                                if not (x.startswith(SETPREFIX) and \
                                                not sets[x[1:]].world_candidate)]
-                               if "--noreplace" in myopts and \
+                               if "selective" in myparams and \
                                        not oneshot and world_candidates:
                                        print()
                                        for x in world_candidates:
index a5923ddf6481f0084b5bcc48aace83e9401cb1da..9e3064d25dea230cb3112c080f0350dae3ec3350 100644 (file)
@@ -3591,7 +3591,6 @@ class depgraph(object):
                empty = "empty" in self._dynamic_config.myparams
                selective = "selective" in self._dynamic_config.myparams
                reinstall = False
-               noreplace = "--noreplace" in self._frozen_config.myopts
                avoid_update = "--update" not in self._frozen_config.myopts
                dont_miss_updates = "--update" in self._frozen_config.myopts
                use_ebuild_visibility = self._frozen_config.myopts.get(
@@ -3679,16 +3678,6 @@ class depgraph(object):
                                                        continue
 
                                        cpv = pkg.cpv
-                                       # Make --noreplace take precedence over --newuse.
-                                       if not pkg.installed and noreplace and \
-                                               cpv in vardb.match(atom):
-                                               inst_pkg = self._pkg(pkg.cpv, "installed",
-                                                       root_config, installed=True)
-                                               if inst_pkg.visible:
-                                                       # If the installed version is masked, it may
-                                                       # be necessary to look at lower versions,
-                                                       # in case there is a visible downgrade.
-                                                       continue
                                        reinstall_for_flags = None
 
                                        if not pkg.installed or \
index 5b5658d9fe0120ab11fbb17417c879d2dd918a8a..c978ce255e7ce082cb49c4dd9969c36af7415b89 100644 (file)
@@ -565,12 +565,6 @@ def help(myopts, havecolor=1):
                print("              ebuilds, or deps you specify on the command-line *will* cause")
                print("              Portage to remerge the package, even if it is already installed.")
                print("              Note that Portage won't remerge dependencies by default.")
-               desc = "Also note that this option takes " + \
-                       "precedence over options such as --newuse, preventing a package " + \
-                       "from being reinstalled even though the corresponding USE flag settings " + \
-                       "may have changed."
-               for line in wrap(desc, desc_width):
-                       print(desc_indent + line)
                print() 
                print("       "+green("--nospinner"))
                print("              Disables the spinner regardless of terminal type.")
@@ -733,8 +727,7 @@ def help(myopts, havecolor=1):
                print()
                print("       " + green("--selective") + " [ %s | %s ]" % \
                        (turquoise("y"), turquoise("n")))
-               desc = "This is similar to the --noreplace option, except that it " + \
-                       "does not take precedence over options such as --newuse. " + \
+               desc = "This identical to the --noreplace option. " + \
                        "Some options, such as --update, imply --selective. " + \
                        "Use --selective=n if you want to forcefully disable " + \
                        "--selective, regardless of options like --update."
index 42ce81069b7c832160f04d4ee9d8de891b629891..11a33149d87580001d592c3ca960656173f6d015 100644 (file)
@@ -842,8 +842,7 @@ def parse_opts(tmpcmdline, silent=False):
                },
 
                "--selective": {
-                       "help"    : "similar to the --noreplace but does not take " + \
-                                   "precedence over options such as --newuse",
+                       "help"    : "identical to --noreplace",
                        "type"    : "choice",
                        "choices" : true_y_or_n
                },