When depgraph updates preferences for old-style virtuals, also update them in the...
authorZac Medico <zmedico@gentoo.org>
Fri, 6 Jul 2007 23:07:01 +0000 (23:07 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 6 Jul 2007 23:07:01 +0000 (23:07 -0000)
svn path=/main/branches/2.1.2/; revision=7186

bin/emerge
pym/portage.py

index 011b0469af0c3d1040d933f8004a8df1cda3bdb1..9f1c3447271d233969d4d6339dc8347a33c588e2 100755 (executable)
@@ -1745,9 +1745,14 @@ class depgraph:
                        if p_status == "merge":
                                # Update old-style virtuals if this package provides any.
                                # These are needed for dep_virtual calls inside dep_check.
-                               p_db = self.trees[p_root][self.pkg_tree_map[p_type]].dbapi
+                               p_db = self.mydbapi[p_root] # contains cached metadata
                                try:
                                        self.pkgsettings[p_root].setinst(p_key, p_db)
+                                       # For consistency, also update the global virtuals.
+                                       settings = self.roots[p_root].settings
+                                       settings.unlock()
+                                       settings.setinst(p_key, p_db)
+                                       settings.lock()
                                except portage_exception.InvalidDependString, e:
                                        provide = p_db.aux_get(p_key, ["PROVIDE"])[0]
                                        show_invalid_depstring_notice(myparent, provide, str(e))
index f651ddc59a742b6f08c81c8e19f6cbc179d09fc2..ec36ede3454b2127a5f95cff17090d64fc67362c 100644 (file)
@@ -1813,22 +1813,29 @@ class config:
                        self.getvirtuals()
                # Grab the virtuals this package provides and add them into the tree virtuals.
                provides = mydbapi.aux_get(mycpv, ["PROVIDE"])[0]
+               if not provides:
+                       return
                if isinstance(mydbapi, portdbapi):
+                       self.setcpv(mycpv, mydb=mydbapi)
                        myuse = self["USE"]
                else:
                        myuse = mydbapi.aux_get(mycpv, ["USE"])[0]
                virts = flatten(portage_dep.use_reduce(portage_dep.paren_reduce(provides), uselist=myuse.split()))
 
+               modified = False
                cp = dep_getkey(mycpv)
                for virt in virts:
                        virt = dep_getkey(virt)
-                       if not self.treeVirtuals.has_key(virt):
-                               self.treeVirtuals[virt] = []
-                       # XXX: Is this bad? -- It's a permanent modification
-                       if cp not in self.treeVirtuals[virt]:
-                               self.treeVirtuals[virt].append(cp)
-
-               self.virtuals = self.__getvirtuals_compile()
+                       providers = self.treeVirtuals.get(virt)
+                       if providers is None:
+                               providers = []
+                               self.treeVirtuals[virt] = providers
+                       if cp not in providers:
+                               providers.append(cp)
+                               modified = True
+
+               if modified:
+                       self.virtuals = self.__getvirtuals_compile()
 
 
        def regenerate(self,useonly=0,use_cache=1):