summaryrefslogtreecommitdiffstats
path: root/pym/portage_checksum.py
diff options
context:
space:
mode:
authorMarius Mauch <genone@gentoo.org>2005-12-19 23:58:17 +0000
committerMarius Mauch <genone@gentoo.org>2005-12-19 23:58:17 +0000
commit9761fe7db6fcf0c15ff9b740d6d1ca57b46a2896 (patch)
treef18f91c662470e3175e5e2dcd1caee88836a33e4 /pym/portage_checksum.py
parentcd3e3775966a9f58aebb91f58cbdb5903faad3de (diff)
downloadportage-9761fe7db6fcf0c15ff9b740d6d1ca57b46a2896.tar.gz
portage-9761fe7db6fcf0c15ff9b740d6d1ca57b46a2896.tar.bz2
portage-9761fe7db6fcf0c15ff9b740d6d1ca57b46a2896.zip
Make digest errors more verbose
svn path=/main/trunk/; revision=2412
Diffstat (limited to 'pym/portage_checksum.py')
-rw-r--r--pym/portage_checksum.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/pym/portage_checksum.py b/pym/portage_checksum.py
index 5625f2322..9f31e0f6c 100644
--- a/pym/portage_checksum.py
+++ b/pym/portage_checksum.py
@@ -83,20 +83,22 @@ def verify_all(filename, mydict, calc_prelink=0, strict=0):
file_is_ok = True
reason = "Reason unknown"
try:
- if mydict["size"] != os.stat(filename)[stat.ST_SIZE]:
- return False,"Filesize does not match recorded size"
+ mysize = os.stat(filename)[stat.ST_SIZE]
+ if mydict["size"] != mysize:
+ return False,("Filesize does not match recorded size", mysize, mydict["size"])
except OSError, e:
return False, str(e)
for x in mydict.keys():
if x == "size":
continue
elif x in hashfunc_map.keys():
- if mydict[x] != perform_checksum(filename, hashfunc_map[x], calc_prelink=calc_prelink)[0]:
+ myhash = perform_checksum(filename, hashfunc_map[x], calc_prelink=calc_prelink)[0]
+ if mydict[x] != myhash:
if strict:
raise portage_exception.DigestException, "Failed to verify '$(file)s' on checksum type '%(type)s'" % {"file":filename, "type":x}
else:
file_is_ok = False
- reason = "Failed on %s verification" % (x,)
+ reason = (("Failed on %s verification" % x), myhash,mydict[x])
break
return file_is_ok,reason