diff options
author | Martin Liska <mliska@suse.cz> | 2020-05-19 21:16:27 +0200 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2020-05-19 21:17:09 +0200 |
commit | 25c284f14881eeb68b9ddf16c6760b9535d824a8 (patch) | |
tree | 74cf4812dec2210ae6d03d8dbfbf80514bfb4e1a | |
parent | 4a5d072ad97d7d4fd003efff953a6202afd176a0 (diff) | |
download | gcc-25c284f14881eeb68b9ddf16c6760b9535d824a8.zip gcc-25c284f14881eeb68b9ddf16c6760b9535d824a8.tar.gz gcc-25c284f14881eeb68b9ddf16c6760b9535d824a8.tar.bz2 |
Use REST API for bug titles in mklog.
* mklog.py: Use REST API for bug title downloading.
-rw-r--r-- | contrib/ChangeLog | 4 | ||||
-rwxr-xr-x | contrib/mklog.py | 20 |
2 files changed, 13 insertions, 11 deletions
diff --git a/contrib/ChangeLog b/contrib/ChangeLog index f3de87b..d9632fb 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,5 +1,9 @@ 2020-05-19 Martin Liska <mliska@suse.cz> + * mklog.py: Use REST API for bug title downloading. + +2020-05-19 Martin Liska <mliska@suse.cz> + * gcc-changelog/git_commit.py: Add param use_commit_ts for to_changelog_entries. * gcc-changelog/git_update_version.py: Se use_commit_ts to True. diff --git a/contrib/mklog.py b/contrib/mklog.py index 45559af..b27fad0 100755 --- a/contrib/mklog.py +++ b/contrib/mklog.py @@ -31,8 +31,6 @@ import os import re import sys -import bs4 - import requests from unidiff import PatchSet @@ -46,6 +44,8 @@ macro_regex = re.compile(r'#\s*(define|undef)\s+([a-zA-Z0-9_]+)') super_macro_regex = re.compile(r'^DEF[A-Z0-9_]+\s*\(([a-zA-Z0-9_]+)') fn_regex = re.compile(r'([a-zA-Z_][^()\s]*)\s*\([^*]') template_and_param_regex = re.compile(r'<[^<>]*>') +bugzilla_url = 'https://gcc.gnu.org/bugzilla/rest.cgi/bug?id=%s&' \ + 'include_fields=summary' function_extensions = set(['.c', '.cpp', '.C', '.cc', '.h', '.inc', '.def']) @@ -106,18 +106,16 @@ def sort_changelog_files(changed_file): def get_pr_titles(prs): - if not prs: - return '' - output = '' for pr in prs: id = pr.split('/')[-1] - r = requests.get('https://gcc.gnu.org/PR%s' % id) - html = bs4.BeautifulSoup(r.text, features='lxml') - title = html.title.text - title = title[title.find('–') + 1:].strip() - output += '%s - %s\n' % (pr, title) - output += '\n' + r = requests.get(bugzilla_url % id) + bugs = r.json()['bugs'] + if len(bugs) == 1: + output += '%s - %s\n' % (pr, bugs[0]['summary']) + print(output) + if output: + output += '\n' return output |