3
# Copyright (C) 2017 Canonical Ltd.
4
# Author: Brian Murray <brian.murray@canonical.com>
5
# Author: Lukasz 'sil2100' Zemczak <lukasz.zemczak@canonical.com>
7
# This program is free software: you can redistribute it and/or modify
8
# it under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; version 3 of the License.
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU General Public License for more details.
16
# You should have received a copy of the GNU General Public License
17
# along with this program. If not, see <http://www.gnu.org/licenses/>.
23
def process_bug(launchpad, sourcepkg, version, release, num):
24
bug_target_re = re.compile(
25
r'/ubuntu/(?:(?P<suite>[^/]+)/)?\+source/(?P<source>[^/]+)$')
26
bug = launchpad.bugs[num]
27
sourcepkg_match = False
28
distroseries_match = False
29
for task in bug.bug_tasks:
30
# Ugly; we have to do URL-parsing to figure this out.
31
# /ubuntu/+source/foo can be fed to launchpad.load() to get a
32
# distribution_source_package, but /ubuntu/hardy/+source/foo can't.
33
match = bug_target_re.search(task.target.self_link)
36
match.group('source') != sourcepkg)):
37
print("Ignoring task %s in bug %s" % (task.web_link, num))
39
sourcepkg_match = True
40
if (match.group('suite') == release and
41
task.status not in ("Invalid", "Won't Fix",
43
task.status = "Fix Committed"
45
print("Success: task %s in bug %s" % (task.web_link, num))
46
distroseries_match = True
48
if sourcepkg_match and not distroseries_match:
50
lp_url = launchpad._root_uri
51
series_task_url = '%subuntu/%s/+source/%s' % \
52
(lp_url, release, sourcepkg)
53
sourcepkg_target = launchpad.load(series_task_url)
54
new_task = bug.addTask(target=sourcepkg_target)
55
new_task.status = "Fix Committed"
57
print("LP: #%s added task for %s %s" % (num, sourcepkg, release))
58
if not sourcepkg_match:
59
# warn that the bug has no source package tasks
60
print("LP: #%s has no %s tasks!" % (num, sourcepkg))
62
# XXX: it might be useful if the package signer/sponsor was
63
# subscribed to the bug report
64
bug.subscribe(person=launchpad.people['ubuntu-sru'])
65
bug.subscribe(person=launchpad.people['sru-verification'])
67
# there may be something else to sponsor so just warn
68
subscribers = [sub.person for sub in bug.subscriptions]
69
if launchpad.people['ubuntu-sponsors'] in subscribers:
70
print('ubuntu-sponsors is still subscribed to LP: #%s. '
71
'Is there anything left to sponsor?' % num)
73
if not sourcepkg or 'linux' not in sourcepkg:
74
# this dance is needed due to
75
# https://bugs.launchpad.net/launchpadlib/+bug/254901
77
for t in ('verification-failed', 'verification-failed-%s' % release,
78
'verification-done', 'verification-done-%s' % release):
84
if 'verification-needed' not in btags:
85
btags.append('verification-needed')
88
needed_tag = 'verification-needed-%s' % release
89
if needed_tag not in btags:
90
btags.append(needed_tag)
95
text = ('Hello %s, or anyone else affected,\n\n' %
96
re.split(r'[,\s]', bug.owner.display_name)[0])
99
text += 'Accepted %s into ' % sourcepkg
101
text += 'Accepted into '
102
if sourcepkg and release:
103
text += ('%s-proposed. The package will build now and be available at '
104
'https://launchpad.net/ubuntu/+source/%s/%s in a few hours, '
105
'and then in the -proposed repository.\n\n' % (
106
release, sourcepkg, version))
108
text += ('%s-proposed. The package will build now and be available in '
109
'a few hours in the -proposed repository.\n\n' % (
112
text += ('Please help us by testing this new package. ')
114
if sourcepkg == 'casper':
115
text += ('To properly test it you will need to obtain and boot '
116
'a daily build of a Live CD for %s.' % (release))
118
text += ('See https://wiki.ubuntu.com/Testing/EnableProposed for '
119
'documentation on how to enable and use -proposed.')
121
text += ('Your feedback will aid us getting this update out to other '
122
'Ubuntu users.\n\nIf this package fixes the bug for you, '
123
'please add a comment to this bug, mentioning the version of the '
124
'package you tested and change the tag from '
125
'verification-needed-%s to verification-done-%s. '
126
'If it does not fix the bug for you, please add a comment '
127
'stating that, and change the tag to verification-failed-%s. In '
128
'either case, details of your testing will help us make a better '
129
'decision.\n\nFurther information regarding the verification '
130
'process can be found at '
131
'https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . '
132
'Thank you in advance!' % (release, release, release))
133
bug.newMessage(content=text, subject='Please test proposed package')