]> git.decadent.org.uk Git - dak.git/blobdiff - daklib/queue.py
Adapt to changes to Package-List field.
[dak.git] / daklib / queue.py
index 12e027190d32fb61bc98bf2ad2e3fb9c92c8f05e..b7c2249ee3fb0868e8c5ea5fbd1c2c6100b7b1c0 100755 (executable)
@@ -51,7 +51,7 @@ from holding import Holding
 from urgencylog import UrgencyLog
 from dbconn import *
 from summarystats import SummaryStats
-from utils import parse_changes, check_dsc_files, build_package_set
+from utils import parse_changes, check_dsc_files, build_package_list
 from textutils import fix_maintainer
 from lintian import parse_lintian_output, generate_reject_messages
 from contents import UnpackedSource
@@ -133,8 +133,8 @@ def determine_new(filename, changes, files, warn=1, session = None, dsc = None,
 
     # Try to get the Package-Set field from an included .dsc file (if possible).
     if dsc:
-        for package, entry in build_package_set(dsc, session).items():
-            if not new.has_key(package):
+        for package, entry in build_package_list(dsc, session).items():
+            if package not in new:
                 new[package] = entry
 
     # Build up a list of potentially new things
@@ -714,7 +714,7 @@ class Upload(object):
         try:
             control = apt_pkg.ParseSection(apt_inst.debExtractControl(deb_file))
         except:
-            self.rejects.append("%s: debExtractControl() raised %s." % (f, sys.exc_type))
+            self.rejects.append("%s: debExtractControl() raised %s." % (f, sys.exc_info()[0]))
             deb_file.close()
             # Can't continue, none of the checks on control would work.
             return
@@ -1654,7 +1654,7 @@ class Upload(object):
                         self.rejects.append("%s: has %s file(s) with a time stamp too ancient (e.g. %s [%s])."
                                % (filename, num_ancient_files, ancient_file, time.ctime(ancient_date)))
                 except:
-                    self.rejects.append("%s: deb contents timestamp check failed [%s: %s]" % (filename, sys.exc_type, sys.exc_value))
+                    self.rejects.append("%s: deb contents timestamp check failed [%s: %s]" % (filename, sys.exc_info()[0], sys.exc_info()[1]))
 
     def check_if_upload_is_sponsored(self, uid_email, uid_name):
         uid_email = '@'.join(uid_email.split('@')[:2])
@@ -2225,7 +2225,7 @@ distribution."""
                 filename = "%s/%s" % (cnf["Dir::BTSVersionTrack"],
                                       self.pkg.changes_file[:-8]+".versions")
                 os.rename(temp_filename, filename)
-                os.chmod(filename, 0644)
+                os.chmod(filename, 0o644)
 
             # Write out the binary -> source mapping.
             (fd, temp_filename) = utils.temp_filename(cnf["Dir::BTSVersionTrack"], prefix=".")
@@ -2240,7 +2240,7 @@ distribution."""
             filename = "%s/%s" % (cnf["Dir::BTSVersionTrack"],
                                   self.pkg.changes_file[:-8]+".debinfo")
             os.rename(temp_filename, filename)
-            os.chmod(filename, 0644)
+            os.chmod(filename, 0o644)
 
         session.commit()
 
@@ -2342,7 +2342,7 @@ distribution."""
             dest_file = os.path.join(cnf["Dir::Reject"], file_entry)
 
             try:
-                dest_fd = os.open(dest_file, os.O_RDWR | os.O_CREAT | os.O_EXCL, 0644)
+                dest_fd = os.open(dest_file, os.O_RDWR | os.O_CREAT | os.O_EXCL, 0o644)
             except OSError as e:
                 # File exists?  Let's find a new name by adding a number
                 if e.errno == errno.EEXIST:
@@ -2356,7 +2356,7 @@ distribution."""
 
                     # Make sure we really got it
                     try:
-                        dest_fd = os.open(dest_file, os.O_RDWR|os.O_CREAT|os.O_EXCL, 0644)
+                        dest_fd = os.open(dest_file, os.O_RDWR|os.O_CREAT|os.O_EXCL, 0o644)
                     except OSError as e:
                         # Likewise
                         utils.warn("**WARNING** failed to claim %s in the reject directory." % (file_entry))
@@ -2365,7 +2365,7 @@ distribution."""
                     raise
             # If we got here, we own the destination file, so we can
             # safely overwrite it.
-            utils.move(file_entry, dest_file, 1, perms=0660)
+            utils.move(file_entry, dest_file, 1, perms=0o660)
             os.close(dest_fd)
 
     ###########################################################################
@@ -2431,7 +2431,7 @@ distribution."""
         # so let's just raise an exception ...
         if os.path.exists(reason_filename):
             os.unlink(reason_filename)
-        reason_fd = os.open(reason_filename, os.O_RDWR|os.O_CREAT|os.O_EXCL, 0644)
+        reason_fd = os.open(reason_filename, os.O_RDWR|os.O_CREAT|os.O_EXCL, 0o644)
 
         rej_template = os.path.join(cnf["Dir::Templates"], "queue.rejected")