Make depgraph.select_dep() reject installed packages
authorZac Medico <zmedico@gentoo.org>
Thu, 11 Oct 2007 05:37:00 +0000 (05:37 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 11 Oct 2007 05:37:00 +0000 (05:37 -0000)
in the same cases that it used to so that a warning
message is properly generated in depgraph.xcreate()
when a package is unavailable but installed.

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

pym/emerge/__init__.py

index e681fd23116e452b40b8451fcccf24bb168f0008..63146e93a0120743d1b000a0843bc09cfe472745 100644 (file)
@@ -1936,13 +1936,15 @@ class depgraph(object):
                                existing_node = None
                                myeb = None
                                usepkgonly = "--usepkgonly" in self.myopts
+                               empty = "empty" in self.myparams
+                               selective = "selective" in self.myparams
                                for find_existing_node in True, False:
                                        if existing_node:
                                                break
                                        for db, pkg_type, built, installed, db_keys in dbs:
                                                if existing_node:
                                                        break
-                                               if installed and matched_packages:
+                                               if installed and (matched_packages or empty):
                                                        # We only need to select an installed package here
                                                        # if there is no other choice.
                                                        continue
@@ -2061,6 +2063,8 @@ class depgraph(object):
                                                                "empty" not in self.myparams and \
                                                                vardb.cpv_exists(cpv):
                                                                break
+                                                       if installed and not (selective or not myarg):
+                                                               break
                                                        # Metadata accessed above is cached internally by
                                                        # each db in order to optimize visibility checks.
                                                        # Now that all possible checks visibility checks