From dc9f867e4d316513bd199f072f925f0f7f2e87a4 Mon Sep 17 00:00:00 2001 From: Karel Klic Date: Thu, 11 Mar 2010 11:46:26 +0100 Subject: List component owners in abrt-bz-ratingfixer output --- scripts/abrt-bz-ratingfixer | 71 +++++++++++++++++++++++++++------------------ 1 file changed, 43 insertions(+), 28 deletions(-) (limited to 'scripts/abrt-bz-ratingfixer') 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) -- cgit