diff options
author | Valerie R Young <spectranaut@riseup.net> | 2016-07-26 17:08:32 -0400 |
---|---|---|
committer | Holger Levsen <holger@layer-acht.org> | 2016-07-28 14:06:25 -0400 |
commit | aec5e379fdffd876509e801e6e85f8c791310136 (patch) | |
tree | de9944c72cb28aa07ea338471000e31eef36cc51 | |
parent | 9ba9e97eb4848d2514c3edf3d6ea19888c7e3ea3 (diff) | |
download | jenkins.debian.net-aec5e379fdffd876509e801e6e85f8c791310136.tar.xz |
reproducible debian: add template for notes pages
Signed-off-by: Holger Levsen <holger@layer-acht.org>
-rwxr-xr-x | bin/reproducible_html_notes.py | 39 | ||||
-rw-r--r-- | mustache-templates/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 8fc3cb06..509a2bcb 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 00000000..4eaaf837 --- /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> |