Bug #225767 - Suppress warnings for installed packages masked by keywords
authorZac Medico <zmedico@gentoo.org>
Wed, 11 Jun 2008 09:06:54 +0000 (09:06 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 11 Jun 2008 09:06:54 +0000 (09:06 -0000)
if there is an equivalent ebuild in the portage tree (same cpv) with
visible keywords.

svn path=/main/trunk/; revision=10644

pym/_emerge/__init__.py

index 539a9235a4349fbae178654d51357fc28bb0eddc..63a0f34d1d9b3229c98c4b36e6f922ea910b2a24 100644 (file)
@@ -3440,6 +3440,32 @@ class depgraph(object):
                                        return 0
                return 1
 
+       def _pkg(self, cpv, type_name, root_config, installed=False):
+               """
+               Get a package instance from the cache, or create a new
+               one if necessary. Raises KeyError from aux_get if it
+               failures for some reason (package does not exist or is
+               corrupt).
+               """
+               operation = "merge"
+               if installed:
+                       operation = "nomerge"
+               pkg = self._pkg_cache.get(
+                       (type_name, root_config.root, cpv, operation))
+               if pkg is None:
+                       db = root_config.trees[
+                               self.pkg_tree_map[type_name]].dbapi
+                       metadata = izip(Package.metadata_keys,
+                               db.aux_get(cpv, Package.metadata_keys))
+                       pkg = Package(cpv=cpv, metadata=metadata,
+                               root_config=root_config)
+                       if type_name == "ebuild":
+                               settings = self.pkgsettings[root_config.root]
+                               settings.setcpv(pkg)
+                               pkg.metadata["USE"] = settings["PORTAGE_USE"]
+                       self._pkg_cache[pkg] = pkg
+               return pkg
+
        def validate_blockers(self):
                """Remove any blockers from the digraph that do not match any of the
                packages within the graph.  If necessary, create hard deps to ensure
@@ -3507,7 +3533,14 @@ class depgraph(object):
                                                        pkg.cpv, pkg.metadata) and \
                                                        pkg.metadata["KEYWORDS"].split() and \
                                                        not pkg_in_graph:
-                                                       self._masked_installed.add(pkg)
+                                                       try:
+                                                               ebuild = self._pkg(pkg.cpv,
+                                                                       "ebuild", pkg.root_config)
+                                                       except KeyError:
+                                                               ebuild = None
+                                                       if ebuild is None or \
+                                                               not visible(pkgsettings, ebuild):
+                                                               self._masked_installed.add(pkg)
 
                                        blocker_atoms = None
                                        blockers = None