From 291a20c45283cbd70b3d88d4775bdb7ca76f6697 Mon Sep 17 00:00:00 2001 From: Ansgar Burchardt Date: Wed, 15 Aug 2012 22:01:36 +0200 Subject: [PATCH] dak/process_policy.py, daklib/announce.py: fix bugs in new announce code --- dak/process_policy.py | 2 +- daklib/announce.py | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/dak/process_policy.py b/dak/process_policy.py index 3bde7252..30e10c4d 100755 --- a/dak/process_policy.py +++ b/dak/process_policy.py @@ -157,7 +157,7 @@ def comment_accept(upload, srcqueue, comments, transaction): Logger.log(["Policy Queue ACCEPT", srcqueue.queue_name, changesname]) pu = get_processed_upload(upload) - daklib.announce.announce_accept(upload) + daklib.announce.announce_accept(pu) # TODO: code duplication. Similar code is in process-upload. # Move .changes to done diff --git a/daklib/announce.py b/daklib/announce.py index 6ab4b005..51a07d90 100644 --- a/daklib/announce.py +++ b/daklib/announce.py @@ -125,18 +125,24 @@ def announce_accept(upload): if accepted_to_real_suite and upload.sourceful: # senf mail to announce lists and tracking server - announce = set(suite.announce or [] for suite in upload.suites if suite.policy_queue is None) + announce = set() + for suite in upload.suites: + if suite.policy_queue is None: + continue + announce.update(suite.announce or []) + announce_list_address = ", ".join(announce) tracking = cnf.get('Dinstall::TrackingServer') if tracking: announce_list_address = "{0}\n{1}@{2}".format(announce_list_address, upload.source, tracking) - my_subst = subst.copy() - my_subst['__ANNOUNCE_LIST_ADDRESS__'] = announce_list_address + if len(announce_list_address) != 0: + my_subst = subst.copy() + my_subst['__ANNOUNCE_LIST_ADDRESS__'] = announce_list_address - message = TemplateSubst(my_subst, os.path.join(cnf['Dir::Templates'], 'process-unchecked.announce')) - utils.send_mail(message) + message = TemplateSubst(my_subst, os.path.join(cnf['Dir::Templates'], 'process-unchecked.announce')) + send_mail(message) if accepted_to_real_suite and upload.sourceful and cnf.find_b('Dinstall::CloseBugs'): for bug in upload.bugs: -- 2.39.5