[Cdd-commits] r1120 - cdd/trunk/webtools
CDD Subversion Commit
noreply at alioth.debian.org
Sat Oct 4 19:53:43 UTC 2008
Author: tille
Date: Sat Oct 4 19:53:43 2008
New Revision: 1120
Added:
cdd/trunk/webtools/bugs.py (contents, props changed)
Log:
Added script to query bug status for dependant packages
Added: cdd/trunk/webtools/bugs.py
==============================================================================
--- (empty file)
+++ cdd/trunk/webtools/bugs.py Sat Oct 4 19:53:43 2008
@@ -0,0 +1,87 @@
+#!/usr/bin/python
+# Bugs of source packages in tasks
+
+import os
+from sys import argv, exit, stderr
+from btsutils.debbugs import debbugs
+
+from distasktools import DisDependencies, ReadConfig
+
+if len(argv) <= 1:
+ print >>stderr, "Usage: %s <DIS name>\n The <DIS name> needs a matching config file webconf/<DIS name>.conf"\
+ % argv[0]
+ exit(-1)
+
+bts = debbugs()
+
+class PackageBugs:
+ # Store list of bugs aof a package
+
+ def __init__(self, pkgname):
+ self.pkgname = pkgname
+ self.bugs = [] # open bugs
+ self.done = [] # closed bugs
+
+
+cdeps=DisDependencies(argv[1])
+if cdeps.data['pkglist'] == '':
+ print >>stderr, "Config file webconf/%s.conf is lacking pkglist field." % (argv[1])
+ exit(-1)
+cdeps.GetAllDependencies(source=0) # Set source=1 in case source pakcages shoudl be displayed
+packages = cdeps.GetNamesOnlyDict(dependencytypes=('depends','recommends','suggests'))
+
+data = cdeps.data
+data['tasks'] = cdeps.GetTaskDescDict()
+#if data['advertising'] != None:
+# # If data['advertising'] is enclosed in _() gettext tries to ask for translations of 'advertising'
+# # which makes no sense. That's why this is masked by an extra string variable
+# advertising = data['advertising']
+# ##data['projectadvertising'] = _(advertising) # Hopefully translation will work this way ...
+# # Genshi needs explicite information that it is dealing with an UTF-8 string which should not be changed
+# advertising = _(advertising)
+# data['projectadvertising'] = Markup(unicode(advertising))# , 'utf-8'))
+#else:
+# data['projectadvertising'] = None
+
+bugsdir='bugs'
+os.system("mkdir -p %s" % (bugsdir))
+
+allbugs = {}
+for task in packages.keys():
+ pkgbugs = []
+ for pkg in packages[task]:
+ bugs = bts.query('src:' + pkg)
+ if bugs:
+ pkgbug = PackageBugs(pkg)
+ for bug in bugs:
+ if bug.getStatus() == 'done':
+ pkgbug.done.append(bug)
+ else:
+ pkgbug.bugs.append(bug)
+ pkgbugs.append(pkgbug)
+ if pkgbugs:
+ allbugs[task] = pkgbugs
+ else:
+ allbugs[task] = None
+
+for task in packages.keys():
+ fp = open(bugsdir + '/' + task + '.bugs', 'w')
+ if allbugs[task]:
+ print >>fp, "< open bugs in task %s >" % task
+ for pkgbugs in allbugs[task]:
+ if pkgbugs.bugs:
+ print >>fp, "<< %s >>" % ( pkgbugs.pkgname )
+ for bug in pkgbugs.bugs:
+ print >>fp, "%s: %s (%s)" % (bug.getBug(), bug.getSummary(), bug.getSeverity())
+ else:
+ print >>fp, "<< only closed bugs for %s >>" % ( pkgbugs.pkgname )
+ print >>fp, "\n< closed bugs in task %s >" % task
+ for pkgbugs in allbugs[task]:
+ if pkgbugs.done:
+ print >>fp, "<< done bugs for %s >>" % ( pkgbugs.pkgname )
+ for bug in pkgbugs.done:
+ print >>fp, "%s: %s (%s)" % (bug.getBug(), bug.getSummary(), bug.getSeverity())
+ else:
+ print >>fp, "<< there are no known closed bugs for %s >>" % ( pkgbugs.pkgname )
+
+ fp.close()
More information about the Cdd-commits
mailing list