[IGSTK-Developers] Extracting requirements from the bug tracker to latex file
Andy Cedilnik
andy.cedilnik at kitware.com
Tue Jun 21 15:27:40 EDT 2005
Hi All,
Here is script that I can run every night. It produces the attached
file. Let me know if the format is ok.
Current problems:
* Handle special characters
* Do something with NEW_REQ_TEXT
#!/usr/bin/env python
import MySQLdb
import sys
HOST = '****'
DATABASE = '****'
USER = '****'
PASSWORD = '****'
sql = MySQLdb.connect(db=DATABASE, host=HOST, user=USER, passwd=PASSWORD)
cursor = sql.cursor()
cursor.execute("SELECT bug_id, title, description FROM phpbt_bug WHERE
project_id = 10;")
bugs = {}
comments = {}
while 1:
res = cursor.fetchone()
if not res:
break
if not bugs.has_key(res[1]):
bugs[res[1]] = res
else:
print "Problem!! Found two bugs with the same requirement:\n%s\n%s"
% (`res`, `bugs[res[1]]`)
sys.exit(1)
comments[res[1]] = []
ks = bugs.keys()
ks.sort()
for a in ks:
if a.startswith("REQ"):
bug = bugs[a]
print "\section{%s - %d}" % (a, bug[0])
print "%s" % bug[2]
print ""
cursor.execute("SELECT comment_text FROM phpbt_comment WHERE bug_id
= %d;" % bug[0])
while 1:
res = cursor.fetchone()
if not res:
break
print res[0]
--
Andy Cedilnik
Kitware Inc.
More information about the IGSTK-Developers
mailing list