|
Packit |
6c4009 |
#!/usr/bin/python3
|
|
Packit |
6c4009 |
# Copyright (C) 2015-2018 Free Software Foundation, Inc.
|
|
Packit |
6c4009 |
# This file is part of the GNU C Library.
|
|
Packit |
6c4009 |
#
|
|
Packit |
6c4009 |
# The GNU C Library is free software; you can redistribute it and/or
|
|
Packit |
6c4009 |
# modify it under the terms of the GNU Lesser General Public
|
|
Packit |
6c4009 |
# License as published by the Free Software Foundation; either
|
|
Packit |
6c4009 |
# version 2.1 of the License, or (at your option) any later version.
|
|
Packit |
6c4009 |
#
|
|
Packit |
6c4009 |
# The GNU C Library is distributed in the hope that it will be useful,
|
|
Packit |
6c4009 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
6c4009 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
6c4009 |
# Lesser General Public License for more details.
|
|
Packit |
6c4009 |
#
|
|
Packit |
6c4009 |
# You should have received a copy of the GNU Lesser General Public
|
|
Packit |
6c4009 |
# License along with the GNU C Library; if not, see
|
|
Packit |
6c4009 |
# <http://www.gnu.org/licenses/>.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
"""List fixed bugs for the NEWS file.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
This script takes a version number as input and generates a list of
|
|
Packit |
6c4009 |
bugs marked as FIXED with that milestone, to be added to the NEWS file
|
|
Packit |
6c4009 |
just before release. The output is in UTF-8.
|
|
Packit |
6c4009 |
"""
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
import argparse
|
|
Packit |
6c4009 |
import json
|
|
Packit |
6c4009 |
import sys
|
|
Packit |
6c4009 |
import textwrap
|
|
Packit |
6c4009 |
import urllib.request
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
def get_parser():
|
|
Packit |
6c4009 |
"""Return an argument parser for this module."""
|
|
Packit |
6c4009 |
parser = argparse.ArgumentParser(description=__doc__)
|
|
Packit |
6c4009 |
parser.add_argument('version',
|
|
Packit |
6c4009 |
help='Release version to look up')
|
|
Packit |
6c4009 |
return parser
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
def list_fixed_bugs(version):
|
|
Packit |
6c4009 |
"""List the bugs fixed in a given version."""
|
|
Packit |
6c4009 |
url = ('https://sourceware.org/bugzilla/rest.cgi/bug?product=glibc'
|
|
Packit |
6c4009 |
'&resolution=FIXED&target_milestone=%s'
|
|
Packit |
6c4009 |
'&include_fields=id,component,summary' % version)
|
|
Packit |
6c4009 |
response = urllib.request.urlopen(url)
|
|
Packit |
6c4009 |
json_data = response.read().decode('utf-8')
|
|
Packit |
6c4009 |
data = json.loads(json_data)
|
|
Packit |
6c4009 |
for bug in data['bugs']:
|
|
Packit |
6c4009 |
desc = '[%d] %s: %s' % (bug['id'], bug['component'], bug['summary'])
|
|
Packit |
6c4009 |
desc = textwrap.fill(desc, width=76, initial_indent=' ',
|
|
Packit |
6c4009 |
subsequent_indent=' ') + '\n'
|
|
Packit |
6c4009 |
sys.stdout.buffer.write(desc.encode('utf-8'))
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
def main(argv):
|
|
Packit |
6c4009 |
"""The main entry point."""
|
|
Packit |
6c4009 |
parser = get_parser()
|
|
Packit |
6c4009 |
opts = parser.parse_args(argv)
|
|
Packit |
6c4009 |
list_fixed_bugs(opts.version)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
if __name__ == '__main__':
|
|
Packit |
6c4009 |
main(sys.argv[1:])
|