status-report-scripts pyGetReviewByFlags,1.11,1.12
Jason ティビツ (tibbs)
fedora-extras-commits at redhat.com
Tue Jun 17 04:14:19 UTC 2008
Author: tibbs
Update of /cvs/fedora/status-report-scripts
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv16214
Modified Files:
pyGetReviewByFlags
Log Message:
Port to python-bugzilla.
Ingore tickets with "NotReady" in the whiteboard.
Minor cleanups.
Index: pyGetReviewByFlags
===================================================================
RCS file: /cvs/fedora/status-report-scripts/pyGetReviewByFlags,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- pyGetReviewByFlags 24 Jan 2008 05:09:25 -0000 1.11
+++ pyGetReviewByFlags 17 Jun 2008 04:14:18 -0000 1.12
@@ -9,18 +9,22 @@
# work in the public cvs first, then copying to puppet's cvs after.
-import sys
-import os
-from optparse import OptionParser
-import xmlrpclib
+import bugzilla
import datetime
-import tempfile
import glob
+import os
+import sys
+import tempfile
+from optparse import OptionParser
+from pprint import pprint
# This URL will work publically
#url = 'https://bugzilla.redhat.com/xmlrpc.cgi'
# This URL will work in the Phoenix colo
-#url = 'https://bzprx.vip.phx.redhat.com/xmlrpc.cgi'
+url = 'https://bzprx.vip.phx.redhat.com/xmlrpc.cgi'
+
+NEEDSPONSOR = '177841'
+GUIDELINES = '197974'
flagData = {
# 'FLAG' : (baseFlagFilename, openMsg, closeMsg),
@@ -43,7 +47,7 @@
help="update frequency", default="60")
parser.add_option("-u", "--url", dest="url",
help="bugzilla URL to query",
- default="https://bzprx.vip.phx.redhat.com/xmlrpc.cgi")
+ default=url)
(options, args) = parser.parse_args()
tst = str(options.dirname)
@@ -87,9 +91,13 @@
</html>
"""
-def runQuery(server, flag, f, openMsg, closeMsg):
+def nosec(str):
+ '''Remove the seconds from an hh:mm:ss format string.'''
+ return str[0:str.rfind(':')]
+
+def runQuery(bz, flag, f, openMsg, closeMsg):
querydata = {}
- querydata['column_list'] = ['opendate', 'changeddate', 'bug_severity', 'alias', 'assigned_to', 'reporter', 'bug_status', 'resolution', 'component', 'blockedby', 'short_desc']
+ querydata['column_list'] = ['opendate', 'changeddate', 'bug_severity', 'alias', 'assigned_to', 'reporter', 'bug_status', 'resolution', 'component', 'blockedby', 'dependson', 'short_desc', 'status_whiteboard']
querydata['product'] = ['Fedora']
querydata['component'] = ['Package Review']
querydata['field0-0-0'] = 'flagtypes.name'
@@ -101,20 +109,26 @@
querydata['bug_status'] = ["NEW", "VERIFIED", "ASSIGNED", "REOPENED", "CLOSED", "NEEDINFO_ENG", "NEEDINFO", "INVESTIGATE", "MODIFIED", "ON_DEV", "UNCONFIRMED", "QA_READY", "ON_QA", "FAILS_QA", "NEEDINFO_REPORTER", "RELEASE_PENDING", "POST"]
querydata['type0-0-0'] = 'equals'
querydata['value0-0-0'] = "fedora-review" + flag
- call = server.bugzilla.runQuery(querydata)
- bugs = call['bugs']
+ bugs = bz.query(querydata)
closedCnt = 0
notClosedCnt = 0
-
+ hiddenCnt = 0
+ bugdata = {}
+
for bug in bugs:
- nosec = bug['changeddate'].rfind(':')
- bug['changeddate'] = bug['changeddate'][0:nosec]
-
- for e in bugs:
- if e['bug_status'] == "CLOSED":
+ bugdata[bug.bug_id] = {};
+ bugdata[bug.bug_id]['hidden'] = 0;
+ bugdata[bug.bug_id]['blockedby'] = set(str(bug.blockedby).split(', '))-set([''])
+ bugdata[bug.bug_id]['depends'] = set(str(bug.dependson).split(', '))-set([''])
+ if bug.bug_status == "CLOSED":
closedCnt += 1
+ elif bug.status_whiteboard.find('NotReady') >= 0:
+ hiddenCnt += 1
+ bugdata[bug.bug_id]['hidden'] = 1
+
else:
notClosedCnt += 1
+
print >> f, """
<h1 style="background-color: #99f">%s<br/>
There are %d tickets in this category<br/>
@@ -142,22 +156,21 @@
""" % (openMsg, notClosedCnt)
cnt = 0
for e in bugs:
- if e['bug_status'] == "CLOSED":
+ if e.bug_status == "CLOSED" or bugdata[e.bug_id]['hidden']:
continue
- if e['assigned_to'] == "Nobody's working on this, feel free to take it":
- e['assigned_to'] = "(Nobody)"
+ if e.assigned_to == "Nobody's working on this, feel free to take it":
+ e.assigned_to = "(Nobody)"
cnt += 1
- blockers = str(e['blockedby']).split(', ')
- if '177841' in blockers:
+ if NEEDSPONSOR in bugdata[e.bug_id]['blockedby']:
trclass = 'bz_inprogress'
- elif '197974' in blockers:
+ elif GUIDELINES in bugdata[e.bug_id]['blockedby']:
trclass = 'bz_onhold'
elif (cnt % 2) == 1:
trclass = 'bz_even'
else:
trclass = 'bz_odd'
print >> f, '<tr class="', trclass, 'bz_'
- print >> f, e['bug_status'], ' onMouseOver="bug_over(this, 0);">', "\n"
+ print >> f, e.bug_status, ' onMouseOver="bug_over(this, 0);">', "\n"
print >> f, """
<td>
<a href="show_bug.cgi?id=%s">%s</a>
@@ -174,7 +187,9 @@
</nobr></td><td><nobr>
<span title="%s">%s</span>
</nobr></td></tr>
-""" % (e['bug_id'], e['bug_id'], e['alias'], e['alias'], e['assigned_to'], e['assigned_to'], e['bug_status'], e['bug_status'], e['changeddate'], e['changeddate'], e['resolution'], e['resolution'], e['short_desc'], e['short_desc'])
+""" % (e.bug_id, e.bug_id, e.alias, e.alias, e.assigned_to, e.assigned_to,
+ e.bug_status, e.bug_status, e.changeddate, e.changeddate,
+ e.resolution, e.resolution, e.short_desc, e.short_desc)
print >> f, "</table>\n"
if flag == " ":
return
@@ -204,14 +219,14 @@
""" % (closeMsg, closedCnt)
cnt = 0
for e in bugs:
- if e['bug_status'] != "CLOSED":
+ if e.bug_status != "CLOSED":
continue
cnt += 1
if (cnt % 2) == 1:
print >> f, '<tr class="bz_even bz_'
else:
print >> f, '<tr class="bz_odd bz_'
- print >> f, e['bug_status'], ' onMouseOver="bug_over(this, 0);">', "\n"
+ print >> f, e.bug_status, ' onMouseOver="bug_over(this, 0);">', "\n"
print >> f, """
<td>
<a href="show_bug.cgi?id=%s">%s</a>
@@ -228,13 +243,13 @@
</nobr></td><td><nobr>
<span title="%s">%s</span>
</nobr></td></tr>
-""" % (e['bug_id'], e['bug_id'], e['alias'], e['alias'], e['assigned_to'], e['assigned_to'], e['bug_status'], e['bug_status'], e['changeddate'], e['changeddate'], e['resolution'], e['resolution'], e['short_desc'], e['short_desc'])
+""" % (e.bug_id, e.bug_id, e.alias, e.alias, e.assigned_to, e.assigned_to, e.bug_status, e.bug_status, nosec(e.changeddate), nosec(e.changeddate), e.resolution, e.resolution, e.short_desc, e.short_desc)
print >> f, "</table>\n"
if __name__ == '__main__':
options = parse_commandline()
- server = xmlrpclib.Server(options.url)
+ bz = bugzilla.Bugzilla(url=options.url)
tmpdir = tempfile.mkdtemp(dir=options.dirname)
fname = os.path.join(tmpdir, "NEW.html")
try:
@@ -243,12 +258,13 @@
print 'ERROR: %s: %s' % (strerr, fname)
sys.exit(1)
printHeader(f, options.frequency)
- runQuery(server, ' ', f, "Open ticket(s) with an empty flag", "")
+ runQuery(bz, ' ', f, "Open ticket(s) with an empty flag", "")
print >> f, """
</div></div>
</body>
</html>
"""
+
f.close()
for flag in flagData.keys():
@@ -258,7 +274,7 @@
print 'ERROR: %s: %s' % (strerr, flagData[flag][0])
sys.exit(1)
printHeader(f, options.frequency)
- runQuery(server, flag, f, flagData[flag][1], flagData[flag][2])
+ runQuery(bz, flag, f, flagData[flag][1], flagData[flag][2])
printFooter(f)
f.close()
More information about the fedora-extras-commits
mailing list