summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorValerie R Young <spectranaut@riseup.net>2016-06-17 13:25:19 -0400
committerHolger Levsen <holger@layer-acht.org>2016-06-17 23:31:29 +0200
commita38157cc26a612b1be67857bdeac3210b0d04928 (patch)
treee3d3dd4b14f037f723d5a7e6b913f9e1a7a38c1a /bin
parent0c3fcd537bd06556cda1d290ee926e8365969a04 (diff)
downloadjenkins.debian.net-a38157cc26a612b1be67857bdeac3210b0d04928.tar.xz
reproducible debian: add notes about notes to package page
On the package page, if there are no notes: - if the package is not reproducible, you will see a prompt encouraging the user to add notes - if the package is reproducible, you will see a congratulatory message. Signed-off-by: Holger Levsen <holger@layer-acht.org>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/reproducible_html_packages.py45
-rw-r--r--bin/templates/package_page.mustache8
2 files changed, 50 insertions, 3 deletions
diff --git a/bin/reproducible_html_packages.py b/bin/reproducible_html_packages.py
index f9d26198..51a4b363 100755
--- a/bin/reproducible_html_packages.py
+++ b/bin/reproducible_html_packages.py
@@ -11,6 +11,8 @@
from reproducible_common import *
import pystache
+import apt_pkg
+apt_pkg.init_system()
# Templates used for creating package pages
renderer = pystache.Renderer();
@@ -143,7 +145,35 @@ def gen_suitearch_details(package, version, suite, arch, status, spokenstatus,
suitearch_details_html = renderer.render(suitearch_details_template, context)
return (suitearch_details_html, default_view)
+
+def determine_reproducibility(status1, version1, status2, version2):
+ newstatus = ''
+ versionscompared = apt_pkg.version_compare(version1, version2);
+
+ # if version1 > version2,
+ # ignore the older package (version2)
+ if (versionscompared > 0):
+ return status1, version1
+
+ # if version1 < version2,
+ # ignore the older package (version1)
+ elif (versionscompared < 0):
+ return status2, version2
+
+ # if version1 == version 2,
+ # we are comparing status for the same (most recent) version
+ else:
+ if status1 == 'reproducible' and status2 == 'reproducible':
+ return 'reproducible', version1
+ else:
+ return 'not_reproducible', version1
+
+
def gen_suitearch_section(package, current_suite, current_arch):
+ # keep track of whether the package is entirely reproducible
+ final_version = ''
+ final_status = ''
+
default_view = ''
context = {}
context['architectures'] = []
@@ -157,6 +187,13 @@ def gen_suitearch_section(package, current_suite, current_arch):
continue
version = package.get_tested_version(s, a)
+ if not final_version or not final_status:
+ final_version = version
+ final_status = status
+ else:
+ final_status, final_version = determine_reproducibility(
+ final_status, final_version, status, version)
+
build_date = package.get_build_date(s, a)
status, icon, spokenstatus = get_status_icon(status)
@@ -195,7 +232,8 @@ def gen_suitearch_section(package, current_suite, current_arch):
})
html = renderer.render(suitearch_section_template, context)
- return html, default_view
+ reproducible = True if final_status == 'reproducible' else False
+ return html, default_view, reproducible
def shorten_if_debiannet(hostname):
if hostname[-11:] == '.debian.net':
@@ -264,8 +302,8 @@ def gen_packages_html(packages, no_clean=False):
log.debug('Generating the page of %s/%s/%s @ %s built at %s',
pkg, suite, arch, version, build_date)
- suitearch_section_html, default_view = gen_suitearch_section(
- package, suite, arch)
+ suitearch_section_html, default_view, reproducible = \
+ gen_suitearch_section(package, suite, arch)
history = '{}/{}.html'.format(HISTORY_URI, pkg)
project_links = html_project_links.substitute()
@@ -281,6 +319,7 @@ def gen_packages_html(packages, no_clean=False):
'suitearch_section_html': suitearch_section_html,
'project_links_html': project_links,
'default_view': default_view,
+ 'reproducible': reproducible,
'dashboard_url': DEBIAN_URL,
})
diff --git a/bin/templates/package_page.mustache b/bin/templates/package_page.mustache
index 059bffb0..578d8edf 100644
--- a/bin/templates/package_page.mustache
+++ b/bin/templates/package_page.mustache
@@ -9,6 +9,14 @@
{{#notes_uri}}
<li><a href="{{notes_uri}}" title="Additional commentary on this packages unreproduciblity"target="main">notes</a></li>
{{/notes_uri}}
+ {{^notes_uri}}
+ {{^reproducible}}
+ <li>No notes exist for this package. <a href="https://anonscm.debian.org/git/reproducible/notes.git/tree/README">Add some.</a></li>
+ {{/reproducible}}
+ {{#reproducible}}
+ <li>Good work! This package is reproducible :)</li>
+ {{/reproducible}}
+ {{/notes_uri}}
<li>
<a href="{{history}}" target="main">test history</a>
</li>