# Copyright Olivier Berger <olivier.berger@it-sudparis.eu> + Institut TELECOM, 2008 # developped in the frame of the HELIOS project (http://www.helios-platform.org/) # License : GNU LGPL V3 # This program is meant to try and extend btsutils in order to reuse # bits of bts-link, to use a local copy of the Debian BTS database # instead of doing SOAP requests import sys # import these bits from btsutils (Debian package 'python-btsutils') from btsutils.debbugs import debbugs from btsutils.bug import Bug # Import bits from bts-link from btslinkutils import BTSLConfig as Cnf import btslinkbts bts = btslinkbts # Specialize debbugs to add a "local" bugtracker proxy which uses the # BTS database mirror's spool as in bts-link class debbugsloc(debbugs): def __init__(self, spool): self.spool = spool debbugs.__init__(self) def get(self, bugnumber): try: bug = Bug() spoolbug = self.spool.getReport(bugnumber) print "processing from spool", bugnumber bug.setBug(spoolbug.id) bug.setPackage(spoolbug.package) bug.setSummary(spoolbug.subject) bug.setSeverity(spoolbug.severity) bug.setSubmitter(spoolbug.submitter) bug.setTags(spoolbug.tags) bug.setUserTags(spoolbug.usertags) # bug.setStatus(status) bug.setForwarded(spoolbug.fwdTo) # bug.setURL(url) return bug except: print "processing from soap", bugnumber return debbugs.get(self,bugnumber) # Program starts here if __name__ == "__main__": # Instantiate a bts-link DBTS interface # requires that btslink.cfg points to the right place and contains # proper definition for the db-h BTS database mirror (spool) btsi = bts.BtsInterface(Cnf) # Instantiate our btsutils.debbugs compliant interface spoolbts = debbugsloc(btsi) # display bugs properties for id in sys.argv[1:]: print print "processing bug : ",id btsbug = spoolbts.get(id) print btsbug |