From patchwork Fri May 29 11:22:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 1300644 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.cz Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49YMcg3Tw2z9sSx for ; Fri, 29 May 2020 21:22:58 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D31613984006; Fri, 29 May 2020 11:22:55 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id 6AD183984006 for ; Fri, 29 May 2020 11:22:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 6AD183984006 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mliska@suse.cz X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 31CC4AE68 for ; Fri, 29 May 2020 11:22:52 +0000 (UTC) From: =?utf-8?q?Martin_Li=C5=A1ka?= Subject: [PATCH] Port bugzilla-close-candidate script to git. To: gcc-patches@gcc.gnu.org Message-ID: Date: Fri, 29 May 2020 13:22:51 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 Content-Language: en-US X-Spam-Status: No, score=-15.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_SHORT, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP, T_FILL_THIS_FORM_SHORT autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Tested and pushed to master. Martin maintainer-scripts/ChangeLog: * bugzilla-close-candidate.py: Support both SVN and GIT messages in PRs. Remove need of usage of the bugzilla API key. --- .../bugzilla-close-candidate.py | 50 +++++++++++-------- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/maintainer-scripts/bugzilla-close-candidate.py b/maintainer-scripts/bugzilla-close-candidate.py index 26ee84474a0..dfd67ac1cbb 100755 --- a/maintainer-scripts/bugzilla-close-candidate.py +++ b/maintainer-scripts/bugzilla-close-candidate.py @@ -1,19 +1,19 @@ #!/usr/bin/env python3 -# The script is used for finding PRs that have a SVN revision that +# The script is used for finding PRs that have a GIT revision that # mentiones the PR and are not closed. It's done by iterating all -# comments of a PR and finding SVN commit entries. +# comments of a PR and finding GIT commit entries. """ Sample output of the script: Bugzilla URL page size: 50 HINT: bugs with following comment are ignored: Can the bug be marked as resolved? -Bug URL SVN commits known-to-fail known-to-work Bug summary -https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88129 trunk Two blockage insns are emited in the function epilogue -https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88122 trunk [9 Regression] g++ ICE: internal compiler error: Segmentation fault -https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88084 trunk basic_string_view::copy doesn't use Traits::copy -https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88083 trunk ICE in find_constant_pool_ref_1, at config/s390/s390.c:8231 +Bug URL GIT commits known-to-fail known-to-work Bug summary +https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88129 master Two blockage insns are emited in the function epilogue +https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88122 master [9 Regression] g++ ICE: internal compiler error: Segmentation fault +https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88084 master basic_string_view::copy doesn't use Traits::copy +https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88083 master ICE in find_constant_pool_ref_1, at config/s390/s390.c:8231 ... Bugzilla lists: https://gcc.gnu.org/bugzilla/buglist.cgi?bug_id=88129,88122,88084,88083,88074,88073,88071,88070,88051,88018,87985,87955,87926,87917,87913,87898,87895,87874,87871,87855,87853,87826,87824,87819,87818,87799,87793,87789,87788,87787,87754,87725,87674,87665,87649,87647,87645,87625,87611,87610,87598,87593,87582,87566,87556,87547,87544,87541,87537,87528 @@ -36,29 +36,38 @@ def get_branches_by_comments(comments): versions = set() for c in comments: text = c['text'] - if 'URL: https://gcc.gnu.org/viewcvs' in text: - version = 'trunk' - for l in text.split('\n'): - if 'branches/gcc-' in l: - parts = l.strip().split('/') + lines = text.split('\n') + for line in lines: + if 'URL: https://gcc.gnu.org/viewcvs' in line: + version = 'master' + if 'branches/gcc-' in line: + parts = line.strip().split('/') parts = parts[1].split('-') assert len(parts) == 3 versions.add(parts[1]) - versions.add(version) + versions.add(version) + elif line.startswith('The ') and 'branch has been updated' in line: + version = 'master' + name = line.strip().split(' ')[1] + if '/' in name: + name = name.split('/')[1] + assert '-' in name + version = name.split('-')[1] + versions.add(version) return versions -def get_bugs(api_key, query): +def get_bugs(query): u = base_url + 'bug' r = requests.get(u, params = query) return r.json()['bugs'] -def search(api_key): +def search(): chunk = 1000 ids = [] - print('%-53s%-30s%-40s%-40s%-60s' % ('Bug URL', 'SVN commits', 'known-to-fail', 'known-to-work', 'Bug summary')) + print('%-30s%-30s%-40s%-40s%-60s' % ('Bug URL', 'GIT commits', 'known-to-fail', 'known-to-work', 'Bug summary')) for i in range(start_page, 0, -1): # print('offset: %d' % (i * chunk), flush = True) - bugs = get_bugs(api_key, {'api_key': api_key, 'bug_status': statuses, 'limit': chunk, 'offset': i * chunk}) + bugs = get_bugs({'bug_status': statuses, 'limit': chunk, 'offset': i * chunk}) for b in sorted(bugs, key = lambda x: x['id'], reverse = True): id = b['id'] @@ -66,7 +75,7 @@ def search(api_key): work = b['cf_known_to_work'] u = base_url + 'bug/' + str(id) + '/comment' - r = requests.get(u, params = {'api_key': api_key} ).json() + r = requests.get(u).json() keys = list(r['bugs'].keys()) assert len(keys) == 1 comments = r['bugs'][keys[0]]['comments'] @@ -77,7 +86,7 @@ def search(api_key): branches = get_branches_by_comments(comments) if len(branches): branches_str = ','.join(sorted(list(branches))) - print('%-53s%-30s%-40s%-40s%-60s' % ('https://gcc.gnu.org/bugzilla/show_bug.cgi?id=%d' % id, branches_str, fail, work, b['summary'])) + print('%-30s%-30s%-40s%-40s%-60s' % ('https://gcc.gnu.org/PR%d' % id, branches_str, fail, work, b['summary']), flush=True) ids.append(id) # print all URL lists @@ -90,7 +99,6 @@ print('Bugzilla URL page size: %d' % url_page_size) print('HINT: bugs with following comment are ignored: %s\n' % closure_question) parser = argparse.ArgumentParser(description='') -parser.add_argument('api_key', help = 'API key') args = parser.parse_args() -search(args.api_key) +search()