From 43d1e4f072d7074b52ca93ac30bc336f0c5e6b1d Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 23 Oct 2007 22:55:04 +0000 Subject: Fix logic for the "selective" depgraph parameter so that it behaves correctly in cases where installed packages provide old-style virtuals but none of the available packages do. svn path=/main/trunk/; revision=8260 --- pym/_emerge/__init__.py | 39 ++++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) (limited to 'pym') diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index f337adfeb..e20447182 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -1966,6 +1966,18 @@ class depgraph(object): usepkgonly = "--usepkgonly" in self.myopts empty = "empty" in self.myparams selective = "selective" in self.myparams + # Behavior of the "selective" parameter depends on + # whether or not a package matches an argument atom. + # If an installed package provides an old-style + # virtual that is no longer provided by an available + # package, the installed package may match an argument + # atom even though none of the available packages do. + # Therefore, "selective" logic does not consider + # whether or not an installed package matches an + # argument atom. It only considers whether or not + # available packages match argument atoms, which is + # represented by the found_available_arg flag. + found_available_arg = False for find_existing_node in True, False: if existing_node: break @@ -2084,18 +2096,23 @@ class depgraph(object): myarg = self._set_atoms.findAtomForPackage( cpv, metadata) except portage.exception.InvalidDependString: - # If relevant this error will be shown - # in the masked package display. if not installed: - break - if not installed and not reinstall_for_flags and \ - ("selective" in self.myparams or \ - not myarg) and \ - not empty and \ - vardb.cpv_exists(cpv): - break - if installed and not (selective or not myarg): - break + # masked by corruption + continue + if not installed: + if myarg: + found_available_arg = True + must_reinstall = empty or \ + (myarg and not selective) + if not reinstall_for_flags and \ + not must_reinstall and \ + vardb.cpv_exists(cpv): + break + if installed: + must_reinstall = empty or \ + (found_available_arg and not selective) + if must_reinstall: + break # Metadata accessed above is cached internally by # each db in order to optimize visibility checks. # Now that all possible checks visibility checks -- cgit v1.2.3-1-g7c22