[v3,0/7] Fix some libm static issues
[platform/upstream/glibc.git] / scripts / list-fixed-bugs.py
1 #!/usr/bin/python3
2 # Copyright (C) 2015-2024 Free Software Foundation, Inc.
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 # <https://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
26 import argparse
27 import json
28 import sys
29 import textwrap
30 import urllib.request
31
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
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=72, initial_indent='  ',
52                              subsequent_indent='    ') + '\n'
53         sys.stdout.buffer.write(desc.encode('utf-8'))
54
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
63 if __name__ == '__main__':
64     main(sys.argv[1:])