diff options
author | Zac Medico <zmedico@gentoo.org> | 2009-11-02 01:45:57 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2009-11-02 01:45:57 +0000 |
commit | 5cd2ece3ba07ea132f1bda9ec4ab76828cc77f51 (patch) | |
tree | d0a7aecb8f713efe3337c7c84575f670387f3051 | |
parent | 5f52aad4c25dfd7c1b15af89b8d102bc40cba3dc (diff) | |
download | portage-5cd2ece3ba07ea132f1bda9ec4ab76828cc77f51.tar.gz portage-5cd2ece3ba07ea132f1bda9ec4ab76828cc77f51.tar.bz2 portage-5cd2ece3ba07ea132f1bda9ec4ab76828cc77f51.zip |
Don't call FakeVartree.sync() redundantly when backtracking.
svn path=/main/trunk/; revision=14774
-rw-r--r-- | pym/_emerge/PackageVirtualDbapi.py | 7 | ||||
-rw-r--r-- | pym/_emerge/depgraph.py | 5 |
2 files changed, 11 insertions, 1 deletions
diff --git a/pym/_emerge/PackageVirtualDbapi.py b/pym/_emerge/PackageVirtualDbapi.py index adf269116..e557f0489 100644 --- a/pym/_emerge/PackageVirtualDbapi.py +++ b/pym/_emerge/PackageVirtualDbapi.py @@ -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()) diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index 72c147ee2..5c66cf581 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -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 |