summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-03-11 06:47:03 +0000
committerZac Medico <zmedico@gentoo.org>2009-03-11 06:47:03 +0000
commit0db63fa347396296ba1dca15b3d72a946e69f096 (patch)
treed7e8caea736817d9cf23eb103c820dbc5d036b56 /pym
parentf0a15cf2bc9beb6f3c1ce03e8d514214621b29d6 (diff)
downloadportage-0db63fa347396296ba1dca15b3d72a946e69f096.tar.gz
portage-0db63fa347396296ba1dca15b3d72a946e69f096.tar.bz2
portage-0db63fa347396296ba1dca15b3d72a946e69f096.zip
Fix __getitem__ to convert mtime to long, and remove unreachable code
from _parse_data(). (trunk r12776) svn path=/main/branches/2.1.6/; revision=13020
Diffstat (limited to 'pym')
-rw-r--r--pym/portage/cache/flat_hash.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/pym/portage/cache/flat_hash.py b/pym/portage/cache/flat_hash.py
index dda380e1c..f6bf6d078 100644
--- a/pym/portage/cache/flat_hash.py
+++ b/pym/portage/cache/flat_hash.py
@@ -33,6 +33,16 @@ class database(fs_template.FsBased):
"""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
return d
finally:
myf.close()
@@ -52,14 +62,6 @@ class database(fs_template.FsBased):
else:
d["_eclasses_"] = {}
return d
-
- for x in self._known_keys:
- if x not in d:
- d[x] = ''
-
-
- return d
-
def _setitem(self, cpv, values):
# import pdb;pdb.set_trace()