summaryrefslogtreecommitdiffstats
path: root/pym/_emerge
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-06-04 20:24:31 +0000
committerZac Medico <zmedico@gentoo.org>2008-06-04 20:24:31 +0000
commit93fa7f35f98ab02448c7537682e07a2b097f8453 (patch)
tree28ec7709d39d33c10e5d91476d37b3895f5f480f /pym/_emerge
parentdcb0e56b3ebaabccc44246f6a2ede2f880cc5527 (diff)
downloadportage-93fa7f35f98ab02448c7537682e07a2b097f8453.tar.gz
portage-93fa7f35f98ab02448c7537682e07a2b097f8453.tar.bz2
portage-93fa7f35f98ab02448c7537682e07a2b097f8453.zip
Use sets for more accurate cache modification counts BlockerCache and vardbapi.
svn path=/main/trunk/; revision=10578
Diffstat (limited to 'pym/_emerge')
-rw-r--r--pym/_emerge/__init__.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py
index 7fd1373ad..12723e655 100644
--- a/pym/_emerge/__init__.py
+++ b/pym/_emerge/__init__.py
@@ -1470,7 +1470,7 @@ class BlockerCache(DictMixin):
portage.CACHE_PATH.lstrip(os.path.sep), "vdb_blockers.pickle")
self._cache_version = "1"
self._cache_data = None
- self._modified = 0
+ self._modified = set()
self._load()
def _load(self):
@@ -1540,7 +1540,7 @@ class BlockerCache(DictMixin):
self._cache_data = {"version":self._cache_version}
self._cache_data["blockers"] = {}
self._cache_data["virtuals"] = self._virtuals
- self._modified = 0
+ self._modified.clear()
def flush(self):
"""If the current user has permission and the internal blocker cache
@@ -1558,7 +1558,7 @@ class BlockerCache(DictMixin):
"virtuals" : vardb.settings.getvirtuals()
}
"""
- if self._modified >= self._cache_threshold and \
+ if len(self._modified) >= self._cache_threshold and \
secpass >= 2:
try:
f = portage.util.atomic_ofstream(self._cache_filename)
@@ -1568,7 +1568,7 @@ class BlockerCache(DictMixin):
self._cache_filename, gid=portage.portage_gid, mode=0644)
except (IOError, OSError), e:
pass
- self._modified = 0
+ self._modified.clear()
def __setitem__(self, cpv, blocker_data):
"""
@@ -1582,7 +1582,7 @@ class BlockerCache(DictMixin):
"""
self._cache_data["blockers"][cpv] = \
(blocker_data.counter, tuple(str(x) for x in blocker_data.atoms))
- self._modified += 1
+ self._modified.add(cpv)
def __iter__(self):
return iter(self._cache_data["blockers"])