dep_check: avoid old-style virtuals code
authorZac Medico <zmedico@gentoo.org>
Mon, 9 May 2011 20:30:04 +0000 (13:30 -0700)
committerZac Medico <zmedico@gentoo.org>
Thu, 12 May 2011 05:09:36 +0000 (22:09 -0700)
pym/portage/dep/dep_check.py
pym/portage/package/ebuild/config.py

index 7ec01fa526966172a847d82a57ad166e25e102c7..53fce128ebd791d95a001f84fc6e0354f1d8c5a8 100644 (file)
@@ -50,7 +50,6 @@ def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/",
        repoman = not mysettings.local_config
        if kwargs["use_binaries"]:
                portdb = trees[myroot]["bintree"].dbapi
-       myvirtuals = mysettings.getvirtuals()
        pprovideddict = mysettings.pprovideddict
        myuse = kwargs["myuse"]
        for x in mysplit:
@@ -76,7 +75,7 @@ def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/",
                        if atom_graph is not None:
                                atom_graph.add((x, id(x)), graph_parent)
                        continue
-               mychoices = myvirtuals.get(mykey, [])
+
                if x.blocker:
                        # Virtual blockers are no longer expanded here since
                        # the un-expanded virtual atom is more useful for
@@ -93,6 +92,10 @@ def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/",
                        else:
                                # TODO: Add PROVIDE check for repoman.
                                a = []
+                               myvartree = mytrees.get("vartree")
+                               if myvartree is not None:
+                                       mysettings._populate_treeVirtuals_if_needed(myvartree)
+                               mychoices = mysettings.getvirtuals().get(mykey, [])
                                for y in mychoices:
                                        a.append(Atom(x.replace(x.cp, y.cp, 1)))
                                if not a:
@@ -114,6 +117,14 @@ def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/",
                        # only use new-style matches
                        if pkg.cp.startswith("virtual/"):
                                pkgs.append(pkg)
+
+               mychoices = []
+               if not pkgs and not portdb.cp_list(x.cp):
+                       myvartree = mytrees.get("vartree")
+                       if myvartree is not None:
+                               mysettings._populate_treeVirtuals_if_needed(myvartree)
+                       mychoices = mysettings.getvirtuals().get(mykey, [])
+
                if not (pkgs or mychoices):
                        # This one couldn't be expanded as a new-style virtual.  Old-style
                        # virtuals have already been expanded by dep_virtual, so this one
index 6981e24ca8f7329c10372e92680b0712fd116d6b..13a91f97d6b2cce6c4540472cd95935dc4728e65 100644 (file)
@@ -1964,7 +1964,11 @@ class config(object):
 
        def _populate_treeVirtuals_if_needed(self, vartree):
                """Reduce the provides into a list by CP."""
-               self._virtuals_manager.populate_treeVirtuals_if_needed(vartree)
+               if self._virtuals_manager._treeVirtuals is None:
+                       if self.local_config:
+                               self._virtuals_manager.populate_treeVirtuals_if_needed(vartree)
+                       else:
+                               self._virtuals_manager._treeVirtuals = {}
 
        def __delitem__(self,mykey):
                self.modifying()