[Qa-jenkins-scm] [jenkins.debian.net] 04/10: reproducible debian: add template for notes pages

Holger Levsen holger at layer-acht.org
Thu Jul 28 18:14:12 UTC 2016


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch master
in repository jenkins.debian.net.

commit aec5e379fdffd876509e801e6e85f8c791310136
Author: Valerie R Young <spectranaut at riseup.net>
Date:   Tue Jul 26 17:08:32 2016 -0400

    reproducible debian: add template for notes pages
    
    Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
 bin/reproducible_html_notes.py                     | 39 ++++++++++------------
 .../reproducible/notes_body.mustache               | 17 ++++++++++
 2 files changed, 34 insertions(+), 22 deletions(-)

diff --git a/bin/reproducible_html_notes.py b/bin/reproducible_html_notes.py
index 8fc3cb0..509a2bc 100755
--- a/bin/reproducible_html_notes.py
+++ b/bin/reproducible_html_notes.py
@@ -11,38 +11,24 @@
 # Build html pages based on the content of the notes.git repository
 
 import copy
-import popcon
 import yaml
+import popcon
+import pystache
 from collections import OrderedDict
 from math import sqrt
 from reproducible_common import *
 from reproducible_html_packages import gen_packages_html
 from reproducible_html_indexes import build_page
 
+renderer = pystache.Renderer()
+notes_body_template = renderer.load_template(
+    os.path.join(TEMPLATE_PATH, 'notes_body'))
+
 NOTES = 'packages.yml'
 ISSUES = 'issues.yml'
 
 NOTESGIT_DESCRIPTION = 'Our notes about issues affecting packages are stored in <a href="https://anonscm.debian.org/git/reproducible/notes.git" target="_parent">notes.git</a> and are targeted at packages in Debian in \'unstable/amd64\' (unless they say otherwise).'
 
-note_html = Template((tab*2).join("""
-<table class="body">
-  <tr>
-    <td>Version annotated:</td>
-    <td>$version</td>
-  </tr>
-  $infos
-  <tr>
-    <td colspan="2"> </td>
-  </tr>
-  <tr>
-    <td colspan="2" style="text-align:right; font-size:0.9em;">
-      <p>
-       $notesgit_description
-      </p>
-    </td>
-  </tr>
-</table>""".splitlines(True)))
-
 note_issues_html = Template((tab*3).join("""
 <tr>
   <td>
@@ -250,11 +236,20 @@ def gen_html_note(package, note):
         comment = comment.replace('\n', '<br />')
         infos += note_comments_html.substitute(comments=comment)
     try:
-        return note_html.substitute(version=str(note['version']), infos=infos, notesgit_description=NOTESGIT_DESCRIPTION)
+        version = str(note['version'])
+        return renderer.render(notes_body_template, {
+            'version': version,
+            'infos': infos,
+            'notesgit_description': NOTESGIT_DESCRIPTION
+        })
     except KeyError:
         log.warning('You should really include a version in the ' +
               str(note['package']) + ' note')
-        return note_html.substitute(version='N/A', infos=infos, notesgit_description=NOTESGIT_DESCRIPTION)
+        return renderer.render(notes_body_template, {
+            'version': 'N/A',
+            'infos': infos,
+            'notesgit_description': NOTESGIT_DESCRIPTION
+        })
 
 
 def gen_html_issue(issue, suite):
diff --git a/mustache-templates/reproducible/notes_body.mustache b/mustache-templates/reproducible/notes_body.mustache
new file mode 100644
index 0000000..4eaaf83
--- /dev/null
+++ b/mustache-templates/reproducible/notes_body.mustache
@@ -0,0 +1,17 @@
+<table class="body">
+  <tr>
+    <td>Version annotated:</td>
+    <td>{{version}}</td>
+  </tr>
+  {{{infos}}}
+  <tr>
+    <td colspan="2"> </td>
+  </tr>
+  <tr>
+    <td colspan="2" style="text-align:right; font-size:0.9em;">
+      <p>
+        {{{notesgit_description}}}
+      </p>
+    </td>
+  </tr>
+</table>

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/qa/jenkins.debian.net.git



More information about the Qa-jenkins-scm mailing list