[Treepkg-commits] r70 - in trunk: bin treepkg
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Thu Jun 5 12:36:10 CEST 2008
Author: bh
Date: 2008-06-05 12:36:10 +0200 (Thu, 05 Jun 2008)
New Revision: 70
Modified:
trunk/bin/reportstatus.py
trunk/treepkg/report.py
trunk/treepkg/web-status.html
Log:
Rework treepkg/report.py to prepare for other report types. Adapt
reportstatus.py and web-status.html.
Modified: trunk/bin/reportstatus.py
===================================================================
--- trunk/bin/reportstatus.py 2008-06-02 17:44:19 UTC (rev 69)
+++ trunk/bin/reportstatus.py 2008-06-05 10:36:10 UTC (rev 70)
@@ -1,5 +1,5 @@
#! /usr/bin/python2.4
-# Copyright (C) 2007 by Intevation GmbH
+# Copyright (C) 2007, 2008 by Intevation GmbH
# Authors:
# Bernhard Herzog <bh at intevation.de>
#
@@ -22,7 +22,7 @@
def report_text(group):
report = prepare_report(group)
- for revno, row in report.revisions:
+ for revno, row in report.revisions.sorted_by_revision():
for col in row:
if col:
print "%s %s: %s" % (col.name, revno, col.status.desc)
Modified: trunk/treepkg/report.py
===================================================================
--- trunk/treepkg/report.py 2008-06-02 17:44:19 UTC (rev 69)
+++ trunk/treepkg/report.py 2008-06-05 10:36:10 UTC (rev 70)
@@ -1,4 +1,4 @@
-# Copyright (C) 2007 by Intevation GmbH
+# Copyright (C) 2007, 2008 by Intevation GmbH
# Authors:
# Bernhard Herzog <bh at intevation.de>
#
@@ -7,6 +7,8 @@
"""Support for status reports"""
+import os
+from operator import attrgetter
import datetime
from packager import create_package_track, PackagerGroup
@@ -63,27 +65,34 @@
stop=format_time(status.stop),
cls=status_class(status.status))
-def prepare_report(group):
- revisions = {}
- columns = []
- tracks = group.get_package_tracks()
- num_columns = len(tracks)
- for column, track in enumerate(tracks):
- columns.append((column, track.name))
- for revision in track.get_revisions():
- row = revisions.setdefault(revision.revision, [None] * num_columns)
- row[column] = struct(revno=revision.revision,
- revision=revision,
- column=column,
- name=track.name,
- status=prepare_status(revision.status))
+class Revisions(object):
- # convert the revisions dict into a sorted list of (revno, row)
- # pairs
- revisions = revisions.items()
- revisions.sort()
- revisions.reverse()
+ def __init__(self, tracks):
+ self.tracks = sorted(tracks, key=attrgetter("name"))
- return struct(columns=columns,
- revisions=revisions,
+ def sorted_by_revision(self):
+ revisions = {}
+ num_columns = len(self.tracks)
+ for column, track in enumerate(self.tracks):
+ for revision in track.get_revisions():
+ row = revisions.setdefault(revision.revision,
+ [None] * num_columns)
+ log_files = [(title, os.path.basename(filename))
+ for title, filename in revision.list_log_files()]
+ row[column] = struct(revno=revision.revision,
+ revision=revision,
+ column=column,
+ name=track.name,
+ log_files=log_files,
+ status=prepare_status(revision.status))
+
+ # convert the revisions dict into a sorted list of (revno, row)
+ # pairs
+ revisions = revisions.items()
+ revisions.sort()
+ revisions.reverse()
+ return revisions
+
+def prepare_report(group):
+ return struct(revisions=Revisions(group.get_package_tracks()),
date=format_time(datetime.datetime.utcnow()))
Modified: trunk/treepkg/web-status.html
===================================================================
--- trunk/treepkg/web-status.html 2008-06-02 17:44:19 UTC (rev 69)
+++ trunk/treepkg/web-status.html 2008-06-05 10:36:10 UTC (rev 70)
@@ -17,12 +17,12 @@
<table class="statustable">
<tr>
<th class="statustablehead">Revision</th>
- <py:for each="col in report.columns">
- <th class="statustablehead">${col[1]}</th>
+ <py:for each="track in report.revisions.tracks">
+ <th class="statustablehead">${track.name}</th>
</py:for>
</tr>
- <py:for each="row in report.revisions">
+ <py:for each="row in report.revisions.sorted_by_revision">
<tr>
<td>${row[0]}</td>
<py:for each="col in row[1]">
@@ -32,9 +32,10 @@
<span class="statusheading">${col.status.desc}</span><br/>
Start: ${col.status.start}<br/>
Stop: ${col.status.stop}<br/>
- <py:if test="col.revision.has_build_log">
- <a href="${col.name}/${col.revno}/build_log.txt">build log</a>
- </py:if>
+ <py:for each="title, basename in col.log_files">
+ <a href="${col.name}/${col.revno}/${basename}">${title}</a>
+ <br/>
+ </py:for>
</td>
</py:when>
<py:otherwise>
More information about the Treepkg-commits
mailing list