]> git.decadent.org.uk Git - dak.git/blobdiff - dak/process_upload.py
daklib/utils.py (gpg_get_key_addresses): prefer @debian.org addresses
[dak.git] / dak / process_upload.py
index 23a2036407b1c30c410e85f8b0ff481fb0054d50..f070566775a720d8a76cf008c1032af84a373349 100755 (executable)
@@ -245,6 +245,7 @@ def subst_for_upload(upload):
     else:
         addresses = utils.mail_addresses_for_upload(maintainer_field, maintainer_field, changes.primary_fingerprint)
 
+    # debian-{devel-,}-changes@lists.debian.org toggles writes access based on this header
     bcc = 'X-DAK: dak process-upload'
     if 'Dinstall::Bcc' in cnf:
         bcc = '{0}\nBcc: {1}'.format(bcc, cnf['Dinstall::Bcc'])
@@ -290,8 +291,10 @@ def accept(directory, upload):
     for suite in upload.final_suites:
         accepted_to_real_suite = accepted_to_real_suite or suite.policy_queue is None
 
+    sourceful_upload = 'source' in upload.changes.architectures
+
     control = upload.changes.changes
-    if 'source' in upload.changes.architectures and not Options['No-Action']:
+    if sourceful_upload and not Options['No-Action']:
         urgency = control.get('Urgency')
         if urgency not in cnf.value_list('Urgency::Valid'):
             urgency = cnf['Urgency::Default']
@@ -303,7 +306,7 @@ def accept(directory, upload):
     utils.send_mail(message)
 
     # send mail to announce lists and tracking server
-    if  accepted_to_real_suite:
+    if accepted_to_real_suite and sourceful_upload:
         subst = subst_for_upload(upload)
         announce = set()
         for suite in upload.final_suites:
@@ -324,7 +327,7 @@ def accept(directory, upload):
     # Only close bugs for uploads that were not redirected to a policy queue.
     # process-policy will close bugs for those once they are accepted.
     subst = subst_for_upload(upload)
-    if accepted_to_real_suite and cnf.find_b('Dinstall::CloseBugs') and upload.changes.source is not None:
+    if accepted_to_real_suite and cnf.find_b('Dinstall::CloseBugs') and sourceful_upload:
         for bugnum in upload.changes.closed_bugs:
             subst['__BUG_NUMBER__'] = str(bugnum)
 
@@ -355,7 +358,7 @@ def accept_to_new(directory, upload):
     Logger.log(['ACCEPT-TO-NEW', upload.changes.filename])
 
     upload.install_to_new()
-    # TODO: tag bugs pending, send announcement
+    # TODO: tag bugs pending
 
     subst = subst_for_upload(upload)
     message = utils.TemplateSubst(subst, os.path.join(cnf['Dir::Templates'], 'process-unchecked.new'))
@@ -400,7 +403,6 @@ def real_reject(directory, upload, reason=None, notify=True):
     fh.write(reason)
     fh.close()
 
-    # TODO: fix
     if notify:
         subst = subst_for_upload(upload)
         subst['__REJECTOR_ADDRESS__'] = cnf['Dinstall::MyEmailAddress']
@@ -496,7 +498,6 @@ def action(directory, upload):
     elif answer == 'S':
         processed = False
 
-    #raise Exception("FAIL")
     if not Options['No-Action']:
         upload.commit()
 
@@ -517,19 +518,6 @@ def process_it(directory, changes, keyrings, session):
     print "\n{0}\n".format(changes.filename)
     Logger.log(["Processing changes file", changes.filename])
 
-    cnf = Config()
-
-    # Some defaults in case we can't fully process the .changes file
-    #u.pkg.changes["maintainer2047"] = cnf["Dinstall::MyEmailAddress"]
-    #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-upload"
-    #if cnf.has_key("Dinstall::Bcc"):
-    #    u.Subst["__BCC__"] = bcc + "\nBcc: %s" % (cnf["Dinstall::Bcc"])
-    #else:
-    #    u.Subst["__BCC__"] = bcc
-
     with daklib.archive.ArchiveUpload(directory, changes, keyrings) as upload:
         processed = action(directory, upload)
         if processed and not Options['No-Action']: