summaryrefslogtreecommitdiffstats
path: root/pym/eclass_cache.py
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-10-24 07:20:12 +0000
committerZac Medico <zmedico@gentoo.org>2006-10-24 07:20:12 +0000
commit630ad8983eaa46ff1962454be001befb2120d1b9 (patch)
tree601430115faa0ff2dcda718566952f0f6028fce5 /pym/eclass_cache.py
parentc8162735497d172dfdc1db7164cc8ed8b074943d (diff)
downloadportage-630ad8983eaa46ff1962454be001befb2120d1b9.tar.gz
portage-630ad8983eaa46ff1962454be001befb2120d1b9.tar.bz2
portage-630ad8983eaa46ff1962454be001befb2120d1b9.zip
Remove paths from _eclasses_ serialization in the cache. This makes the mtimes of the eclasses the only thing that distinguishes them, but the probablility of collision is negligible. This same _eclasses_ format will be used to serialize eclass mtimes in cache that is distributed via the rsync mirrors. The deserialization code can handle mixtures of both the old and new formats.
svn path=/main/trunk/; revision=4807
Diffstat (limited to 'pym/eclass_cache.py')
-rw-r--r--pym/eclass_cache.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/pym/eclass_cache.py b/pym/eclass_cache.py
index 8d2a2bb81..904e63261 100644
--- a/pym/eclass_cache.py
+++ b/pym/eclass_cache.py
@@ -15,6 +15,7 @@ class cache:
self.porttree_root = porttree_root
self.eclasses = {} # {"Name": ("location","_mtime_")}
+ self._eclass_locations = {}
# screw with the porttree ordering, w/out having bash inherit match it, and I'll hurt you.
# ~harring
@@ -38,6 +39,7 @@ class cache:
def update_eclasses(self):
self.eclasses = {}
+ self._eclass_locations = {}
eclass_len = len(".eclass")
for x in [normalize_path(os.path.join(y,"eclass")) for y in self.porttrees]:
if not os.path.isdir(x):
@@ -48,13 +50,14 @@ class cache:
except OSError:
continue
ys=y[:-eclass_len]
- self.eclasses[ys] = (x, long(mtime))
+ self.eclasses[ys] = long(mtime)
+ self._eclass_locations[ys] = x
def is_eclass_data_valid(self, ec_dict):
if not isinstance(ec_dict, dict):
return False
- for eclass, tup in ec_dict.iteritems():
- if eclass not in self.eclasses or tuple(tup) != self.eclasses[eclass]:
+ for eclass, mtime in ec_dict.iteritems():
+ if eclass not in self.eclasses or mtime != self.eclasses[eclass]:
return False
return True
@@ -68,7 +71,8 @@ class cache:
print "ec=",ec_dict
print "inherits=",inherits
raise
- if from_master_only and self.eclasses[x][0] != self._master_eclass_root:
+ if from_master_only and \
+ self._eclass_locations[x] != self._master_eclass_root:
return None
return ec_dict