1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Copyright (C) 2020 Canonical Ltd.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""Close out remaining open bug tasks in Launchpad for an EOL series."""
import argparse
from launchpadlib.launchpad import Launchpad
import sys
CONSUMER_KEY = "close-EOL-bugs"
def close_bugs_for_series(series):
bugs = series.searchTasks(status=('New', 'Confirmed', 'Incomplete',
'Triaged', 'In Progress',
'Fix Committed'),
omit_duplicates=True)
message = ('%s has reached end of life, so this bug will not be fixed'
' for that release' % series.title)
for task in bugs:
print(task.web_link)
task.status = "Won't Fix"
task.bug.newMessage(content=message)
task.lp_save()
def is_series_obsolete(series):
if series.status != 'Obsolete':
return False
return True
if __name__ == '__main__':
parser = argparse.ArgumentParser(
usage="%(prog)s [options] series")
parser.add_argument(
"-l", "--launchpad", dest="launchpad_instance", default="production")
parser.add_argument(
"series",
help="series to act on")
args = parser.parse_args()
launchpad = Launchpad.login_with(
CONSUMER_KEY, args.launchpad_instance, version="devel")
distro = launchpad.distributions["ubuntu"]
series = distro.getSeries(name_or_version=args.series)
if not is_series_obsolete(series):
print("Series %s is not obsolete, aborting." % args.series,
file=sys.stderr)
sys.exit(1)
close_bugs_for_series(series)
|