]>
Commit | Line | Data |
---|---|---|
48d0341c | 1 | #!/usr/bin/python3 |
bfff8b1b | 2 | # Copyright (C) 2015-2017 Free Software Foundation, Inc. |
f268ab5f JM |
3 | # This file is part of the GNU C Library. |
4 | # | |
5 | # The GNU C Library is free software; you can redistribute it and/or | |
6 | # modify it under the terms of the GNU Lesser General Public | |
7 | # License as published by the Free Software Foundation; either | |
8 | # version 2.1 of the License, or (at your option) any later version. | |
9 | # | |
10 | # The GNU C Library is distributed in the hope that it will be useful, | |
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | # Lesser General Public License for more details. | |
14 | # | |
15 | # You should have received a copy of the GNU Lesser General Public | |
16 | # License along with the GNU C Library; if not, see | |
17 | # <http://www.gnu.org/licenses/>. | |
18 | ||
19 | """List fixed bugs for the NEWS file. | |
20 | ||
21 | This script takes a version number as input and generates a list of | |
22 | bugs marked as FIXED with that milestone, to be added to the NEWS file | |
23 | just before release. The output is in UTF-8. | |
24 | """ | |
25 | ||
d108b755 | 26 | import argparse |
f268ab5f JM |
27 | import json |
28 | import sys | |
29 | import textwrap | |
30 | import urllib.request | |
31 | ||
d108b755 MF |
32 | |
33 | def get_parser(): | |
34 | """Return an argument parser for this module.""" | |
35 | parser = argparse.ArgumentParser(description=__doc__) | |
36 | parser.add_argument('version', | |
37 | help='Release version to look up') | |
38 | return parser | |
39 | ||
40 | ||
f268ab5f JM |
41 | def list_fixed_bugs(version): |
42 | """List the bugs fixed in a given version.""" | |
43 | url = ('https://sourceware.org/bugzilla/rest.cgi/bug?product=glibc' | |
44 | '&resolution=FIXED&target_milestone=%s' | |
45 | '&include_fields=id,component,summary' % version) | |
46 | response = urllib.request.urlopen(url) | |
47 | json_data = response.read().decode('utf-8') | |
48 | data = json.loads(json_data) | |
49 | for bug in data['bugs']: | |
50 | desc = '[%d] %s: %s' % (bug['id'], bug['component'], bug['summary']) | |
51 | desc = textwrap.fill(desc, width=76, initial_indent=' ', | |
52 | subsequent_indent=' ') + '\n' | |
53 | sys.stdout.buffer.write(desc.encode('utf-8')) | |
54 | ||
d108b755 MF |
55 | |
56 | def main(argv): | |
57 | """The main entry point.""" | |
58 | parser = get_parser() | |
59 | opts = parser.parse_args(argv) | |
60 | list_fixed_bugs(opts.version) | |
61 | ||
62 | ||
f268ab5f | 63 | if __name__ == '__main__': |
d108b755 | 64 | main(sys.argv[1:]) |