245
246
subject='Proposed package upload rejected')
248
def process_bug(launchpad, upload, num):
249
bug_target_re = re.compile(
250
r'/ubuntu/(?:(?P<suite>[^/]+)/)?\+source/(?P<source>[^/]+)$')
251
bug = launchpad.bugs[num]
252
sourcepkg = upload.package_name
253
release = upload.distroseries.name
254
sourcepkg_match = False
255
distroseries_match = False
256
for task in bug.bug_tasks:
257
# Ugly; we have to do URL-parsing to figure this out.
258
# /ubuntu/+source/foo can be fed to launchpad.load() to get a
259
# distribution_source_package, but /ubuntu/hardy/+source/foo can't.
260
match = bug_target_re.search(task.target.self_link)
263
match.group('source') != sourcepkg)):
264
print("Ignoring task %s in bug %s" % (task.web_link, num))
266
sourcepkg_match = True
267
if (match.group('suite') == release and
268
task.status not in ("Invalid", "Won't Fix",
270
task.status = "Fix Committed"
272
print("Success: task %s in bug %s" % (task.web_link, num))
273
distroseries_match = True
275
if sourcepkg_match and not distroseries_match:
277
lp_url = launchpad._root_uri
278
series_task_url = '%subuntu/%s/+source/%s' % \
279
(lp_url, release, sourcepkg)
280
sourcepkg_target = launchpad.load(series_task_url)
281
new_task = bug.addTask(target=sourcepkg_target)
282
new_task.status = "Fix Committed"
284
print("LP: #%s added task for %s %s" % (num, sourcepkg, release))
285
if not sourcepkg_match:
286
# warn that the bug has no source package tasks
287
print("LP: #%s has no %s tasks!" % (num, sourcepkg))
289
# XXX: it might be useful if the package signer/sponsor was
290
# subscribed to the bug report
291
bug.subscribe(person=launchpad.people['ubuntu-sru'])
292
bug.subscribe(person=launchpad.people['sru-verification'])
294
# there may be something else to sponsor so just warn
295
subscribers = [sub.person for sub in bug.subscriptions]
296
if launchpad.people['ubuntu-sponsors'] in subscribers:
297
print('ubuntu-sponsors is still subscribed to LP: #%s. '
298
'Is there anything left to sponsor?' % num)
300
if not sourcepkg or 'linux' not in sourcepkg:
301
# this dance is needed due to
302
# https://bugs.launchpad.net/launchpadlib/+bug/254901
304
for t in ('verification-failed', 'verification-failed-%s' % release,
305
'verification-done', 'verification-done-%s' % release):
311
if 'verification-needed' not in btags:
312
btags.append('verification-needed')
315
needed_tag = 'verification-needed-%s' % release
316
if needed_tag not in btags:
317
btags.append(needed_tag)
323
text = ('Hello %s, or anyone else affected,\n\n' %
324
re.split(r'[,\s]', bug.owner.display_name)[0])
327
text += 'Accepted %s into ' % sourcepkg
329
text += 'Accepted into '
330
if sourcepkg and release:
331
text += ('%s-proposed. The package will build now and be available at '
332
'https://launchpad.net/ubuntu/+source/%s/%s in a few hours, '
333
'and then in the -proposed repository.\n\n' % (
334
release, sourcepkg, upload.package_version))
336
text += ('%s-proposed. The package will build now and be available in '
337
'a few hours in the -proposed repository.\n\n' % (
340
text += ('Please help us by testing this new package. ')
342
if sourcepkg == 'casper':
343
text += ('To properly test it you will need to obtain and boot '
344
'a daily build of a Live CD for %s.' % (release))
346
text += ('See https://wiki.ubuntu.com/Testing/EnableProposed for '
347
'documentation on how to enable and use -proposed.')
349
text += ('Your feedback will aid us getting this update out to other '
350
'Ubuntu users.\n\nIf this package fixes the bug for you, '
351
'please add a comment to this bug, mentioning the version of the '
352
'package you tested and change the tag from '
353
'verification-needed-%s to verification-done-%s. '
354
'If it does not fix the bug for you, please add a comment '
355
'stating that, and change the tag to verification-failed-%s. In '
356
'either case, details of your testing will help us make a better '
357
'decision.\n\nFurther information regarding the verification '
358
'process can be found at '
359
'https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . '
360
'Thank you in advance!' % (release, release, release))
361
bug.newMessage(content=text, subject='Please test proposed package')
364
249
if __name__ == '__main__':
366
251
default_release = 'artful'