summaryrefslogtreecommitdiffstats
path: root/pym/portage/cache/flat_hash.py
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-03-08 05:25:18 +0000
committerZac Medico <zmedico@gentoo.org>2009-03-08 05:25:18 +0000
commit625dfec772c783c352d0245133aaef5fc0f0e261 (patch)
tree39d5fb14a8a3d0cb21e0fdb303de9a25f7f8bb52 /pym/portage/cache/flat_hash.py
parenta23e4255c9c159f6ac242ea8935ca5c8535b2936 (diff)
downloadportage-625dfec772c783c352d0245133aaef5fc0f0e261.tar.gz
portage-625dfec772c783c352d0245133aaef5fc0f0e261.tar.bz2
portage-625dfec772c783c352d0245133aaef5fc0f0e261.zip
Implement _getitem instead of __getitem__ so that the base class __getitem__
implementation is used for _mtime_ and _eclasses_ handling. svn path=/main/trunk/; revision=12781
Diffstat (limited to 'pym/portage/cache/flat_hash.py')
-rw-r--r--pym/portage/cache/flat_hash.py24
1 files changed, 5 insertions, 19 deletions
diff --git a/pym/portage/cache/flat_hash.py b/pym/portage/cache/flat_hash.py
index f6bf6d078..ac1b7f190 100644
--- a/pym/portage/cache/flat_hash.py
+++ b/pym/portage/cache/flat_hash.py
@@ -23,26 +23,16 @@ class database(fs_template.FsBased):
if not self.readonly and not os.path.exists(self.location):
self._ensure_dirs()
- def __getitem__(self, cpv):
+ def _getitem(self, cpv):
fp = os.path.join(self.location, cpv)
try:
myf = open(fp, "r")
try:
d = self._parse_data(myf, cpv)
- if "_mtime_" not in d:
- """Backward compatibility with old cache that uses mtime
- mangling."""
- d["_mtime_"] = long(os.fstat(myf.fileno()).st_mtime)
- mtime = d.get('_mtime_')
- if mtime is None:
- raise cache_errors.CacheCorruption(cpv,
- '_mtime_ field is missing')
- try:
- mtime = long(mtime)
- except ValueError:
- raise cache_errors.CacheCorruption(cpv,
- '_mtime_ conversion to long failed: %s' % (mtime,))
- d['_mtime_'] = mtime
+ if '_mtime_' not in d:
+ # Backward compatibility with old cache
+ # that uses mtime mangling.
+ d['_mtime_'] = long(os.fstat(myf.fileno()).st_mtime)
return d
finally:
myf.close()
@@ -57,10 +47,6 @@ class database(fs_template.FsBased):
except ValueError, e:
# If a line is missing an "=", the split length is 1 instead of 2.
raise cache_errors.CacheCorruption(cpv, e)
- if "_eclasses_" in d:
- d["_eclasses_"] = reconstruct_eclasses(cpv, d["_eclasses_"])
- else:
- d["_eclasses_"] = {}
return d
def _setitem(self, cpv, values):