summaryrefslogtreecommitdiffstats
path: root/bin/reproducible_common.py
diff options
context:
space:
mode:
authorValerie R Young <spectranaut@riseup.net>2016-06-22 17:39:11 -0400
committerHolger Levsen <holger@layer-acht.org>2016-07-17 15:08:06 +0200
commit6610b45c60bfe958fb1ce2a351bd4d34fc57cad3 (patch)
treeef682602a487be986df95ce629cf77dbb5011ee3 /bin/reproducible_common.py
parent7ed0bf9e0d2c565decebb56686716d63078705aa (diff)
downloadjenkins.debian.net-6610b45c60bfe958fb1ce2a351bd4d34fc57cad3.tar.xz
reproducible debian: rewrite reproducible_html_pkg_sets in python
Signed-off-by: Mattia Rizzolo <mattia@debian.org> Signed-off-by: Holger Levsen <holger@layer-acht.org>
Diffstat (limited to 'bin/reproducible_common.py')
-rwxr-xr-xbin/reproducible_common.py25
1 files changed, 16 insertions, 9 deletions
diff --git a/bin/reproducible_common.py b/bin/reproducible_common.py
index 28b4add4..95b652e3 100755
--- a/bin/reproducible_common.py
+++ b/bin/reproducible_common.py
@@ -24,8 +24,8 @@ import pystache
import psycopg2
import html as HTML
from string import Template
-from subprocess import call
from traceback import print_exception
+from subprocess import call, check_call
from tempfile import NamedTemporaryFile
from datetime import datetime, timedelta
@@ -49,6 +49,7 @@ BIN_PATH = '/srv/jenkins/bin'
BASE = '/var/lib/jenkins/userContent/reproducible'
DEBIAN_BASE = '/var/lib/jenkins/userContent/reproducible/debian'
TEMPLATE_PATH = BIN_PATH + '/templates'
+PKGSET_DEF_PATH = '/srv/reproducible-results'
TEMP_PATH="/tmp/reproducible"
REPRODUCIBLE_JSON = BASE + '/reproducible.json'
@@ -143,7 +144,7 @@ if args.ignore_missing_files:
tab = ' '
# Templates used for creating package pages
-renderer = pystache.Renderer();
+renderer = pystache.Renderer()
status_icon_link_template = renderer.load_template(
TEMPLATE_PATH + '/status_icon_link')
default_page_footer_template = renderer.load_template(
@@ -260,11 +261,13 @@ def create_main_navigation(page_title, suite, arch, displayed_page=None):
'suite': suite,
'arch': arch,
'project_links_html': renderer.render(project_links_template),
- 'experimental': False,
'suite_list': [{'s': s} for s in SUITES],
'arch_list': [{'a': a} for a in ARCHS],
'debian_url': DEBIAN_URL,
}
+ if suite != 'experimental':
+ # there are not package sets in experimental
+ context['include_pkgset_link'] = True
# this argument controls which of the main page navigation items will be
# highlighted.
if displayed_page:
@@ -289,15 +292,18 @@ def write_html_page(title, body, destfile, suite=defaultsuite, arch=defaultarch,
arch=arch,
displayed_page=displayed_page,
)
-
+ # Add the 'mainbody' div only if including a header
+ html += "<div class='mainbody'>"
html += body
if style_note:
html += renderer.render(pkg_legend_template, {})
if not noendpage:
html += create_default_page_footer(now)
- html += '</body>\n</html>'
- else:
- html += '</body>\n</html>'
+ if not noheader:
+ # If the header was included, we need to end the 'mainbody' div after
+ # the 'mainbody' content
+ html += '</div>'
+ html += '</body>\n</html>'
try:
os.makedirs(destfile.rsplit('/', 1)[0], exist_ok=True)
except OSError as e:
@@ -414,8 +420,9 @@ def link_package(package, suite, arch, bugs={}, popcon=None, is_popular=None):
return html
-def link_packages(packages, suite, arch):
- bugs = get_bugs()
+def link_packages(packages, suite, arch, bugs=None):
+ if bugs is None:
+ bugs = get_bugs()
html = ''
for pkg in packages:
html += link_package(pkg, suite, arch, bugs)