From: Ansgar Burchardt Date: Sun, 12 Aug 2012 14:22:52 +0000 (+0200) Subject: send announcement only for sourceful uploads X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=c575bba437ec1de5ceb5feb6dc9c5f87d843958e;p=dak.git send announcement only for sourceful uploads --- diff --git a/dak/process_policy.py b/dak/process_policy.py index 98c4c298..5992cdd5 100755 --- a/dak/process_policy.py +++ b/dak/process_policy.py @@ -156,14 +156,15 @@ def comment_accept(upload, srcqueue, comments, transaction): Logger.log(["Policy Queue ACCEPT", srcqueue.queue_name, changesname]) # Send announcement - subst = subst_for_upload(upload) - announce = ", ".join(upload.target_suite.announce or []) - tracking = cnf.get('Dinstall::TrackingServer') - if tracking and upload.source is not None: - announce = '{0}\nBcc: {1}@{2}'.format(announce, upload.changes.source, tracking) - subst['__ANNOUNCE_LIST_ADDRESS__'] = announce - message = utils.TemplateSubst(subst, os.path.join(cnf['Dir::Templates'], 'process-unchecked.announce')) - utils.send_mail(message) + if upload.source is not None: + subst = subst_for_upload(upload) + announce = ", ".join(upload.target_suite.announce or []) + tracking = cnf.get('Dinstall::TrackingServer') + if tracking and upload.source is not None: + announce = '{0}\nBcc: {1}@{2}'.format(announce, upload.changes.source, tracking) + subst['__ANNOUNCE_LIST_ADDRESS__'] = announce + message = utils.TemplateSubst(subst, os.path.join(cnf['Dir::Templates'], 'process-unchecked.announce')) + utils.send_mail(message) # TODO: code duplication. Similar code is in process-upload. if cnf.find_b('Dinstall::CloseBugs') and upload.changes.closes is not None and upload.source is not None: diff --git a/dak/process_upload.py b/dak/process_upload.py index 23a20364..93d30f85 100755 --- a/dak/process_upload.py +++ b/dak/process_upload.py @@ -290,8 +290,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 +305,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 +326,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)