* [gentoo-commits] portage r12781 - main/trunk/pym/portage/cache
@ 2009-03-08 5:25 Zac Medico (zmedico)
0 siblings, 0 replies; only message in thread
From: Zac Medico (zmedico) @ 2009-03-08 5:25 UTC (permalink / raw
To: gentoo-commits
Author: zmedico
Date: 2009-03-08 05:25:18 +0000 (Sun, 08 Mar 2009)
New Revision: 12781
Modified:
main/trunk/pym/portage/cache/flat_hash.py
main/trunk/pym/portage/cache/metadata.py
Log:
Implement _getitem instead of __getitem__ so that the base class __getitem__
implementation is used for _mtime_ and _eclasses_ handling.
Modified: main/trunk/pym/portage/cache/flat_hash.py
===================================================================
--- main/trunk/pym/portage/cache/flat_hash.py 2009-03-07 23:05:30 UTC (rev 12780)
+++ main/trunk/pym/portage/cache/flat_hash.py 2009-03-08 05:25:18 UTC (rev 12781)
@@ -23,26 +23,16 @@
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 @@
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):
Modified: main/trunk/pym/portage/cache/metadata.py
===================================================================
--- main/trunk/pym/portage/cache/metadata.py 2009-03-07 23:05:30 UTC (rev 12780)
+++ main/trunk/pym/portage/cache/metadata.py 2009-03-08 05:25:18 UTC (rev 12781)
@@ -21,6 +21,7 @@
'PDEPEND', 'PROVIDE', 'EAPI', 'PROPERTIES', 'DEFINED_PHASES')
autocommits = True
+ serialize_eclasses = False
_hashed_re = re.compile('^(\\w+)=([^\n]*)')
@@ -30,10 +31,6 @@
self.location = os.path.join(loc, "metadata","cache")
self.ec = portage.eclass_cache.cache(loc)
- def __getitem__(self, cpv):
- return flat_hash.database.__getitem__(self, cpv)
-
-
def _parse_data(self, data, cpv):
_hashed_re_match = self._hashed_re.match
data = list(data)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-03-08 5:25 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-08 5:25 [gentoo-commits] portage r12781 - main/trunk/pym/portage/cache Zac Medico (zmedico)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox