def _get_bugzilla_history(email, all_comments=False): """ Query the bugzilla for all bugs to which the provided email is either assigned or cc'ed. Then for each bug found, print the latest comment from this user (if any). :arg email, the email address used in the bugzilla and for which we are searching for activities. :arg all_comments, boolean to display all the comments made by this person on the bugzilla. """ from bugzilla.rhbugzilla import RHBugzilla bzclient = RHBugzilla(url='https://bugzilla.redhat.com/xmlrpc.cgi') log.debug('Querying bugzilla for email: {0}'.format(email)) print("Bugzilla activity") bugbz = bzclient.query({ 'emailtype1': 'substring', 'emailcc1': True, 'emailassigned_to1': True, 'query_format': 'advanced', 'order': 'Last Change', 'bug_status': ['ASSIGNED', 'NEW', 'NEEDINFO'], 'email1': email }) # Retrieve the information about this user user = bzclient.getuser(email) print(' {0} bugs assigned, cc or on which {1}({2}) commented'.format( len(bugbz), email, user.userid)) bugbz.reverse() print(' Last comment on the most recent ticket on bugzilla:') ids = [bug.bug_id for bug in bugbz] for bug in list(bzclient.getbugs(ids)): log.debug(bug.bug_id) if sys.version_info[0] >= 3: user_coms = list( filter(lambda com: com["creator_id"] == user.userid, bug.longdescs)) else: user_coms = filter(lambda com: com["creator_id"] == user.userid, bug.longdescs) if user_coms: last_com = user_coms[-1] converted = datetime.datetime.strptime(last_com['time'].value, "%Y%m%dT%H:%M:%S") print(u' #{0} {1} {2}'.format(bug.bug_id, converted.strftime('%Y-%m-%d'), last_com['creator'])) if not all_comments: break
def get_filed_bugs(tracking_bug): """Query bugzilla if given bug has already been filed Keyword arguments: product -- bugzilla product (usually Fedora) component -- component (package) to file bug against version -- component version to file bug for (usually rawhide for Fedora) summary -- short bug summary """ query_data = {'blocks': tracking_bug} bzurl = 'https://bugzilla.redhat.com' bzclient = RHBugzilla(url="%s/xmlrpc.cgi" % bzurl) return bzclient.query(query_data)
def _get_bugzilla_history(email, all_comments=False): """ Query the bugzilla for all bugs to which the provided email is either assigned or cc'ed. Then for each bug found, print the latest comment from this user (if any). :arg email, the email address used in the bugzilla and for which we are searching for activities. :arg all_comments, boolean to display all the comments made by this person on the bugzilla. """ from bugzilla.rhbugzilla import RHBugzilla bzclient = RHBugzilla(url='https://bugzilla.redhat.com/xmlrpc.cgi') log.debug('Querying bugzilla for email: {0}'.format(email)) print("Bugzilla activity") bugbz = bzclient.query({ 'emailtype1': 'substring', 'emailcc1': True, 'emailassigned_to1': True, 'query_format': 'advanced', 'order': 'Last Change', 'bug_status': ['ASSIGNED', 'NEW', 'NEEDINFO'], 'email1': email }) print(' {0} bugs assigned, cc or on which {1} commented'.format( len(bugbz), email)) # Retrieve the information about this user user = bzclient.getuser(email) bugbz.reverse() print('Last comment on the most recent ticket on bugzilla:') ids = [bug.bug_id for bug in bugbz] for bug in bzclient.getbugs(ids): log.debug(bug.bug_id) user_coms = filter(lambda com: com["creator_id"] == user.userid, bug.longdescs) if user_coms: last_com = user_coms[-1] converted = datetime.datetime.strptime(last_com['time'].value, "%Y%m%dT%H:%M:%S") print(u' #{0} {1} {2}'.format(bug.bug_id, converted.strftime('%Y-%m-%d'), last_com['author'])) if not all_comments: break
self.id = "" self.url = "" self.title = "" self.status = "" self.type = "" self.component = "" def gather_bugzilla_easyfix(): """ From the Red Hat bugzilla, retrieve all new tickets flagged as easyfix. """ bugbz = bzclient.query( {'f1': 'keywords', 'o1': 'allwords', 'v1': 'easyfix', 'query_format': 'advanced', 'bug_status': ['NEW'], 'classification': 'Fedora'}) #print " {0} easyfix bugs retrieve from the BZ ".format(len(bugbz)) return bugbz def gather_project(): """ Retrieve all the projects which have subscribed to this idea. """ {% if env == 'staging' %} wiki = MediaWiki(base_url='https://stg.fedoraproject.org/w/') {% else %} wiki = MediaWiki(base_url='https://fedoraproject.org/w/') {% endif %}
def do_acl(args): ''' Retrieves the ACLs of a package from pkgdb. ''' LOG.info("package : {0}".format(args.package)) LOG.info("branch : {0}".format(args.branch)) #LOG.info("approve : {0}".format(args.approve)) bzclient = RHBugzilla(url=RH_BZ_API) if args.branch == 'all': args.branch = None output = pkgdbclient.get_package(args.package, branches=args.branch) print 'Fedora Package Database -- {0}'.format(args.package) if output['packages']: print output['packages'][0]['package']['summary'] if args.extra: # print the number of opened bugs LOG.debug("Query bugzilla") bugbz = bzclient.query( {'bug_status': ['NEW', 'ASSIGNED', 'NEEDINFO'], 'component': args.package}) print "{0} bugs open (new, assigned, needinfo)".format(len(bugbz)) for pkg in output['packages']: if pkg['collection']['status'] == 'EOL': continue owner = pkg['point_of_contact'] if owner == 'orphan': owner = RED + owner + RESET # Retrieve ACL information print "\n{0}{1}{2}{3}Point of Contact:{4}{5}".rstrip().format( RED + BOLD, pkg['collection']['branchname'], RESET, " " * (8 - len(pkg['collection']['branchname'])), " " * 5, owner) # print header of the table tmp = " " * 24 for acl in ["watchbugzilla", "watchcommits", "commit", "approveacls"]: tmp = tmp + acl + " " * (16 - len(acl)) print tmp.rstrip() # print ACL information print "{0}ACLs:".format(" " * 8) acls = _get_acls_info(pkg['acls']) for user in acls: tmp = " " * 10 + user tmp = tmp + " " * (24 - len(tmp)) for acl_title in ["watchbugzilla", "watchcommits", "commit", "approveacls"]: #print '\n', acl_title if acl_title in acls[user]: aclout = acls[user][acl_title] tmp = tmp + aclout + " " * (16 - len(aclout)) else: tmp = tmp + aclout + " " * 8 if tmp is not None and tmp.strip() != "": print tmp # print the last build if args.extra: tag = pkg['collection']['branchname'] get_last_build(pkg['package']['name'], tag)
self.id = "" self.url = "" self.title = "" self.status = "" self.type = "" self.component = "" def gather_bugzilla_easyfix(): """ From the Red Hat bugzilla, retrieve all new tickets with keyword easyfix or whiteboard trivial. """ bugbz_easyfix = bzclient.query( {'f1': 'keywords', 'o1': 'allwords', 'v1': 'easyfix', 'query_format': 'advanced', 'bug_status': ['NEW'], 'classification': 'Fedora'}) # print " {0} easyfix bugs retrieved from BZ".format(len(bugbz_easyfix)) bugbz_trivial = bzclient.query( { 'status_whiteboard': 'trivial', 'status_whiteboard_type': 'anywords', 'query_format': 'advanced', 'bug_status': ['NEW'], 'classification': 'Fedora' }) # print " {0} trivial bugs retrieved from BZ".format(len(bugbz)) return (bugbz_easyfix + bugbz_trivial)