- # Check md5sum
- if apt_pkg.md5sum(file_handle) != files[file]["md5sum"]:
- reject("%s: md5sum check failed." % (file))
- file_handle.close()
- # Check size
- actual_size = os.stat(file)[stat.ST_SIZE]
- size = int(files[file]["size"])
- if size != actual_size:
- reject("%s: actual file size (%s) does not match size (%s) in .changes"
- % (file, actual_size, size))
+ if "source" not in changes["architecture"]: continue
+
+ try:
+ fs = daklib.utils.build_file_list(dsc, 1, "checksums-%s" % h, h)
+ check_hash(".dsc %s" % (h), fs, h, f, dsc_files)
+ except daklib.utils.no_files_exc:
+ reject("No Checksums-%s: field in .dsc" % (h))
+ except daklib.utils.changes_parse_error_exc, line:
+ reject("parse error for Checksums-%s in .dsc, can't grok: %s." % (h, line))
+
+################################################################################
+
+def check_hash (where, files, key, testfn, basedict = None):
+ if basedict:
+ for file in basedict.keys():
+ if file not in files:
+ reject("%s: no %s checksum" % (file, key))
+
+ for file in files.keys():
+ if basedict and file not in basedict:
+ reject("%s: extraneous entry in %s checksums" % (file, key))