summaryrefslogtreecommitdiffstats
path: root/bin/egencache
diff options
context:
space:
mode:
authorBrian Harring <ferringb@chromium.org>2011-10-13 23:27:22 -0700
committerZac Medico <zmedico@gentoo.org>2011-10-14 16:50:20 -0700
commit2ed1cb53cc4158af08c22d466b15b9a9a7767212 (patch)
tree9c2f87cfccd2f304baaece4b88db48a1f35db847 /bin/egencache
parent90012f94f00ec2cf6b355bd9c30215b83c2b5b7f (diff)
downloadportage-2ed1cb53cc4158af08c22d466b15b9a9a7767212.tar.gz
portage-2ed1cb53cc4158af08c22d466b15b9a9a7767212.tar.bz2
portage-2ed1cb53cc4158af08c22d466b15b9a9a7767212.zip
cache: rewrite to support arbitrary validation method
Specifically, the cache can use any portage supported checksum method, or use the standard mtime approach. In addition, support controlling whether or not paths are stored, and generally try to restore some of the centralization/encapsulation that was in place originally. (cherry picked from commit bc1aed614fb588f0ade5bcb5d1265a8db0f8d247) Change-Id: Ic38057e7dbb15063c64a93c99e66e113a7d4c70e
Diffstat (limited to 'bin/egencache')
-rwxr-xr-xbin/egencache14
1 files changed, 10 insertions, 4 deletions
diff --git a/bin/egencache b/bin/egencache
index 26660c1a9..8d16cd693 100755
--- a/bin/egencache
+++ b/bin/egencache
@@ -215,8 +215,11 @@ class GenCache(object):
consumer=self._metadata_callback,
max_jobs=max_jobs, max_load=max_load)
self.returncode = os.EX_OK
- self._trg_cache = metadata.database(portdb.porttrees[0],
- "metadata/cache", portage.auxdbkeys[:])
+ conf = portdb.repositories.get_repo_for_location(portdb.porttrees[0])
+ self._trg_cache = conf.get_pregenerated_cache(portage.auxdbkeys[:],
+ force=True, readonly=False)
+ if self._trg_cache is None:
+ raise Exception("cache format %s isn't supported" % (conf.cache_format,))
if rsync:
self._trg_cache.raise_stat_collision = True
try:
@@ -226,13 +229,16 @@ class GenCache(object):
pass
self._existing_nodes = set()
- def _metadata_callback(self, cpv, ebuild_path, repo_path, metadata):
+ def _metadata_callback(self, cpv, repo_path, metadata, ebuild_hash):
self._existing_nodes.add(cpv)
self._cp_missing.discard(cpv_getkey(cpv))
if metadata is not None:
if metadata.get('EAPI') == '0':
del metadata['EAPI']
try:
+ chf = self._trg_cache.validation_chf
+ if chf != 'mtime':
+ metadata['_%s_' % chf] = getattr(ebuild_hash, chf)
try:
self._trg_cache[cpv] = metadata
except StatCollision as sc:
@@ -251,7 +257,7 @@ class GenCache(object):
max_mtime += 1
max_mtime = long(max_mtime)
try:
- os.utime(ebuild_path, (max_mtime, max_mtime))
+ os.utime(ebuild_hash.location, (max_mtime, max_mtime))
except OSError as e:
self.returncode |= 1
writemsg_level(