Hi.

It's the script that I used to identify potentially resolvable bugs. That's done
by parsing of comments and seeking for trunk/branch commits. Sample output looks
as follows:

  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88084 branches: trunk            
              fail:                                work:                        
             basic_string_view::copy doesn't use Traits::copy
  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88083 branches: trunk            
              fail:                                work:                        
             ICE in find_constant_pool_ref_1, at config/s390/s390.c:8231
  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88077 branches: trunk            
              fail: 8.2.0                          work: 9.0                    
             [8 Regression] ICE: ....c:378 since r256989
  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88073 branches: trunk            
              fail:                                work:                        
             [7/8 Regression] Internal compiler error  compiling WHERE 
construct with -O or -O2
  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88071 branches: trunk            
              fail: 8.2.0, 9.0                     work: 7.3.0                  
             [8 Regression] ICE: verify_gimple failed (error: dead STMT in EH 
table)

Plus there are generated bugzilla list so that one can go easily through.
Would you be interested in putting that into maintainer scripts?

Martin
#!/usr/bin/env python3

import requests
import json
import argparse

base_url = 'https://gcc.gnu.org/bugzilla/rest.cgi/'
statuses = ['UNCONFIRMED', 'ASSIGNED', 'SUSPENDED', 'NEW', 'WAITING', 'REOPENED']
regex = '(.*\[)([0-9\./]*)( [rR]egression])(.*)'
closure_question = 'Can the bug be marked as resolved?'
start_page = 20
url_page_size = 50

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('/')
                    parts = parts[1].split('-')
                    assert len(parts) == 3
                    versions.add(parts[1])
            versions.add(version)
    return versions

def get_bugs(api_key, query):
    u = base_url + 'bug'
    r = requests.get(u, params = query)
    return r.json()['bugs']

def search(api_key):
    chunk = 1000
    ids = []
    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})
        for b in sorted(bugs, key = lambda x: x['id'], reverse = True):
            id = b['id']

            fail = b['cf_known_to_fail']
            work = b['cf_known_to_work']

            u = base_url + 'bug/' + str(id) + '/comment'
            r = requests.get(u, params = {'api_key': api_key} ).json()
            keys = list(r['bugs'].keys())
            assert len(keys) == 1
            comments = r['bugs'][keys[0]]['comments']
            for c in comments:
                if closure_question in c['text']:
                    continue

            branches = get_branches_by_comments(comments)
            if len(branches):
                branches_str = ','.join(sorted(list(branches)))
                print('  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=%d branches: %-30s fail: %-30s work: %-30s      %s' % (id, branches_str, fail, work, b['summary']))
                ids.append(id)
                if len(ids) == url_page_size:
                    print('https://gcc.gnu.org/bugzilla/buglist.cgi?bug_id=%s' % ','.join([str(x) for x in ids]))
                    ids = []

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)

Reply via email to