summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-11-18 02:50:49 +0000
committerZac Medico <zmedico@gentoo.org>2007-11-18 02:50:49 +0000
commitd9b10deaa03ce174d5ccc3b59c477549ad87e884 (patch)
tree0728a0dfb47f2e555066ae6a5b1e8f805c09416c
parent5b8552896bc2253ee1286928719974a2d4d3c621 (diff)
downloadportage-d9b10deaa03ce174d5ccc3b59c477549ad87e884.tar.gz
portage-d9b10deaa03ce174d5ccc3b59c477549ad87e884.tar.bz2
portage-d9b10deaa03ce174d5ccc3b59c477549ad87e884.zip
Bug #198398 - Enable Manifest generation when there are no hash
functions available for types such as RMD160. Now it's possible to generate a Manifest when python-2.5 is built without ssl support. MANIFEST1_REQUIRED_HASH and MANIFEST2_REQUIRED_HASH are the only two functions that are strictly required now (MD5 and SHA1). svn path=/main/trunk/; revision=8521
-rw-r--r--pym/portage/const.py2
-rw-r--r--pym/portage/manifest.py20
2 files changed, 17 insertions, 5 deletions
diff --git a/pym/portage/const.py b/pym/portage/const.py
index de17634b4..733029fa4 100644
--- a/pym/portage/const.py
+++ b/pym/portage/const.py
@@ -62,6 +62,8 @@ EAPI = 1
HASHING_BLOCKSIZE = 32768
MANIFEST1_HASH_FUNCTIONS = ["MD5","SHA256","RMD160"]
MANIFEST2_HASH_FUNCTIONS = ["SHA1","SHA256","RMD160"]
+
+MANIFEST1_REQUIRED_HASH = "MD5"
MANIFEST2_REQUIRED_HASH = "SHA1"
MANIFEST2_IDENTIFIERS = ["AUX","MISC","DIST","EBUILD"]
diff --git a/pym/portage/manifest.py b/pym/portage/manifest.py
index 93182f764..82ca37efb 100644
--- a/pym/portage/manifest.py
+++ b/pym/portage/manifest.py
@@ -107,11 +107,16 @@ class Manifest(object):
a Manifest (not needed for parsing and checking sums)."""
self.pkgdir = pkgdir.rstrip(os.sep) + os.sep
self.fhashdict = {}
- self.hashes = portage.const.MANIFEST2_HASH_FUNCTIONS[:]
- self.hashes.append("size")
+ self.hashes = set()
+ self.hashes.update(portage.const.MANIFEST2_HASH_FUNCTIONS)
if manifest1_compat:
- self.hashes.extend(portage.const.MANIFEST1_HASH_FUNCTIONS)
- self.hashes = set(self.hashes)
+ self.hashes.update(portage.const.MANIFEST1_HASH_FUNCTIONS)
+ self.hashes.difference_update(hashname for hashname in \
+ list(self.hashes) if hashname not in hashfunc_map)
+ self.hashes.add("size")
+ if manifest1_compat:
+ self.hashes.add(portage.const.MANIFEST1_REQUIRED_HASH)
+ self.hashes.add(portage.const.MANIFEST2_REQUIRED_HASH)
for t in portage.const.MANIFEST2_IDENTIFIERS:
self.fhashdict[t] = {}
self.compat = manifest1_compat
@@ -327,11 +332,16 @@ class Manifest(object):
if self.compat:
cvp_list = self.fetchlist_dict.keys()
cvp_list.sort()
+ manifest1_hashes = set(hashname for hashname in \
+ portage.const.MANIFEST1_HASH_FUNCTIONS \
+ if hashname in hashfunc_map)
+ manifest1_hashes.add(portage.const.MANIFEST1_REQUIRED_HASH)
+ manifest1_hashes.add("size")
for cpv in cvp_list:
digest_path = os.path.join("files", "digest-%s" % self._catsplit(cpv)[1])
dname = os.path.join(self.pkgdir, digest_path)
try:
- myhashes = perform_multiple_checksums(dname, portage.const.MANIFEST1_HASH_FUNCTIONS+["size"])
+ myhashes = perform_multiple_checksums(dname, manifest1_hashes)
myhashkeys = myhashes.keys()
myhashkeys.sort()
for h in myhashkeys: