Fix FakeVartree.sync() to remove stale packages from _pkg_cache.
authorZac Medico <zmedico@gentoo.org>
Mon, 6 Sep 2010 07:19:10 +0000 (00:19 -0700)
committerZac Medico <zmedico@gentoo.org>
Mon, 6 Sep 2010 07:19:10 +0000 (00:19 -0700)
pym/_emerge/FakeVartree.py

index 3d07af412d68d1e6954caa9b8362b7c0f52ca1e7..97675708b341d4f224c70000d0ef125daee24663 100644 (file)
@@ -131,12 +131,14 @@ class FakeVartree(vartree):
                real_vardb = self._root_config.trees["vartree"].dbapi
                current_cpv_set = frozenset(real_vardb.cpv_all())
                pkg_vardb = self.dbapi
+               pkg_cache = self._pkg_cache
                aux_get_history = self._aux_get_history
 
                # Remove any packages that have been uninstalled.
                for pkg in list(pkg_vardb):
                        if pkg.cpv not in current_cpv_set:
                                pkg_vardb.cpv_remove(pkg)
+                               pkg_cache.pop(pkg, None)
                                aux_get_history.discard(pkg.cpv)
 
                # Validate counters and timestamps.
@@ -157,6 +159,7 @@ class FakeVartree(vartree):
                                if counter != pkg.counter or \
                                        mtime != pkg.mtime:
                                        pkg_vardb.cpv_remove(pkg)
+                                       pkg_cache.pop(pkg, None)
                                        aux_get_history.discard(pkg.cpv)
                                        pkg = None