From: Zac Medico Date: Wed, 28 May 2008 08:52:07 +0000 (-0000) Subject: Bug #223447 - Adjust the "installed packages are masked" display to recognize X-Git-Tag: v2.1.5.3~33 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=fc4967f92ddfea639d1a09c28a61508267ee271c;p=portage.git Bug #223447 - Adjust the "installed packages are masked" display to recognize packages that are masked by keywords and are eligible for uninstallation by depclean. This is a workaround for the fact that depclean may fail to recognize that the package is eligible for uninstall due to differences in visibility filtering which can lead to differences in || dep evaluation. TODO: Share visibility code to fix this inconsistency. (trunk r10465) svn path=/main/branches/2.1.2/; revision=10466 --- diff --git a/bin/emerge b/bin/emerge index 2b423a899..c43a9f0e6 100755 --- a/bin/emerge +++ b/bin/emerge @@ -2110,7 +2110,7 @@ class depgraph(object): self._displayed_list = None self._pprovided_args = [] self._missing_args = [] - self._masked_installed = [] + self._masked_installed = set() self._unsatisfied_deps_for_display = [] self._unsatisfied_blockers_for_display = None self._circular_deps_for_display = None @@ -2419,12 +2419,6 @@ class depgraph(object): del e return 0 - if pkg.installed: - # Warn if an installed package is masked and it - # is pulled into the graph. - if not visible(pkgsettings, pkg): - self._masked_installed.append((pkg, pkgsettings)) - if args: self._set_nodes.add(pkg) @@ -3496,11 +3490,51 @@ class depgraph(object): portdb = self.trees[myroot]["porttree"].dbapi pkgsettings = self.pkgsettings[myroot] final_db = self.mydbapi[myroot] + + graph_complete_for_root = "complete" in self.myparams or \ + (myroot == self.target_root and \ + ("deep" in self.myparams or "empty" in self.myparams) and \ + not self._required_set_names.difference(self._sets)) + blocker_cache = BlockerCache(myroot, vardb) stale_cache = set(blocker_cache) for pkg in vardb: cpv = pkg.cpv stale_cache.discard(cpv) + + # Check for masked installed packages. For keyword + # mask there are a couple of common cases that are + # likely to generate unwanted noise: + # + # * Packages missing /var/db/pkg/*/*/KEYWORDS entries + # due to having been installed by an old version of + # portage. + # + # * Packages installed by overriding ACCEPT_KEYWORDS + # via the environment. + # + # To avoid unwanted noise, only warn about keyword + # masks if all of the following are true: + # + # * KEYWORDS is not empty (not installed by old portage). + # + # * The graph is complete and the package has not been + # pulled into the dependency graph. It's eligible for + # depclean, but depclean may fail to recognize it as + # such due to differences in visibility filtering which + # can lead to differences in || dep evaluation. + # TODO: Share visibility code to fix this inconsistency. + + if pkg in final_db: + if not visible(pkgsettings, pkg): + self._masked_installed.add(pkg) + elif graph_complete_for_root and \ + pkgsettings._getMissingKeywords( + pkg.cpv, pkg.metadata) and \ + pkg.metadata["KEYWORDS"].split() and \ + not self.digraph.contains(pkg): + self._masked_installed.add(pkg) + blocker_atoms = None blockers = None if self.digraph.contains(pkg): @@ -5166,8 +5200,9 @@ class depgraph(object): sys.stderr.write("".join(msg)) masked_packages = [] - for pkg, pkgsettings in self._masked_installed: - root_config = self.roots[pkg.root] + for pkg in self._masked_installed: + root_config = pkg.root_config + pkgsettings = root_config.settings mreasons = get_masking_status(pkg, pkgsettings, root_config) masked_packages.append((root_config, pkgsettings, pkg.cpv, pkg.metadata, mreasons)) diff --git a/pym/portage.py b/pym/portage.py index 1bbd32353..1995c4945 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -6163,9 +6163,9 @@ def getmaskingstatus(mycpv, settings=None, portdb=None): kmask="~"+myarch break - # Assume that the user doesn't want to be bothered about - # KEYWORDS of packages that are already installed. - if kmask and not installed: + # Only show KEYWORDS masks for installed packages + # if they're not masked for any other reason. + if kmask and (not installed or not rValue): rValue.append(kmask+" keyword") return rValue