diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/reproducible_common.py | 52 | ||||
-rwxr-xr-x | bin/reproducible_html_breakages.py | 5 | ||||
-rwxr-xr-x | bin/reproducible_html_dd_list.py | 6 | ||||
-rwxr-xr-x | bin/reproducible_html_indexes.py | 16 | ||||
-rwxr-xr-x | bin/reproducible_html_live_status.py | 9 | ||||
-rwxr-xr-x | bin/reproducible_html_notes.py | 9 | ||||
-rwxr-xr-x | bin/reproducible_html_packages.py | 4 | ||||
-rwxr-xr-x | bin/reproducible_html_pkg_sets.py | 26 | ||||
-rw-r--r-- | bin/templates/basic_page.mustache | 14 |
9 files changed, 75 insertions, 66 deletions
diff --git a/bin/reproducible_common.py b/bin/reproducible_common.py index e9d93566..13ef358f 100755 --- a/bin/reproducible_common.py +++ b/bin/reproducible_common.py @@ -159,17 +159,6 @@ main_navigation_template = renderer.load_template( basic_page_template = renderer.load_template( os.path.join(TEMPLATE_PATH, 'basic_page')) -html_header = Template("""<!DOCTYPE html> -<html> - <head> - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> - <meta name="viewport" content="width=device-width" /> - $meta_refresh - <link href="/static/style.css" type="text/css" rel="stylesheet" /> - <title>$page_title</title> - </head> - <body class="wrapper">""") - try: JOB_URL = os.environ['JOB_URL'] except KeyError: @@ -285,15 +274,13 @@ def gen_suite_arch_nav_context(suite, arch, suite_arch_nav_template=None, }) return (suite_list, arch_list) - # See bash equivelent: reproducible_common.sh's "write_page_header()" -def create_main_navigation(page_title, suite, arch, displayed_page=None, - suite_arch_nav_template=None, +def create_main_navigation(suite=defaultsuite, arch=defaultarch, + displayed_page=None, suite_arch_nav_template=None, ignore_experimental=False): suite_list, arch_list = gen_suite_arch_nav_context(suite, arch, suite_arch_nav_template, ignore_experimental) context = { - 'page_title': page_title, 'suite': suite, 'arch': arch, 'project_links_html': renderer.render(project_links_template), @@ -312,32 +299,23 @@ def create_main_navigation(page_title, suite, arch, displayed_page=None, return renderer.render(main_navigation_template, context) -def write_html_page(title, body, destfile, suite=defaultsuite, arch=defaultarch, - noheader=False, style_note=False, noendpage=False, - packages=False, refresh_every=None, displayed_page=None, - suite_arch_nav_template=None, ignore_experimental=False): - meta_refresh = '<meta http-equiv="refresh" content="%d">' % \ +def write_html_page(title, body, destfile, no_header=False, style_note=False, + noendpage=False, refresh_every=None, displayed_page=None, + left_nav_html=None): + meta_refresh_html = '<meta http-equiv="refresh" content="%d"></meta>' % \ refresh_every if refresh_every is not None else '' - context = { - 'page_title': title, - 'meta_refresh': meta_refresh, - } - if not noheader: - context['main_navigation_html'] = create_main_navigation( - page_title=title, - suite=suite, - arch=arch, - displayed_page=displayed_page, - suite_arch_nav_template=suite_arch_nav_template, - ignore_experimental=ignore_experimental, - ) - main_html = body if style_note: - main_html += renderer.render(pkg_legend_template, {}) + body += renderer.render(pkg_legend_template, {}) if not noendpage: now = datetime.utcnow().strftime('%Y-%m-%d %H:%M UTC') - main_html += create_default_page_footer(now) - context['main_html'] = main_html + body += create_default_page_footer(now) + context = { + 'page_title': title, + 'meta_refresh_html': meta_refresh_html, + 'navigation_html': left_nav_html, + 'main_header': title if not no_header else "", + 'main_html': body, + } html = renderer.render(basic_page_template, context) try: diff --git a/bin/reproducible_html_breakages.py b/bin/reproducible_html_breakages.py index 1fec3c1f..2d7f2658 100755 --- a/bin/reproducible_html_breakages.py +++ b/bin/reproducible_html_breakages.py @@ -312,5 +312,8 @@ if __name__ == '__main__': title = 'Breakage on the Debian pages of tests.reproducible-builds.org' destfile = DEBIAN_BASE + '/index_breakages.html' desturl = DEBIAN_URL + '/index_breakages.html' - write_html_page(title, html, destfile, style_note=True, displayed_page='breakages') + + left_nav_html = create_main_navigation(displayed_page='breakages') + write_html_page(title, html, destfile, style_note=True, + left_nav_html=left_nav_html) log.info('Breackages page created at ' + desturl) diff --git a/bin/reproducible_html_dd_list.py b/bin/reproducible_html_dd_list.py index 702d7fb6..1b75ef1a 100755 --- a/bin/reproducible_html_dd_list.py +++ b/bin/reproducible_html_dd_list.py @@ -73,6 +73,8 @@ for suite in SUITES: html += '</pre></p>' title = 'Maintainers of unreproducible packages in ' + suite destfile = DEBIAN_BASE + '/' + suite + '/index_dd-list.html' - write_html_page(title, html, destfile, suite, arch, style_note=True, - displayed_page='dd_list') + left_nav_html = create_main_navigation(suite=suite, arch=arch, + displayed_page='dd_list') + write_html_page(title, html, destfile, style_note=True, + left_nav_html=left_nav_html) log.info('%s/%s/index_dd-list.html published', DEBIAN_URL, suite) diff --git a/bin/reproducible_html_indexes.py b/bin/reproducible_html_indexes.py index a46f62a6..c704c9ca 100755 --- a/bin/reproducible_html_indexes.py +++ b/bin/reproducible_html_indexes.py @@ -526,16 +526,22 @@ def build_page(page, suite=None, arch=None): if gpage: destfile = DEBIAN_BASE + '/index_' + page + '.html' desturl = DEBIAN_URL + '/index_' + page + '.html' - suite = defaultsuite # used for the links generated by write_html_page + suite = defaultsuite # used for the links in create_main_navigation else: - destfile = DEBIAN_BASE + '/' + suite + '/' + arch + '/index_' + page + '.html' + destfile = DEBIAN_BASE + '/' + suite + '/' + arch + '/index_' + \ + page + '.html' desturl = DEBIAN_URL + '/' + suite + '/' + arch + '/index_' + \ page + '.html' suite_arch_nav_template = DEBIAN_URI + '/{{suite}}/{{arch}}/index_' + \ page + '.html' - write_html_page(title=title, body=html, destfile=destfile, suite=suite, - arch=arch, style_note=True, displayed_page=page, - suite_arch_nav_template=suite_arch_nav_template) + left_nav_html = create_main_navigation( + suite=suite, + arch=arch, + displayed_page=page, + suite_arch_nav_template=suite_arch_nav_template, + ) + write_html_page(title=title, body=html, destfile=destfile, style_note=True, + left_nav_html=left_nav_html) log.info('"' + title + '" now available at ' + desturl) diff --git a/bin/reproducible_html_live_status.py b/bin/reproducible_html_live_status.py index 59f4b1e2..f10c2151 100755 --- a/bin/reproducible_html_live_status.py +++ b/bin/reproducible_html_live_status.py @@ -52,7 +52,10 @@ def generate_schedule(arch): html += '</table></p>\n' destfile = DEBIAN_BASE + '/index_' + arch + '_scheduled.html' desturl = DEBIAN_URL + '/index_' + arch + '_scheduled.html' - write_html_page(title=title, body=html, destfile=destfile, arch=arch, style_note=True, refresh_every=60, displayed_page='scheduled') + left_nav_html = create_main_navigation(arch=arch, + displayed_page='scheduled') + write_html_page(title=title, body=html, destfile=destfile, style_note=True, + refresh_every=60, left_nav_html=left_nav_html) log.info("Page generated at " + desturl) @@ -122,7 +125,9 @@ def generate_oldies(arch): html += '</table></p>\n' destfile = DEBIAN_BASE + '/index_' + arch + '_oldies.html' desturl = DEBIAN_URL + '/index_' + arch + '_oldies.html' - write_html_page(title=title, body=html, destfile=destfile, arch=arch, style_note=True, refresh_every=60) + left_nav_html = create_main_navigation(arch=arch) + write_html_page(title=title, body=html, destfile=destfile, style_note=True, + refresh_every=60, left_nav_html=left_nav_html) log.info("Page generated at " + desturl) if __name__ == '__main__': diff --git a/bin/reproducible_html_notes.py b/bin/reproducible_html_notes.py index 535ea9cc..8fc3cb06 100755 --- a/bin/reproducible_html_notes.py +++ b/bin/reproducible_html_notes.py @@ -366,8 +366,7 @@ def iterate_over_notes(notes): title = 'Notes for ' + package + ' - reproducible builds result' destfile = NOTES_PATH + '/' + package + '_note.html' - write_html_page(title=title, body=html, destfile=destfile, - noheader=True) + write_html_page(title=title, body=html, destfile=destfile) desturl = REPRODUCIBLE_URL + NOTES_URI + '/' + package + '_note.html' log.debug("Note created: " + desturl) @@ -386,8 +385,9 @@ def iterate_over_issues(issues): title = 'Notes about issue ' + issue + ' in ' + suite destfile = ISSUES_PATH + '/' + suite + '/' + issue + '_issue.html' + left_nav_html = create_main_navigation(displayed_page='issues') write_html_page(title=title, body=html, destfile=destfile, - style_note=True, displayed_page='issues') + style_note=True, left_nav_html=left_nav_html) desturl = REPRODUCIBLE_URL + ISSUES_URI + '/' + suite + '/' + issue + '_issue.html' log.debug("Issue created: " + desturl) @@ -450,8 +450,9 @@ def index_issues(issues, scorefuncs): title = 'Known issues related to reproducible builds' destfile = DEBIAN_BASE + '/index_issues.html' desturl = DEBIAN_URL + '/index_issues.html' + left_nav_html = create_main_navigation(displayed_page='issues') write_html_page(title=title, body=html, destfile=destfile, - displayed_page='issues') + left_nav_html=left_nav_html) log.info('Issues index now available at ' + desturl) diff --git a/bin/reproducible_html_packages.py b/bin/reproducible_html_packages.py index e323853f..2a018d8d 100755 --- a/bin/reproducible_html_packages.py +++ b/bin/reproducible_html_packages.py @@ -259,7 +259,7 @@ def gen_history_page(package): destfile = os.path.join(HISTORY_PATH, package.name+'.html') title = 'build history of {}'.format(package.name) write_html_page(title=title, body=html, destfile=destfile, - noheader=True, noendpage=True) + noendpage=True) def gen_packages_html(packages, no_clean=False): @@ -317,7 +317,7 @@ def gen_packages_html(packages, no_clean=False): '/' + arch + '/' + pkg + '.html' title = pkg + ' - reproducible build results' write_html_page(title=title, body=html, destfile=destfile, - noheader=True, noendpage=True, packages=True) + no_header=True, noendpage=True) log.debug("Package page generated at " + desturl) if not no_clean: purge_old_pages() # housekeep is always good diff --git a/bin/reproducible_html_pkg_sets.py b/bin/reproducible_html_pkg_sets.py index 7a81ac6c..dbdca135 100755 --- a/bin/reproducible_html_pkg_sets.py +++ b/bin/reproducible_html_pkg_sets.py @@ -143,12 +143,17 @@ def create_index_page(suite, arch): "index_pkg_sets.html") suite_arch_nav_template = DEBIAN_URI + \ '/{{suite}}/{{arch}}/index_pkg_sets.html' + left_nav_html = create_main_navigation( + suite=suite, + arch=arch, + displayed_page='pkg_set', + suite_arch_nav_template=suite_arch_nav_template, + ignore_experimental=True, + ) log.info("Creating pkgset index page for %s/%s.", suite, arch) - write_html_page(title=title, body=body, destfile=destfile, suite=suite, - arch=arch, displayed_page='pkg_set', - suite_arch_nav_template=suite_arch_nav_template, - ignore_experimental=True) + write_html_page(title=title, body=body, destfile=destfile, + left_nav_html=left_nav_html) def gen_other_arch_context(archs, suite, pkgset_name): @@ -242,12 +247,17 @@ def create_pkgset_page_and_graphs(suite, arch, stats, pkgset_name): page = "pkg_set_" + pkgset_name + ".html" destfile = os.path.join(DEBIAN_BASE, suite, arch, page) suite_arch_nav_template = DEBIAN_URI + '/{{suite}}/{{arch}}/' + page + left_nav_html = create_main_navigation( + suite=suite, + arch=arch, + displayed_page='pkg_set', + suite_arch_nav_template=suite_arch_nav_template, + ignore_experimental=True, + ) log.info("Creating meta pkgset page for %s in %s/%s.", pkgset_name, suite, arch) - write_html_page(title=title, body=html_body, destfile=destfile, suite=suite, - arch=arch, displayed_page='pkg_set', - suite_arch_nav_template=suite_arch_nav_template, - ignore_experimental=True) + write_html_page(title=title, body=html_body, destfile=destfile, + left_nav_html=left_nav_html) def create_pkgset_graph(png_file, suite, arch, pkgset_name): diff --git a/bin/templates/basic_page.mustache b/bin/templates/basic_page.mustache index 97a60d06..0263a3a2 100644 --- a/bin/templates/basic_page.mustache +++ b/bin/templates/basic_page.mustache @@ -3,17 +3,21 @@ <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta name="viewport" content="width=device-width" /> - {{meta_refresh}} + {{{meta_refresh}}} <link href="/static/style.css" type="text/css" rel="stylesheet" /> <title>{{page_title}}</title> </head> <body class="wrapper"> + {{#navigation_html}} <header class="head"> - {{{main_navigation_html}}} + {{{navigation_html}}} </header> - <div class="mainbody"> - <h2>{{page_title}}</h2> + {{/navigation_html}} + {{#navigation_html}}<div class="mainbody">{{/navigation_html}} + {{#main_header}} + <h2>{{main_header}}</h2> + {{/main_header}} {{{main_html}}} - </div> + {{#navigation_html}}</div>{{/navigation_html}} </body> </html> |