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.

This commit is contained in:
Dave Walker (Daviey) 2011-03-20 13:48:07 +00:00
parent 24a1820266
commit 1787c499ff

View File

@ -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