summaryrefslogtreecommitdiffstats
path: root/bin/reproducible_common.py
diff options
context:
space:
mode:
authorValerie R Young <spectranaut@riseup.net>2016-08-03 16:07:45 -0400
committerHolger Levsen <holger@layer-acht.org>2016-08-03 22:10:23 +0200
commitd657beb8211fdfe146019a22198694dfc194d3ad (patch)
tree3339e3aac01e1556bd3b4a30235bd584a7853c21 /bin/reproducible_common.py
parentfa3ed47dd9da01e3e37b20457946d7e06e11ccb4 (diff)
downloadjenkins.debian.net-d657beb8211fdfe146019a22198694dfc194d3ad.tar.xz
reproducible debian: remove suite or arch nav when not relevent for page
Signed-off-by: Holger Levsen <holger@layer-acht.org>
Diffstat (limited to 'bin/reproducible_common.py')
-rwxr-xr-xbin/reproducible_common.py59
1 files changed, 29 insertions, 30 deletions
diff --git a/bin/reproducible_common.py b/bin/reproducible_common.py
index a149c85e..eeb4ffb6 100755
--- a/bin/reproducible_common.py
+++ b/bin/reproducible_common.py
@@ -260,38 +260,33 @@ def gen_suite_arch_nav_context(suite, arch, suite_arch_nav_template=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
+ if not suite_arch_nav_template:
+ suite_arch_nav_template = default_nav_template
+
suite_list = []
- for s in SUITES:
- include_suite = True
- if s == 'experimental' and ignore_experimental:
- include_suite = False
- suite_list.append({
- 's': s,
- 'class': 'current' if s == suite and not no_suite else '',
- 'uri': renderer.render(uri_template,
- {'suite': s, 'arch': arch})
- if include_suite else '',
- })
+ if not no_suite:
+ for s in SUITES:
+ include_suite = True
+ if s == 'experimental' and ignore_experimental:
+ include_suite = False
+ suite_list.append({
+ 's': s,
+ 'class': 'current' if s == suite else '',
+ 'uri': renderer.render(suite_arch_nav_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 and not no_arch else '',
- 'uri': renderer.render(uri_template,
- {'suite': suite, 'arch': a}),
- })
+ if not no_arch:
+ for a in ARCHS:
+ arch_list.append({
+ 'a': a,
+ 'class': 'current' if a == arch else '',
+ 'uri': renderer.render(suite_arch_nav_template,
+ {'suite': suite, 'arch': a}),
+ })
return (suite_list, arch_list)
# See bash equivelent: reproducible_common.sh's "write_page_header()"
@@ -305,8 +300,12 @@ def create_main_navigation(suite=defaultsuite, arch=defaultarch,
'suite': suite,
'arch': arch,
'project_links_html': renderer.render(project_links_template),
- 'suite_list': suite_list,
- 'arch_list': arch_list,
+ 'suite_nav': {
+ 'suite_list': suite_list
+ } if len(suite_list) else '',
+ 'arch_nav': {
+ 'arch_list': arch_list
+ } if len(arch_list) else '',
'debian_uri': DEBIAN_DASHBOARD_URI,
'cross_suite_arch_nav': True if suite_arch_nav_template else False,
}