Simplify the new-style -> old-style virtuals bridge by doing it implicitly for all...
authorZac Medico <zmedico@gentoo.org>
Mon, 6 Nov 2006 20:50:11 +0000 (20:50 -0000)
committerZac Medico <zmedico@gentoo.org>
Mon, 6 Nov 2006 20:50:11 +0000 (20:50 -0000)
svn path=/main/trunk/; revision=4962

bin/emerge
pym/portage.py

index 4cdab4b84579b0a4bebb3ae3b4f4349157d8550a..cae410dfb142c7a1fd4051b8c41b0a0b48150a06 100755 (executable)
@@ -724,12 +724,6 @@ class depgraph:
                for myroot in self.trees:
                        self.pkgsettings[myroot] = portage.config(
                                clone=trees[myroot]["vartree"].settings)
-                       mydbapis = []
-                       if "--usepkgonly" not in self.myopts:
-                               mydbapis.append(trees[myroot]["porttree"].dbapi)
-                       if "--usepkg" in self.myopts:
-                               mydbapis.append(trees[myroot]["bintree"].dbapi)
-                       self.pkgsettings[myroot].add_new_virtuals(mydbapis)
                self.useFlags = {}
                self.useFlags[self.target_root] = {}
                if self.target_root != "/":
index 4d869931421e90d34c3a3d83a47b092e6cfb5618..edb13146df7fb71c414ed56cc4c32c23946e5242 100644 (file)
@@ -849,7 +849,6 @@ class config:
                self.virtuals = {}
                self.virts_p = {}
                self.dirVirtuals = None
-               self._new_virtuals = {}
                self.v_count  = 0
 
                # Virtuals obtained from the vartree
@@ -915,7 +914,6 @@ class config:
                        self.prevmaskdict = copy.deepcopy(clone.prevmaskdict)
                        self.pprovideddict = copy.deepcopy(clone.pprovideddict)
                        self.dirVirtuals = copy.deepcopy(clone.dirVirtuals)
-                       self._new_virtuals = copy.deepcopy(clone._new_virtuals)
                        self.treeVirtuals = copy.deepcopy(clone.treeVirtuals)
                        self.features = copy.deepcopy(clone.features)
 
@@ -1864,21 +1862,13 @@ class config:
                                        ptVirtuals.setdefault(virt, [])
                                        ptVirtuals[virt].append(cp)
 
-               return stack_dictlist([ptVirtuals, self.treeVirtuals, self.dirVirtuals,
-                       self._new_virtuals])
-
-       def add_new_virtuals(self, mydbapis):
-               """Scan for new-style virtuals and bridge them into the old-style."""
-               new_virtuals = {}
-               for mydbapi in mydbapis:
-                       for cpv in mydbapi.cpv_all():
-                               if cpv.startswith("virtual/"):
-                                       cp = dep_getkey(cpv)
-                                       new_virtuals[cp] = [cp]
-               self._new_virtuals = new_virtuals
-               # Make sure dirVirtuals and treeVirtuals are initialized.
-               self.getvirtuals()
-               self.virtuals = self.__getvirtuals_compile()
+               virtuals = stack_dictlist([ptVirtuals, self.treeVirtuals,
+                       self.dirVirtuals])
+               # Bridge new-style virtuals into old-style.
+               for k, v in virtuals.iteritems():
+                       if k not in v:
+                               v.append(k)
+               return virtuals
 
        def __delitem__(self,mykey):
                self.modifying()