Enable FakeVartree to populate the virtuals so that the vdb doesn't have to be scanne...
authorZac Medico <zmedico@gentoo.org>
Thu, 7 Dec 2006 22:23:57 +0000 (22:23 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 7 Dec 2006 22:23:57 +0000 (22:23 -0000)
svn path=/main/trunk/; revision=5207

bin/emerge
pym/portage.py

index 44a9a6f80043a8f3c68d9814ec1aa04f1c60eb0c..88dea39c532e1f8ad5087937d27f5e81b43b456c 100755 (executable)
@@ -699,7 +699,7 @@ class DepPriority(object):
                        return "medium"
                return "soft"
 
-class FakeVartree(object):
+class FakeVartree(portage.vartree):
        """This is implements an in-memory copy of a vartree instance that provides
        all the interfaces required for use by the depgraph.  The vardb is locked
        during the constructor call just long enough to read a copy of the
@@ -718,7 +718,8 @@ class FakeVartree(object):
                try:
                        if os.access(vdb_path, os.W_OK):
                                vdb_lock = portage_locks.lockdir(vdb_path)
-                       mykeys = ["SLOT", "USE", "IUSE", "DEPEND", "RDEPEND", "PDEPEND"]
+                       mykeys = ["SLOT", "PROVIDE", "USE", "IUSE",
+                               "DEPEND", "RDEPEND", "PDEPEND"]
                        real_dbapi = real_vartree.dbapi
                        for cpv in real_dbapi.cpv_all():
                                metadata = dict(zip(mykeys, real_dbapi.aux_get(cpv, mykeys)))
@@ -726,6 +727,10 @@ class FakeVartree(object):
                finally:
                        if vdb_lock:
                                portage_locks.unlockdir(vdb_lock)
+               # Populate the old-style virtuals using the cached values.
+               if not self.settings.treeVirtuals:
+                       self.settings.treeVirtuals = portage_util.map_dictlist_vals(
+                               portage.getCPFromCPV, self.get_all_provides())
 
 class depgraph:
 
@@ -752,8 +757,6 @@ class depgraph:
                                self.trees[myroot][tree] = trees[myroot][tree]
                        self.trees[myroot]["vartree"] = \
                                FakeVartree(trees[myroot]["vartree"])
-                       # Make sure the virtuals are populated before cloning.
-                       trees[myroot]["vartree"].settings.getvirtuals()
                        self.pkgsettings[myroot] = portage.config(
                                clone=self.trees[myroot]["vartree"].settings)
                        self.pkg_node_map[myroot] = {}
index 9881d227dedeb77447e978eb6bfaa158b9c14644..13c851ab0e1f95c18fa111ee586861f6f55a1b04 100644 (file)
@@ -1853,7 +1853,7 @@ class config:
                        self.dirVirtuals[virt].reverse()
 
                # Repoman does not use user or tree virtuals.
-               if self.local_config:
+               if self.local_config and not self.treeVirtuals:
                        temp_vartree = vartree(myroot, None,
                                categories=self.categories, settings=self)
                        # Reduce the provides into a list by CP.
@@ -4930,11 +4930,9 @@ class vartree(packagetree):
        def get_provide(self,mycpv):
                myprovides=[]
                try:
-                       mylines = grabfile(self.root+VDB_PATH+"/"+mycpv+"/PROVIDE")
+                       mylines, myuse = self.dbapi.aux_get(mycpv, ["PROVIDE","USE"])
                        if mylines:
-                               myuse = grabfile(self.root+VDB_PATH+"/"+mycpv+"/USE")
-                               myuse = string.split(string.join(myuse))
-                               mylines = string.join(mylines)
+                               myuse = myuse.split()
                                mylines = flatten(portage_dep.use_reduce(portage_dep.paren_reduce(mylines), uselist=myuse))
                                for myprovide in mylines:
                                        mys = catpkgsplit(myprovide)