]> git.decadent.org.uk Git - dak.git/blobdiff - daklib/utils.py
do not check for superfluous checksums-* entries for now
[dak.git] / daklib / utils.py
index 8e06cf35cc6dbbc795b008865c64991b2d9dbfc3..86e51a2f5c852f5b8c53b42741db14fcb96265ef 100755 (executable)
@@ -252,22 +252,23 @@ def check_hash(where, files, hashname, hashfunc):
     for f in files.keys():
         file_handle = None
         try:
-            file_handle = open_file(f)
-
-            # Check for the hash entry, to not trigger a KeyError.
-            if not files[f].has_key(hash_key(hashname)):
-                rejmsg.append("%s: misses %s checksum in %s" % (f, hashname,
-                    where))
+            try:
+                file_handle = open_file(f)
+    
+                # Check for the hash entry, to not trigger a KeyError.
+                if not files[f].has_key(hash_key(hashname)):
+                    rejmsg.append("%s: misses %s checksum in %s" % (f, hashname,
+                        where))
+                    continue
+    
+                # Actually check the hash for correctness.
+                if hashfunc(file_handle) != files[f][hash_key(hashname)]:
+                    rejmsg.append("%s: %s check failed in %s" % (f, hashname,
+                        where))
+            except CantOpenError:
+                # TODO: This happens when the file is in the pool.
+                # warn("Cannot open file %s" % f)
                 continue
-
-            # Actually check the hash for correctness.
-            if hashfunc(file_handle) != files[f][hash_key(hashname)]:
-                rejmsg.append("%s: %s check failed in %s" % (f, hashname,
-                    where))
-        except CantOpenError:
-            # TODO: This happens when the file is in the pool.
-            warn("Cannot open file %s" % f)
-            continue
         finally:
             if file_handle:
                 file_handle.close()
@@ -393,12 +394,15 @@ def parse_checksums(where, files, manifest, hashname):
         if not line:
             break
         hash, size, file = line.strip().split(' ')
-        if not files.has_key(file):
-            rejmsg.append("%s: not present in files but in checksums-%s in %s" %
-                (file, hashname, where))
+        # TODO: check for the file's entry in the original files dict, not
+        # the one modified by (auto)byhand and other weird stuff
+        #if not files.has_key(file):
+        #    rejmsg.append("%s: not present in files but in checksums-%s in %s" %
+        #        (file, hashname, where))
         if not files[file]["size"] == size:
             rejmsg.append("%s: size differs for files and checksums-%s entry "\
                 "in %s" % (file, hashname, where))
+            continue
         files[file][hash_key(hashname)] = hash
     for f in files.keys():
         if not files[f].has_key(hash_key(hashname)):