]> git.decadent.org.uk Git - dak.git/blobdiff - dak/process_unchecked.py
merge from flotow
[dak.git] / dak / process_unchecked.py
index bc76fb0bdad66c56184e693f084d6b9647a39745..8a3e49d10d62489a8b968259b0892e40ab29c666 100755 (executable)
@@ -34,23 +34,14 @@ Checks Debian packages from Incoming
 
 ################################################################################
 
-import commands
 import errno
 import fcntl
 import os
-import re
-import shutil
-import stat
 import sys
-import time
 import traceback
-import tarfile
-import apt_inst
 import apt_pkg
-from debian_bundle import deb822
 
 from daklib.dbconn import *
-from daklib.binary import Binary
 from daklib import daklog
 from daklib.queue import *
 from daklib import utils
@@ -111,7 +102,7 @@ def init():
 ################################################################################
 
 def usage (exit_code=0):
-    print """Usage: dinstall [OPTION]... [CHANGES]...
+    print """Usage: dak process-unchecked [OPTION]... [CHANGES]...
   -a, --automatic           automatic run
   -h, --help                show this help and exit.
   -n, --no-action           don't do anything
@@ -123,6 +114,8 @@ def usage (exit_code=0):
 ################################################################################
 
 def action(u):
+    cnf = Config()
+
     # changes["distribution"] may not exist in corner cases
     # (e.g. unreadable changes files)
     if not u.pkg.changes.has_key("distribution") or not isinstance(u.pkg.changes["distribution"], DictType):
@@ -198,10 +191,12 @@ def action(u):
         os.chdir(u.pkg.directory)
         u.do_reject(0, pi)
     elif answer == 'A':
+        u.pkg.add_known_changes( "Accepted" )
         u.accept(summary, short_summary)
         u.check_override()
         u.remove()
     elif answer == queuekey:
+        u.pkg.add_known_changes( qu )
         queue_info[qu]["process"](u, summary, short_summary)
         u.remove()
     elif answer == 'Q':
@@ -222,7 +217,10 @@ def package_to_suite(u, suite):
         q = q.join(DBSource).filter_by(source=u.pkg.changes['source'])
         q = q.filter_by(version=u.pkg.changes['version']).limit(1)
 
-        if q.count() < 1:
+        # NB: Careful, this logic isn't what you would think it is
+        # Source is already in {old-,}proposed-updates so no need to hold
+        # Instead, we don't move to the holding area, we just do an ACCEPT
+        if q.count() > 0:
             ret = False
 
         s.close()
@@ -239,7 +237,7 @@ def package_to_queue(u, summary, short_summary, queue, perms=0660, build=True, a
     u.pkg.write_dot_dak(dir)
     u.move_to_dir(dir, perms=perms)
     if build:
-        get_queue(queue.lower()).autobuild_upload(u.pkg, dir)
+        get_or_set_queue(queue.lower()).autobuild_upload(u.pkg, dir)
 
     # Check for override disparities
     u.check_override()
@@ -425,6 +423,7 @@ def acknowledge_new(u, summary, short_summary):
     if not Options["No-Mail"]:
         print "Sending new ack."
         template = os.path.join(cnf["Dir::Templates"], 'process-unchecked.new')
+        u.update_subst()
         u.Subst["__SUMMARY__"] = summary
         new_ack_message = utils.TemplateSubst(u.Subst, template)
         utils.send_mail(new_ack_message)
@@ -458,7 +457,7 @@ def process_it(changes_file):
     u.pkg.changes["changedby2047"] = cnf["Dinstall::MyEmailAddress"]
 
     # debian-{devel-,}-changes@lists.debian.org toggles writes access based on this header
-    bcc = "X-DAK: dak process-unchecked\nX-Katie: $Revision: 1.65 $"
+    bcc = "X-DAK: dak process-unchecked"
     if cnf.has_key("Dinstall::Bcc"):
         u.Subst["__BCC__"] = bcc + "\nBcc: %s" % (cnf["Dinstall::Bcc"])
     else:
@@ -493,15 +492,16 @@ def process_it(changes_file):
             valid_changes_p = u.load_changes(changespath)
         else:
             valid_changes_p = False
-           u.rejects.extend(rejects)
+            u.rejects.extend(rejects)
 
         if valid_changes_p:
             while u.reprocess:
                 u.check_distributions()
                 u.check_files(not Options["No-Action"])
                 valid_dsc_p = u.check_dsc(not Options["No-Action"])
-                if valid_dsc_p:
+                if valid_dsc_p and not Options["No-Action"]:
                     u.check_source()
+                    u.check_lintian()
                 u.check_hashes()
                 u.check_urgency()
                 u.check_timestamps()
@@ -509,7 +509,7 @@ def process_it(changes_file):
 
         action(u)
 
-    except SystemExit:
+    except (SystemExit, KeyboardInterrupt):
         raise
 
     except: