diff options
author | Zac Medico <zmedico@gentoo.org> | 2007-02-23 13:23:22 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2007-02-23 13:23:22 +0000 |
commit | 922e7a0ae7c9d94ed24832ebd6f94153ffe7d66f (patch) | |
tree | cc0422243d9dec9ae19532a1da82b27b03dcc6a0 | |
parent | 1e040841ea6813e1ada22fc4ba795b7468f83879 (diff) | |
download | portage-922e7a0ae7c9d94ed24832ebd6f94153ffe7d66f.tar.gz portage-922e7a0ae7c9d94ed24832ebd6f94153ffe7d66f.tar.bz2 portage-922e7a0ae7c9d94ed24832ebd6f94153ffe7d66f.zip |
Make verify_all() return an "insufficient data" error if there is not at least one supported hash type.
svn path=/main/trunk/; revision=6055
-rw-r--r-- | pym/portage/checksum.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/pym/portage/checksum.py b/pym/portage/checksum.py index 1a96787ec..77c962526 100644 --- a/pym/portage/checksum.py +++ b/pym/portage/checksum.py @@ -3,6 +3,8 @@ # Distributed under the terms of the GNU General Public License v2 # $Id$ +if not hasattr(__builtins__, "set"): + from sets import Set as set from portage.const import PRIVATE_PATH,PRELINK_BINARY,HASHING_BLOCKSIZE import os @@ -113,6 +115,22 @@ def verify_all(filename, mydict, calc_prelink=0, strict=0): if e.errno == errno.ENOENT: raise portage.exception.FileNotFound(filename) return False, (str(e), None, None) + + verifiable_hash_types = set(mydict).intersection(hashfunc_map) + verifiable_hash_types.discard("size") + if not verifiable_hash_types: + expected = set(hashfunc_map) + expected.discard("size") + expected = list(expected) + expected.sort() + expected = " ".join(expected) + got = set(mydict) + got.discard("size") + got = list(got) + got.sort() + got = " ".join(got) + return False, ("Insufficient data for checksum verification", got, expected) + for x in mydict.keys(): if x == "size": continue |