Don't emit invalid extra shift character at block boundary by iconv (bug 17197)
[glibc.git] / scripts / list-fixed-bugs.py
blob37e9a43cc13b52a103b1dac887b23a8fe4ba649e
1 #! /usr/bin/python3
2 # Copyright (C) 2015 Free Software Foundation, Inc.
3 # This file is part of the GNU C Library.
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.
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.
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/>.
19 """List fixed bugs for the NEWS file.
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 """
26 import json
27 import sys
28 import textwrap
29 import urllib.request
31 def list_fixed_bugs(version):
32 """List the bugs fixed in a given version."""
33 url = ('https://sourceware.org/bugzilla/rest.cgi/bug?product=glibc'
34 '&resolution=FIXED&target_milestone=%s'
35 '&include_fields=id,component,summary' % version)
36 response = urllib.request.urlopen(url)
37 json_data = response.read().decode('utf-8')
38 data = json.loads(json_data)
39 for bug in data['bugs']:
40 desc = '[%d] %s: %s' % (bug['id'], bug['component'], bug['summary'])
41 desc = textwrap.fill(desc, width=76, initial_indent=' ',
42 subsequent_indent=' ') + '\n'
43 sys.stdout.buffer.write(desc.encode('utf-8'))
45 if __name__ == '__main__':
46 list_fixed_bugs(sys.argv[1])