diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-05-20 03:06:32 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-05-20 03:06:32 +0000 |
commit | 654153003cb7a0c8bfc6e7ba8863f7c22761081d (patch) | |
tree | d18a79a5947c4ee42485bc8c2d0723c008cfa9a4 | |
parent | 77c1ecc2c7c016e1e815743d8a46899c16acc47e (diff) | |
download | portage-654153003cb7a0c8bfc6e7ba8863f7c22761081d.tar.gz portage-654153003cb7a0c8bfc6e7ba8863f7c22761081d.tar.bz2 portage-654153003cb7a0c8bfc6e7ba8863f7c22761081d.zip |
Simplify cache code in vardbapi.aux_get().
svn path=/main/trunk/; revision=10377
-rw-r--r-- | pym/portage/dbapi/vartree.py | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index 87fff90d1..ecd17f81e 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -612,6 +612,7 @@ class vardbapi(dbapi): raise KeyError(mycpv) mydir_mtime = long(mydir_stat.st_mtime) pkg_data = self._aux_cache["packages"].get(mycpv) + pull_me = cache_these.union(wants) mydata = {} cache_valid = False cache_incomplete = False @@ -630,23 +631,15 @@ class vardbapi(dbapi): cache_mtime, metadata = pkg_data cache_valid = cache_mtime == mydir_mtime if cache_valid: - cache_incomplete = cache_these.difference(metadata) - if cache_incomplete: - # Allow self._aux_cache_keys to change without a cache version - # bump and efficiently recycle partial cache whenever possible. - pull_me = cache_incomplete.union(wants) - else: - pull_me = set(wants).difference(cache_these) mydata.update(metadata) - else: - pull_me = cache_these.union(wants) + pull_me.difference_update(metadata) if pull_me: # pull any needed data and cache it aux_keys = list(pull_me) for k, v in izip(aux_keys, self._aux_get(mycpv, aux_keys)): mydata[k] = v - if not cache_valid or cache_incomplete: + if not cache_valid or cache_these.difference(metadata): cache_data = {} if cache_valid and metadata: cache_data.update(metadata) |