]> git.decadent.org.uk Git - dak.git/blobdiff - dak/check_archive.py
remove backwards-compatiblity stuff which is no longer needed
[dak.git] / dak / check_archive.py
index 896ab1f546d0134eedeae6ce08501c60d3f3e877..2eb450bd434b9e6736da1222f16b967d478da4de 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 
-# Various different sanity checks
+""" Various different sanity checks """
 # Copyright (C) 2000, 2001, 2002, 2003, 2004, 2006  James Troup <james@nocrew.org>
 
 # This program is free software; you can redistribute it and/or modify
@@ -30,6 +30,7 @@ import commands, os, pg, stat, sys, time
 import apt_pkg, apt_inst
 from daklib import database
 from daklib import utils
+from daklib.regexes import re_issource
 
 ################################################################################
 
@@ -217,20 +218,18 @@ def check_checksums():
             utils.warn("**WARNING** md5sum mismatch for '%s' ('%s' [current] vs. '%s' [db])." % (filename, md5sum, db_md5sum))
         if size != db_size:
             utils.warn("**WARNING** size mismatch for '%s' ('%s' [current] vs. '%s' [db])." % (filename, size, db_size))
-        # Until the main database is filled, we need to not spit 500,000 warnings
-        # every time we scan the archive.  Yet another hack (TM) which can go away
-        # once this is all working
-        if db_sha1sum is not None and db_sha1sum != '':
-            f.seek(0)
-            sha1sum = apt_pkg.sha1sum(f)
-            if sha1sum != db_sha1sum:
-                utils.warn("**WARNING** sha1sum mismatch for '%s' ('%s' [current] vs. '%s' [db])." % (filename, sha1sum, db_sha1sum))
 
-        if db_sha256sum is not None and db_sha256sum != '':
-            f.seek(0)
-            sha256sum = apt_pkg.sha256sum(f)
-            if sha256sum != db_sha256sum:
-                utils.warn("**WARNING** sha256sum mismatch for '%s' ('%s' [current] vs. '%s' [db])." % (filename, sha256sum, db_sha256sum))
+        # Check the sha1sum
+        f.seek(0)
+        sha1sum = apt_pkg.sha1sum(f)
+        if sha1sum != db_sha1sum:
+            utils.warn("**WARNING** sha1sum mismatch for '%s' ('%s' [current] vs. '%s' [db])." % (filename, sha1sum, db_sha1sum))
+
+        # Check the sha256sum
+        f.seek(0)
+        sha256sum = apt_pkg.sha256sum(f)
+        if sha256sum != db_sha256sum:
+            utils.warn("**WARNING** sha256sum mismatch for '%s' ('%s' [current] vs. '%s' [db])." % (filename, sha256sum, db_sha256sum))
 
     print "Done."
 
@@ -287,7 +286,7 @@ def check_missing_tar_gz_in_dsc():
         dsc_files = utils.build_file_list(dsc, is_a_dsc=1)
         has_tar = 0
         for f in dsc_files.keys():
-            m = utils.re_issource.match(f)
+            m = re_issource.match(f)
             if not m:
                 utils.fubar("%s not recognised as source." % (f))
             ftype = m.group(3)
@@ -307,7 +306,7 @@ def validate_sources(suite, component):
     filename = "%s/dists/%s/%s/source/Sources.gz" % (Cnf["Dir::Root"], suite, component)
     print "Processing %s..." % (filename)
     # apt_pkg.ParseTagFile needs a real file handle and can't handle a GzipFile instance...
-    temp_filename = utils.temp_filename()
+    (fd, temp_filename) = utils.temp_filename()
     (result, output) = commands.getstatusoutput("gunzip -c %s > %s" % (filename, temp_filename))
     if (result != 0):
         sys.stderr.write("Gunzip invocation failed!\n%s\n" % (output))
@@ -346,7 +345,7 @@ def validate_packages(suite, component, architecture):
                % (Cnf["Dir::Root"], suite, component, architecture)
     print "Processing %s..." % (filename)
     # apt_pkg.ParseTagFile needs a real file handle and can't handle a GzipFile instance...
-    temp_filename = utils.temp_filename()
+    (fd, temp_filename) = utils.temp_filename()
     (result, output) = commands.getstatusoutput("gunzip -c %s > %s" % (filename, temp_filename))
     if (result != 0):
         sys.stderr.write("Gunzip invocation failed!\n%s\n" % (output))