diff options
author | Jason Stubbs <jstubbs@gentoo.org> | 2005-12-30 07:19:49 +0000 |
---|---|---|
committer | Jason Stubbs <jstubbs@gentoo.org> | 2005-12-30 07:19:49 +0000 |
commit | c86a5f1dc7fdd9c1c177e07d66c449f628756f22 (patch) | |
tree | 6e65f89c1fc465cc2af5df45575eb8216c5a7cbf | |
parent | 066f60343f2abfbdf3eee0ed3fab2aea5e1ff977 (diff) | |
download | portage-c86a5f1dc7fdd9c1c177e07d66c449f628756f22.tar.gz portage-c86a5f1dc7fdd9c1c177e07d66c449f628756f22.tar.bz2 portage-c86a5f1dc7fdd9c1c177e07d66c449f628756f22.zip |
Check and raise an exception when a hash function is missing during digesting.
svn path=/main/trunk/; revision=2498
-rw-r--r-- | pym/portage.py | 6 | ||||
-rw-r--r-- | pym/portage_checksum.py | 3 |
2 files changed, 8 insertions, 1 deletions
diff --git a/pym/portage.py b/pym/portage.py index 1254c7d62..da1b8e742 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -2148,7 +2148,11 @@ def digestgen(myarchives,mysettings,overwrite=1,manifestonly=0): myolddigest = digestParseFile(digestfn) myarchives.sort() - mydigests=digestCreate(myarchives, basedir, oldDigest=myolddigest) + try: + mydigests=digestCreate(myarchives, basedir, oldDigest=myolddigest) + except portage_exception.DigestException, s: + print "!!!",s + return 0 if mydigests==None: # There was a problem, exit with an errorcode. return 0 diff --git a/pym/portage_checksum.py b/pym/portage_checksum.py index 9f31e0f6c..0e3706e81 100644 --- a/pym/portage_checksum.py +++ b/pym/portage_checksum.py @@ -8,6 +8,7 @@ from portage_const import PRIVATE_PATH,PRELINK_BINARY,HASHING_BLOCKSIZE import os import shutil import stat +import portage_exception import portage_exec import portage_util import portage_locks @@ -142,5 +143,7 @@ def perform_checksum(filename, hash_function=md5hash, calc_prelink=0): def perform_multiple_checksums(filename, hashes=["MD5"], calc_prelink=0): rVal = {} for x in hashes: + if x not in hashfunc_map: + raise portage_exception.DigestException, x+" hash function not available" rVal[x] = perform_checksum(filename, hashfunc_map[x], calc_prelink)[0] return rVal |