Merge lp:~vorlon/ubuntu-archive-tools/close-EOL-bugs into lp:ubuntu-archive-tools

Proposed by Steve Langasek
Status: Merged
Merged at revision: 1342
Proposed branch: lp:~vorlon/ubuntu-archive-tools/close-EOL-bugs
Merge into: lp:ubuntu-archive-tools
Diff against target: 70 lines (+66/-0)
1 file modified
close-EOL-bugs (+66/-0)
To merge this branch: bzr merge lp:~vorlon/ubuntu-archive-tools/close-EOL-bugs
Reviewer Review Type Date Requested Status
Brian Murray Approve
Ubuntu Package Archive Administrators Pending
Review via email: mp+386770@code.launchpad.net
To post a comment you must log in.
1343. By Steve Langasek

don't bother closing bugs that are marked as duplicates

1344. By Steve Langasek

Include a message on the bug when closing

1345. By Steve Langasek

Spell out EOL in the bug comment

Revision history for this message
Brian Murray (brian-murray) wrote :

One more comment but its not important.

review: Approve

Preview Diff

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

Subscribers

People subscribed via source and target branches