diff options
-rwxr-xr-x | scripts/abrt-bz-ratingfixer | 71 |
1 files changed, 43 insertions, 28 deletions
diff --git a/scripts/abrt-bz-ratingfixer b/scripts/abrt-bz-ratingfixer index 15f1a750..9bdb1276 100755 --- a/scripts/abrt-bz-ratingfixer +++ b/scripts/abrt-bz-ratingfixer @@ -154,42 +154,57 @@ for buginfo in buginfos: bz.logout() +# +# Get the component owners +# +bugids = [] +for id, bug in ids.items(): + # Skip bugs with good rating. + if bug['rating'] >= 3: + continue + + # Get the component owner + owner = "Failed to get component owner" + try: + component_info = json.load(urllib.urlopen("https://admin.fedoraproject.org/pkgdb/packages/name/{0}?tg_format=json".format(bug['component']))) + component_packages = component_info['packageListings'] + component_f12 = filter(lambda x:x["collection"]["version"]=="12", component_packages) + if len(component_f12) == 1: + owner = component_f12[0]["owner"] + except KeyError: + pass + + bug['id'] = id + bug['owner'] = owner + bugids.append(bug) + +def ownerCmp(a, b): + if a['owner'] < b['owner']: + return -1 + elif a['owner'] == b['owner']: + return 0 + else: + return 1 + print "============= SUMMARY" -count = 0 closedcount = 0 -bugids = ids.keys() -bugids.sort() if options.wiki: print "{|" print " ! Bug !! Backtrace rating !! Comment count !! Component !! Owner" print " |-" -for bugid in bugids: - bug = ids[bugid] - if bug['rating'] < 3: - count += 1 - if bug['comment_count'] <= 2: - closedcount += 1 - - # Get the component owner - owner = "Failed to get component owner" - try: - component_info = json.load(urllib.urlopen("https://admin.fedoraproject.org/pkgdb/packages/name/{0}?tg_format=json".format(bug['component']))) - component_packages = component_info['packageListings'] - component_f12 = filter(lambda x:x["collection"]["version"]=="12", component_packages) - if len(component_f12) == 1: - owner = component_f12[0]["owner"] - except KeyError: - pass - - if options.wiki: - print " | #[https://bugzilla.redhat.com/show_bug.cgi?id={0} {0}] || {1}/4 || {2} || {3} || {4}".format(bugid, bug['rating'], bug['comment_count'], bug['component'], owner) - print " |-" - else: - print "#{0} has a backtrace with rating {1}/4 and {2} comments, component {3}, owner {4}".format(bugid, bug['rating'], bug['comment_count'], bug['component'], owner) +for bug in sorted(bugids, ownerCmp): + count += 1 + if bug['comment_count'] <= 2: + closedcount += 1 + + if options.wiki: + print " | #[https://bugzilla.redhat.com/show_bug.cgi?id={0} {0}] || {1}/4 || {2} || {3} || {4}".format(bug['id'], bug['rating'], bug['comment_count'], bug['component'], bug['owner']) + print " |-" + else: + print "#{0} has a backtrace with rating {1}/4 and {2} comments, component {3}, owner {4}".format(bug['id'], bug['rating'], bug['comment_count'], bug['component'], bug['owner']) if options.wiki: print " |}" - -print "{0} bugs are included.".format(count) +print "{0} bugs are included.".format(len(bugids)) print "{0} bugs should be closed.".format(closedcount) |