Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(265)

Unified Diff: pym/_emerge/FakeVartree.py

Issue 6688037: Update Portage to sync BlockerDB at init, rather than before every package. (Closed) Base URL: http://git.chromium.org/git/portage_tool.git@cros-2.1.9
Patch Set: Address review feedback. Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pym/_emerge/BlockerDB.py ('k') | pym/_emerge/Scheduler.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pym/_emerge/FakeVartree.py
diff --git a/pym/_emerge/FakeVartree.py b/pym/_emerge/FakeVartree.py
index 977824c78433c9104d1b9e5900ea236bd39e484f..21bd355e923c791ead61d7d814f27742b591e443 100644
--- a/pym/_emerge/FakeVartree.py
+++ b/pym/_emerge/FakeVartree.py
@@ -100,6 +100,16 @@ class FakeVartree(vartree):
pkg, self.dbapi, self._global_updates)
return self._aux_get(pkg, wants)
+ def cpv_discard(self, pkg):
+ """
+ Discard a package from the fake vardb if it exists.
+ """
+ old_pkg = self.dbapi.get(pkg)
+ if old_pkg is not None:
+ self.dbapi.cpv_remove(old_pkg)
+ self._pkg_cache.pop(old_pkg, None)
+ self._aux_get_history.discard(old_pkg.cpv)
+
def sync(self, acquire_lock=1):
"""
Call this method to synchronize state with the real vardb
@@ -141,9 +151,7 @@ class FakeVartree(vartree):
# 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)
+ self.cpv_discard(pkg)
# Validate counters and timestamps.
slot_counters = {}
@@ -162,9 +170,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)
+ self.cpv_discard(pkg)
pkg = None
if pkg is None:
« no previous file with comments | « pym/_emerge/BlockerDB.py ('k') | pym/_emerge/Scheduler.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698