Check and raise an exception when a hash function is missing during digesting.
authorJason Stubbs <jstubbs@gentoo.org>
Fri, 30 Dec 2005 07:19:49 +0000 (07:19 -0000)
committerJason Stubbs <jstubbs@gentoo.org>
Fri, 30 Dec 2005 07:19:49 +0000 (07:19 -0000)
svn path=/main/trunk/; revision=2498

pym/portage.py
pym/portage_checksum.py

index 1254c7d62f0d3bc549ddae2b491b5aab1752ea43..da1b8e7421c00385ad65bc33587b7c45b91e471c 100644 (file)
@@ -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
 
index 9f31e0f6c0ff7912ee79cd5b1e44e81fe618cb7f..0e3706e81fa3afb134a12a2399cf25f4c1a9b35d 100644 (file)
@@ -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