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