Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 315229 Details for
Bug 452399
need bugzilla xmlrpc dependency chain call
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
merge-mock-list-to-bz-csv.py
merge-mock-list-to-bz-csv.py (text/plain), 7.85 KB, created by
Matt Domsch
on 2008-08-28 15:41:20 UTC
(
hide
)
Description:
merge-mock-list-to-bz-csv.py
Filename:
MIME Type:
Creator:
Matt Domsch
Created:
2008-08-28 15:41:20 UTC
Size:
7.85 KB
patch
obsolete
>#!/usr/bin/python -tt > >import sys >import csv >import getopt >import re >import string >from subprocess import Popen, PIPE >from xml.dom import minidom > >bugzilla_filename = None >pkg_bugs = {} >pkg_name_ver = {} >bugs_to_close = {} >pkg_owners = {} >emails = {} >pkg_reasons = {} >user_to_email = {} >closed_file = None >names_files = [] >emails_file = None >owners_file = None >output_file = None >reasons_files = [] >userlist_file = None >per_owner_reportfile = None >bugzilla_number='440169' > >def getText(nodelist): > rc = "" > for node in nodelist: > if node.nodeType == node.TEXT_NODE: > rc = rc + node.data > return rc > >def parse_deptree_xml(f): > buglist = set() > dom = minidom.parse(f) > top_elements=('parent', 'bug') > for t in top_elements: > bugs = dom.getElementsByTagName(t) > for b in bugs: > bug_id = b.getElementsByTagName("bug_id")[0] > buglist.add(getText(bug_id.childNodes)) > return buglist > >def get_dependency_chain_online(bugnumber): > url = 'https://bugzilla.redhat.com/showdependencytree.cgi?id=%s&hide_resolved=1&ctype=xml' % (bugnumber) > p = Popen(['/usr/bin/curl', '--insecure', '--proxy-ntlm', url], stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True) > (child_stdout, child_stdin) = (p.stdout, p.stdin) > > buglist = parse_deptree_xml(child_stdout) > return buglist > >def parse_bug_xml(f): > bugdict = {} > dom = minidom.parse(f) > bugs = dom.getElementsByTagName('bug') > for b in bugs: > bug_id = b.getElementsByTagName("bug_id")[0] > bug_id_text = getText(bug_id.childNodes) > component = b.getElementsByTagName("component")[0] > component_text = getText(component.childNodes) > status = b.getElementsByTagName("bug_status")[0] > status_text = getText(status.childNodes) > > bugdict[bug_id_text] = {'bug_id':int(bug_id_text), > 'component':component_text, > 'status':status_text > } > > return bugdict > > >def get_bug_details(buglist): > cookie='COLUMNLIST=alias%20bug_severity%20priority%20rep_platform%20assigned_to%20bug_status%20resolution%20component%20short_short_desc%20blockedby' > url = 'https://bugzilla.redhat.com/show_bug.cgi?id=%s&ctype=xml' % (','.join(buglist)) > p = Popen(['/usr/bin/curl', '--insecure', '--cookie', cookie, '--proxy-ntlm', url], stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True) > (child_stdout, child_stdin) = (p.stdout, p.stdin) > > buglist = parse_bug_xml(child_stdout) > return buglist > > > >def setup_blocking_bugs(): > global pkg_bugs > global bugs_to_close > buglist = get_dependency_chain_online(bugzilla_number) > bugdict = get_bug_details(buglist) > > # when run, pkg_bugs contains the list of build run failed packages, an empty list for each. > # these are the bugs the current run believes are failed > # items on the blocking list which aren't in pkg_bugs are candidates to close. > for bug_id, bug in bugdict.iteritems(): > pkg_bug_string = bug_id + " " + bug['status'] > try: > pkg_bugs[bug['component']].append(pkg_bug_string) > except KeyError: > # decendent of a bug already open, but belonging to a different package; don't care. > if bug['component'] in bugs_to_close: > bugs_to_close[bug['component']].append(bug_id) > else: > bugs_to_close[bug['component']] = [bug_id] > > try: > del bugs_to_close['distribution'] > except: > pass > > >opts, args = getopt.getopt(sys.argv[1:], "b:B:c:e:n:o:O:p:r:u:", ["bugzilla", "bugzillafile", "closed", "emails", "names", "owners", "output", "per_owner", "reasons", "userlist"]) >for option, argument in opts: > if option in ("-b", "--bugzilla"): > bugzilla_number = argument > if option in ("-B", "--bugzillafile"): > bugzilla_filename = argument > if option in ("-c", "--closed"): > closed_file = argument > if option in ("-e", "--emails"): > emails_file = argument > if option in ("-n", "--names"): > names_files.append(argument) > if option in ("-o", "--owners"): > owners_file = argument > if option in ("-O", "--output"): > output_file = argument > if option in ("-r", "--reasons"): > reasons_files.append(argument) > if option in ("-u", "--userlist"): > userlist_file = argument > if option in ("-p", "--per_owner"): > per_owner_reportfile = argument > > >if len(args) == 0: > print "You didn't specify any broken build lists." > sys.exit(1) > >for names_file in names_files: > namesf = open(names_file, 'rb') > for line in namesf.readlines(): > if line.startswith('#'): > continue > sline = line.split() > pkg_name_ver[sline[0]] = sline[2] > namesf.close > >if owners_file is not None: > ownerf = open(owners_file, 'rb') > for line in ownerf.readlines(): > if line.startswith('#'): > continue > line = line.strip() > if len(line) == 0: > continue > sline = line.split('|') > # handle co-owners so we have their addresses for later > oline = [] > for i in (3, 4, 5): > if len(sline[i]): > oline.extend(sline[i].split(',')) > pkg_owners[sline[1]] = oline > > ownerf.close > >for reasons_file in reasons_files: > reasonf = open(reasons_file, 'rb') > for line in reasonf.readlines(): > if line.startswith('#'): > continue > sline = line.split() > try: > pkg_reasons[sline[0]] = sline[1] > except: > # some packages have no reason... > pkg_reasons[sline[0]] = '' > reasonf.close > >if userlist_file is not None: > userf = open(userlist_file, 'rb') > for line in userf.readlines(): > if line.startswith('#'): > continue > sline = line.split(',') > try: > user_to_email[sline[0]] = sline[1] > except: > pass > userf.close > >for file in args: > faillist = open(file, 'rb') > for line in faillist.readlines(): > # ignore lines that have EXPECTED on them, we don't care > if 'EXPECTED' in line: > continue > entry = line.split() > pkg_bugs[entry[0]] = [ ] > > >setup_blocking_bugs() > > >if closed_file is not None: > keys = bugs_to_close.keys() > keys.sort() > closedf = open(closed_file, 'w') > for component in keys: > closedf.write("%s: %s\n" % (component, bugs_to_close[component])) > closedf.close() > >if output_file is not None: > keys = pkg_bugs.keys() > keys.sort() > outf = open(output_file, 'w') > for k in keys: > v = pkg_bugs[k] > try: > owners = pkg_owners[k] > except KeyError: > owners = [] > > try: > namever = pkg_name_ver[k] > except KeyError: > namever = k > > try: > reason = pkg_reasons[k] > except KeyError: > reason = '' > > outf.write("%s %s %s %s\n" % (namever, v, reason, ','.join(owners))) > for o in owners: > emails[o] = True > outf.close() > >if emails_file is not None: > emailsf = open(emails_file, 'w') > for k, v in emails.iteritems(): > if k == '': > continue > if k in user_to_email: > emailsf.write("%s\n" % (user_to_email[k])) > emailsf.close() > >if per_owner_reportfile is not None: > f = open(per_owner_reportfile, 'w') > > owner_pkgs = {} > for package in pkg_bugs.keys(): > if package in pkg_owners: > for o in pkg_owners[package]: > if o not in owner_pkgs: > owner_pkgs[o] = [package] > else: > owner_pkgs[o].append(package) > > owners = owner_pkgs.keys() > owners.sort() > for owner in owners: > if owner == '': > continue > pkglist = owner_pkgs[owner] > pkglist.sort() > f.write("%s: %s\n\n" % (owner, ','.join(pkglist))) > f.close()
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 452399
:
315226
| 315229