[Cdd-commits] r1138 - in cdd/trunk/webtools: . templates
CDD Subversion Commit
noreply at alioth.debian.org
Tue Oct 21 14:01:11 UTC 2008
Author: tille
Date: Tue Oct 21 14:01:10 2008
New Revision: 1138
Modified:
cdd/trunk/webtools/bugs.py
cdd/trunk/webtools/distasktools.py
cdd/trunk/webtools/templates/bugs.xhtml
Log:
Added links to QA page of package source as well as time stamp
Modified: cdd/trunk/webtools/bugs.py
==============================================================================
--- cdd/trunk/webtools/bugs.py (original)
+++ cdd/trunk/webtools/bugs.py Tue Oct 21 14:01:10 2008
@@ -5,6 +5,9 @@
from sys import argv, exit, stderr
from btsutils.debbugs import debbugs
import gettext
+import time
+from datetime import datetime
+from email.Utils import formatdate
from genshi.template import TemplateLoader
from genshi import Markup
@@ -21,7 +24,7 @@
class PackageBugs:
# Store list of bugs of a package
- def __init__(self, pkgname):
+ def __init__(self, pkgname, source=None):
self.pkgname = None
self.bugs = [] # open bugs
self.nbugs = 0
@@ -46,6 +49,10 @@
self.bugs.append(bugdict)
self.nbugs += 1
self.pkgname = pkgname
+ if source == None:
+ self.source = pkgname
+ else:
+ self.source = source
# Define directories used
@@ -65,18 +72,20 @@
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'))
+packages = cdeps.GetNamesAndSourceDict(dependencytypes=('depends','recommends','suggests'))
outputdir = cdeps.CheckOrCreateOutputDir('bugs')
if outputdir == None:
exit(-1)
+t = datetime.now()
data = cdeps.data
-data['tasks'] = cdeps.GetTaskDescDict()
-data['taskskeys'] = cdeps.metapackagekeys
-data['lang'] = 'en'
-data['othertasks'] = _("Links to other tasks")
-data['indexlink'] = _("Index of all tasks")
+data['tasks'] = cdeps.GetTaskDescDict()
+data['taskskeys'] = cdeps.metapackagekeys
+data['lang'] = 'en'
+data['othertasks'] = _("Links to other tasks")
+data['indexlink'] = _("Index of all tasks")
+data['updatetimestamp'] = _('Last update:') + ' ' + formatdate(time.mktime(t.timetuple()))
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
@@ -101,7 +110,7 @@
if pkgbug.pkgname:
pkgbugs.append(pkgbug)
for pkg in packages[task]:
- pkgbug = PackageBugs(pkg)
+ pkgbug = PackageBugs(pkg[0], pkg[1])
if pkgbug.pkgname:
pkgbugs.append(pkgbug)
nbugs[task] += pkgbug.nbugs
Modified: cdd/trunk/webtools/distasktools.py
==============================================================================
--- cdd/trunk/webtools/distasktools.py (original)
+++ cdd/trunk/webtools/distasktools.py Tue Oct 21 14:01:10 2008
@@ -307,6 +307,24 @@
ret[task] = list
return ret
+ def GetNamesAndSourceDict(self, dependencytypes=()):
+ # For the bugs pages we need not only the binary package names but the
+ # source package as well to be able to link to the QA page
+ # The lists are tuples with first value package name and the second source name
+ ret = {}
+ if dependencytypes == ():
+ # see above in GetNamesOnlyDict()
+
+ dependencytypes=('depends', 'recommends', 'suggests', 'unofficial', 'prospective', 'unknown')
+ for task in self.metapackagekeys:
+ tdeps = self.tasks[task]
+ list = []
+ for dep in dependencytypes:
+ for tdep in tdeps.dependencies[dep]:
+ list.append([tdep.pkg, tdep.source])
+ ret[task] = list
+ return ret
+
def GetListOfDepsForTask(self, task, dependencytypes=()):
# David Paleino needs for his web tools a dictionary
# [list of dependencies]
@@ -592,6 +610,8 @@
dep.desc['en']['long'] = self.available.packages[component][dep.pkg].desc['en']['long']
dep.homepage = self.available.packages[component][dep.pkg].homepage
dep.version = self.available.packages[component][dep.pkg].version
+ dep.section = self.available.packages[component][dep.pkg].section
+ dep.source = self.available.packages[component][dep.pkg].source
dep.responsible = self.available.packages[component][dep.pkg].responsible
# TODO: Assuming 'unstable' is wrong --> handle list of dists
dep.pkgURL = 'http://packages.debian.org/' + 'unstable/' + \
@@ -793,6 +813,8 @@
if stanza.has_key('source'):
# sometimes the source has a version number attached -> crop everything after ' '
deppkg.source = re.sub('\s+.*', '', stanza['source'])
+ else: # source = package name if source is not explicitely specified
+ deppkg.source = stanza['package']
deppkg.section = stanza['section']
deppkg.responsible = re.sub('\s*(.+)\s+<(.+ at .+)>\s*', '<a href="mailto:\\2">\\1</a>', \
stanza['maintainer'])
Modified: cdd/trunk/webtools/templates/bugs.xhtml
==============================================================================
--- cdd/trunk/webtools/templates/bugs.xhtml (original)
+++ cdd/trunk/webtools/templates/bugs.xhtml Tue Oct 21 14:01:10 2008
@@ -68,7 +68,7 @@
<py:for each="pkgbug in pkgbugs">
<span py:if="pkgbug.nbugs > 0">
<tr>
- <td colspan="2" class="package">${pkgbug.pkgname} (${pkgbug.nbugs})</td>
+ <td colspan="2" class="package"><a href="http://packages.qa.debian.org/${pkgbug.source[0]}/${pkgbug.source}.html">${pkgbug.pkgname}</a> (${pkgbug.nbugs})</td>
<td></td>
</tr>
<py:for each="bug in pkgbug.bugs">
@@ -92,7 +92,7 @@
<py:for each="pkgbug in pkgbugs">
<span py:if="pkgbug.ndone > 0">
<tr>
- <td class="package">${pkgbug.pkgname} (${pkgbug.ndone}))</td>
+ <td class="package"><a href="http://packages.qa.debian.org/${pkgbug.source[0]}/${pkgbug.source}.html">${pkgbug.pkgname}</a> (${pkgbug.ndone}))</td>
<td colspan="2"></td>
</tr>
<py:for each="bug in pkgbug.done">
@@ -112,5 +112,8 @@
</td>
</tr>
</table>
+<div id="footer">
+ <address>${updatetimestamp}</address>
+</div>
</body>
</html>
More information about the Cdd-commits
mailing list