From b8bc3d3d2bd2b730871f537b8d78a6dae937249a Mon Sep 17 00:00:00 2001 From: Valerie R Young Date: Tue, 2 Aug 2016 18:36:51 -0400 Subject: reproducible debian: add cross suite/arch nav for scheduled and maintainers Signed-off-by: Holger Levsen --- bin/reproducible_common.py | 34 +++++++++++++++++++++++----------- bin/reproducible_html_dd_list.py | 4 +++- bin/reproducible_html_live_status.py | 5 +++-- 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/bin/reproducible_common.py b/bin/reproducible_common.py index 0a027b0b..a149c85e 100755 --- a/bin/reproducible_common.py +++ b/bin/reproducible_common.py @@ -256,11 +256,16 @@ def convert_into_hms_string(duration): def gen_suite_arch_nav_context(suite, arch, suite_arch_nav_template=None, - ignore_experimental=False): - # if a template is not passed in to navigate between suite and archs - # for the current page, we use the suite/arch summary view - if not suite_arch_nav_template: - suite_arch_nav_template = '/debian/{{suite}}/index_suite_{{arch}}_stats.html' + ignore_experimental=False, no_suite=None, + no_arch=None): + # if a template is not passed in to navigate between suite and archs the + # current page, we use the "default" suite/arch summary view. + # OR if there is not suite equivalent for this page, use the default + # for suite links. + default_nav_template = '/debian/{{suite}}/index_suite_{{arch}}_stats.html' + uri_template = suite_arch_nav_template + if not uri_template or no_suite: + uri_template = default_nav_template suite_list = [] for s in SUITES: include_suite = True @@ -268,17 +273,23 @@ def gen_suite_arch_nav_context(suite, arch, suite_arch_nav_template=None, include_suite = False suite_list.append({ 's': s, - 'class': 'current' if s == suite else '', - 'uri': renderer.render(suite_arch_nav_template, + 'class': 'current' if s == suite and not no_suite else '', + 'uri': renderer.render(uri_template, {'suite': s, 'arch': arch}) if include_suite else '', }) + + # if there is no arch equivalents for this page, use the default + # for arch links. + uri_template = suite_arch_nav_template + if not uri_template or no_arch: + uri_template = default_nav_template arch_list = [] for a in ARCHS: arch_list.append({ 'a': a, - 'class': 'current' if a == arch else '', - 'uri': renderer.render(suite_arch_nav_template, + 'class': 'current' if a == arch and not no_arch else '', + 'uri': renderer.render(uri_template, {'suite': suite, 'arch': a}), }) return (suite_list, arch_list) @@ -286,9 +297,10 @@ def gen_suite_arch_nav_context(suite, arch, suite_arch_nav_template=None, # See bash equivelent: reproducible_common.sh's "write_page_header()" def create_main_navigation(suite=defaultsuite, arch=defaultarch, displayed_page=None, suite_arch_nav_template=None, - ignore_experimental=False): + ignore_experimental=False, no_suite=None, + no_arch=None): suite_list, arch_list = gen_suite_arch_nav_context(suite, arch, - suite_arch_nav_template, ignore_experimental) + suite_arch_nav_template, ignore_experimental, no_suite, no_arch) context = { 'suite': suite, 'arch': arch, diff --git a/bin/reproducible_html_dd_list.py b/bin/reproducible_html_dd_list.py index a0d56bc7..24d71307 100755 --- a/bin/reproducible_html_dd_list.py +++ b/bin/reproducible_html_dd_list.py @@ -73,8 +73,10 @@ for suite in SUITES: html += '

' title = 'Maintainers of unreproducible packages in ' + suite destfile = DEBIAN_BASE + '/' + suite + '/index_dd-list.html' + suite_arch_nav_template = DEBIAN_URI + '/{{suite}}/index_dd-list.html' left_nav_html = create_main_navigation(suite=suite, arch=arch, - displayed_page='dd_list') + displayed_page='dd_list', no_arch=True, + suite_arch_nav_template=suite_arch_nav_template) 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_live_status.py b/bin/reproducible_html_live_status.py index f10c2151..6db9aa7d 100755 --- a/bin/reproducible_html_live_status.py +++ b/bin/reproducible_html_live_status.py @@ -52,8 +52,9 @@ def generate_schedule(arch): html += '

\n' destfile = DEBIAN_BASE + '/index_' + arch + '_scheduled.html' desturl = DEBIAN_URL + '/index_' + arch + '_scheduled.html' - left_nav_html = create_main_navigation(arch=arch, - displayed_page='scheduled') + suite_arch_nav_template = DEBIAN_URI + '/index_{{arch}}_scheduled.html' + left_nav_html = create_main_navigation(arch=arch, no_suite=True, + displayed_page='scheduled', suite_arch_nav_template=suite_arch_nav_template) 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) -- cgit v1.2.3-54-g00ecf