From 1787c499ffbc462b2e2c7733cf3902465aebbea8 Mon Sep 17 00:00:00 2001 From: "Dave Walker (Daviey)" Date: Sun, 20 Mar 2011 13:48:07 +0000 Subject: [PATCH] Try to find a Ubuntu bug task on the bug, rather than assuming the first one is the one we want. If we fail, revert back to previous behavior. Logic for finding task could be better. hohum. --- ack-sync | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/ack-sync b/ack-sync index c44121d..dffc7e1 100755 --- a/ack-sync +++ b/ack-sync @@ -186,12 +186,23 @@ def ack_sync(bug_numbers, all_package, all_version, all_section, update, print "Taking email address from local file: " + \ uploader_email - task = list(bug.bug_tasks)[0] - + # Try to find a Ubuntu bug task, against which the package is raised. + for t in bug.bug_tasks: + if t.bug_target_name.endswith(' (Ubuntu)'): + task = t + break + try: + print "Using Ubuntu bug task: %s" % task.bug_target_name + except NameError: + # We failed, use the first task (revert to previous behavior) + task = bug.bug_tasks[0] + print ("W: Could not find bug task for a Ubuntu package." + " Using task '%s'" % task.bug_target_name) + if all_package is not None: package = all_package else: - package = task.bug_target_name.split(" ")[0] + package = task.bug_target_name.split(" ") if package == "ubuntu": words = bug.title.split(" ") # no source package was defined. Guessing that the second or