# HG changeset patch # User Bernhard Herzog # Date 1213177737 0 # Node ID 27e78096a3feb27cd1db1495f38ebd1842d102fe # Parent 236e91be522c7bf5579e16ed9d0c930cd51d8af3 gnupg2 recipe: format the PKITS log as a HTML table diff -r 236e91be522c -r 27e78096a3fe recipes/gnupg/gnupg2.py --- a/recipes/gnupg/gnupg2.py Tue Jun 10 15:37:22 2008 +0000 +++ b/recipes/gnupg/gnupg2.py Wed Jun 11 09:48:57 2008 +0000 @@ -12,8 +12,11 @@ import logging import re +from genshi.template import TemplateLoader + import treepkg.packager import treepkg.util +import treepkg.report import base base.define_gnupg_packager("gnupg2") @@ -62,9 +65,16 @@ logging.info("Could not find PKITS LOG in %s", self.logfile) return treepkg.util.ensure_directory(os.path.dirname(self.pkits_log)) - outfile = open(self.pkits_log, "w") - outfile.writelines(testlog) - outfile.close() + treepkg.util.writefile(self.pkits_log, + self.htmlize_pkits_log(testlog)) + + def htmlize_pkits_log(self, raw_lines): + loader = TemplateLoader([os.path.dirname(__file__)]) + template = loader.load("pkits.html") + pkits = treepkg.report.struct(revision=self.parent.revision, + lines=raw_lines) + stream = template.generate(pkits=pkits) + return stream.render('html') class RevisionPackager(treepkg.packager.RevisionPackager): @@ -72,7 +82,7 @@ source_packager_cls = SourcePackager binary_packager_cls = BinaryPackager - pkits_log = treepkg.packager._filenameproperty("pkits_log.txt", + pkits_log = treepkg.packager._filenameproperty("pkits_log.html", dir_attr="log_dir") def list_log_files(self): diff -r 236e91be522c -r 27e78096a3fe recipes/gnupg/pkits.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/recipes/gnupg/pkits.html Wed Jun 11 09:48:57 2008 +0000 @@ -0,0 +1,37 @@ + + + PKITS Log for GnuPG2 rev. ${pkits.revision} + + + +

PKITS Log for GnuPG2 rev. ${pkits.revision}

+ + + + + + + + + + + + + + + +
Test IDStatusDetails
${testid}${status}${details}
+ +