From aec5e379fdffd876509e801e6e85f8c791310136 Mon Sep 17 00:00:00 2001 From: Valerie R Young Date: Tue, 26 Jul 2016 17:08:32 -0400 Subject: reproducible debian: add template for notes pages Signed-off-by: Holger Levsen --- bin/reproducible_html_notes.py | 39 ++++++++++------------ .../reproducible/notes_body.mustache | 17 ++++++++++ 2 files changed, 34 insertions(+), 22 deletions(-) create mode 100644 mustache-templates/reproducible/notes_body.mustache 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 notes.git and are targeted at packages in Debian in \'unstable/amd64\' (unless they say otherwise).' -note_html = Template((tab*2).join(""" - - - - - - $infos - - - - - - -
Version annotated:$version
 
-

- $notesgit_description -

-
""".splitlines(True))) - note_issues_html = Template((tab*3).join(""" @@ -250,11 +236,20 @@ def gen_html_note(package, note): comment = comment.replace('\n', '
') 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 @@ + + + + + + {{{infos}}} + + + + + + +
Version annotated:{{version}}
 
+

+ {{{notesgit_description}}} +

+
-- cgit v1.2.3-54-g00ecf