Don't call FakeVartree.sync() redundantly when backtracking. (trunk r14774)
authorZac Medico <zmedico@gentoo.org>
Sat, 7 Nov 2009 01:09:57 +0000 (01:09 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 7 Nov 2009 01:09:57 +0000 (01:09 -0000)
svn path=/main/branches/2.1.7/; revision=14787

pym/_emerge/PackageVirtualDbapi.py
pym/_emerge/depgraph.py

index adf269116728cd9244ecf2f78611b51e7560041e..e557f0489830e9e373ff4fdbc9e1b2542fc1aa1d 100644 (file)
@@ -2,6 +2,7 @@
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
+import sys
 import portage
 
 class PackageVirtualDbapi(portage.dbapi):
@@ -37,6 +38,12 @@ class PackageVirtualDbapi(portage.dbapi):
                obj._cpv_map = self._cpv_map.copy()
                return obj
 
+       def __bool__(self):
+               return bool(self._cpv_map)
+
+       if sys.hexversion < 0x3000000:
+               __nonzero__ = __bool__
+
        def __iter__(self):
                return iter(self._cpv_map.values())
 
index e7407893f4f9d40c2b1f18e6c702750fd25afa0c..d2f101bd668d2684d24781a0623328f69651175e 100644 (file)
@@ -270,7 +270,10 @@ class depgraph(object):
                                "--buildpkgonly" not in self._frozen_config.myopts
 
                        fake_vartree = self._frozen_config.trees[myroot]["vartree"]
-                       fake_vartree.sync()
+                       if not fake_vartree.dbapi:
+                               # This needs to be called for the first depgraph, but not for
+                               # backtracking depgraphs that share the same frozen_config.
+                               fake_vartree.sync()
 
                        if preload_installed_pkgs:
                                vardb = fake_vartree.dbapi