Add a PackageVirtualDbapi.__iter__() method and use it to iterate over
authorZac Medico <zmedico@gentoo.org>
Fri, 2 May 2008 22:33:31 +0000 (22:33 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 2 May 2008 22:33:31 +0000 (22:33 -0000)
all installed packages in depgraph.validate_blockers(). (trunk r10112)

svn path=/main/branches/2.1.2/; revision=10113

bin/emerge

index eb829e4fb5da315cf1e8dbb05d2ddfddeeef1fca..07984f6c5a7d902431414ec0542fa78f0c5fae5e 100755 (executable)
@@ -1657,6 +1657,9 @@ class PackageVirtualDbapi(portage.dbapi):
                obj._cpv_map = self._cpv_map.copy()
                return obj
 
+       def __iter__(self):
+               return self._cpv_map.itervalues()
+
        def __contains__(self, item):
                existing = self._cpv_map.get(item.cpv)
                if existing is not None and \
@@ -3265,14 +3268,12 @@ class depgraph(object):
                                portdb = self.trees[myroot]["porttree"].dbapi
                                pkgsettings = self.pkgsettings[myroot]
                                final_db = self.mydbapi[myroot]
-                               cpv_all_installed = self.trees[myroot]["vartree"].dbapi.cpv_all()
                                blocker_cache = BlockerCache(myroot, vardb)
                                stale_cache = set(blocker_cache)
-                               for cpv in cpv_all_installed:
+                               for pkg in vardb:
+                                       cpv = pkg.cpv
                                        stale_cache.discard(cpv)
                                        blocker_atoms = None
-                                       pkg = self._pkg_cache[
-                                               ("installed", myroot, cpv, "nomerge")]
                                        blockers = None
                                        if self.digraph.contains(pkg):
                                                try: