summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorMattia Rizzolo <mattia@mapreri.org>2015-08-21 22:29:50 +0000
committerHolger Levsen <holger@layer-acht.org>2015-08-22 12:07:00 +0200
commite7d74461fd32f2da2396dd4c31c8bd81f5d3009a (patch)
tree1fb23141f7e69c8bec47fb7860224a14b03aa980 /bin
parente7ee301790c725eb8a5f65b982787af89155d349 (diff)
downloadjenkins.debian.net-e7d74461fd32f2da2396dd4c31c8bd81f5d3009a.tar.xz
reproducible: completely refactor the package pages. Really thanks to Ulrike Uhlig <u@451f.org> for the great help!
Diffstat (limited to 'bin')
-rwxr-xr-xbin/reproducible_common.py17
-rwxr-xr-xbin/reproducible_common.sh4
-rwxr-xr-xbin/reproducible_html_packages.py179
3 files changed, 112 insertions, 88 deletions
diff --git a/bin/reproducible_common.py b/bin/reproducible_common.py
index 1616508f..0fc45218 100755
--- a/bin/reproducible_common.py
+++ b/bin/reproducible_common.py
@@ -120,11 +120,12 @@ tab = ' '
html_header = Template("""<!DOCTYPE html>
<html>
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <meta name="viewport" content="width=device-width" />
<link href="/static/style.css" type="text/css" rel="stylesheet" />
<title>$page_title</title>
</head>
- <body>""")
+ <body $padding>""")
html_footer = Template("""
<hr />
<p style="font-size:0.9em;">
@@ -143,7 +144,7 @@ html_footer = Template("""
html_head_page = Template((tab*2).join("""
<header>
<h2>$page_title</h2>
- <ul>
+ <nav><ul>
<li>Have a look at:</li>
<li>
<a href="/$suite/$arch/index_reproducible.html" target="_parent">
@@ -188,7 +189,7 @@ $links
<li><a href="/index_repositories.html">repositories overview</a></li>
<li><a href="/reproducible.html">reproducible stats</a></li>
<li><a href="https://wiki.debian.org/ReproducibleBuilds" target="_blank">wiki</a></li>
- </ul>
+ </ul></nav>
</header>""".splitlines(True)))
@@ -278,10 +279,14 @@ def _gen_links(suite, arch):
return html
-def write_html_page(title, body, destfile, suite=defaultsuite, arch=defaultarch, noheader=False, style_note=False, noendpage=False):
+def write_html_page(title, body, destfile, suite=defaultsuite, arch=defaultarch, noheader=False, style_note=False, noendpage=False, packages=False):
now = datetime.utcnow().strftime('%Y-%m-%d %H:%M UTC')
html = ''
- html += html_header.substitute(page_title=title)
+ # this removes the padding if we are writing a package page
+ padding = 'class="wrapper"' if packages else ''
+ html += html_header.substitute(
+ page_title=title,
+ padding=padding)
if not noheader:
links = _gen_links(suite, arch)
html += html_head_page.substitute(
diff --git a/bin/reproducible_common.sh b/bin/reproducible_common.sh
index 6a34133d..feab474c 100755
--- a/bin/reproducible_common.sh
+++ b/bin/reproducible_common.sh
@@ -187,7 +187,7 @@ write_page_header() {
write_page " to get support for making sure your packages build reproducibly too. Also, we care about free software in general, so if you are an upstream developer or working on another distribution, we'd love to hear from you! Just now we've started to programatically test <a href=\"/coreboot/\">coreboot</a>, <a href=\"/openwrt/\">OpenWrt</a> and <a href=\"$JENKINS_URL/userContent/todo.html#_reproducible_netbsd\">NetBSD</a> - and there are plans to test <a href=\"$JENKINS_URL/userContent/todo.html#_reproducible_fedora\">Fedora</a> and <a href=\"$JENKINS_URL/userContent/todo.html#_reproducible_freebsd\">FreeBSD</a> soon too."
write_page "</p>"
fi
- write_page "<ul><li>Have a look at:</li>"
+ write_page "<nav><ul><li>Have a look at:</li>"
for MY_STATE in $ALLSTATES ; do
set_icon $MY_STATE
write_page "<li>"
@@ -237,7 +237,7 @@ write_page_header() {
fi
done
write_page "<li><a href=\"https://wiki.debian.org/ReproducibleBuilds\" target=\"_blank\">wiki</a></li>"
- write_page "</ul>"
+ write_page "</ul></nav>"
if [ "$1" = "$MAINVIEW" ] ; then
LATEST=$(sqlite3 -init $INIT ${PACKAGES_DB} "SELECT s.name FROM results AS r JOIN sources AS s ON r.package_id = s.id WHERE r.status IN ('unreproducible') AND s.suite = 'unstable' AND s.architecture = 'amd64' AND s.id NOT IN (SELECT package_id FROM notes) ORDER BY build_date DESC LIMIT 23"|sort -R|head -1)
write_page "<form action=\"https://reproducible.debian.net/redirect\" method=\"GET\">https://reproducible.debian.net/"
diff --git a/bin/reproducible_html_packages.py b/bin/reproducible_html_packages.py
index 0d46cce2..a1e1e2fb 100755
--- a/bin/reproducible_html_packages.py
+++ b/bin/reproducible_html_packages.py
@@ -12,38 +12,47 @@
from reproducible_common import *
html_package_page = Template((tab*2).join(("""
-<table class="head">
- <tr>
- <td>
- <span class="avoidwrap">
- <span style="font-size:1.2em;">$package</span> $suite/$arch: $version
-$status
- <span style="font-size:0.9em;">$build_time:</span>
- </span>
- <span class="avoidwrap">
-$links
- <a href="https://tracker.debian.org/$package" target="main">PTS</a>
- <a href="https://bugs.debian.org/src:$package" target="main">BTS</a>
- <a href="https://sources.debian.net/src/$package/$version/" target="main">sources</a>
- <a href="https://sources.debian.net/src/$package/$version/debian/" target="main">debian</a>/<!--
- -->{<a href="https://sources.debian.net/src/$package/$version/debian/changelog" target="main">changelog</a>,<!--
- --><a href="https://sources.debian.net/src/$package/$version/debian/control" target="main">control</a>,<!--
- --><a href="https://sources.debian.net/src/$package/$version/debian/rules" target="main">rules</a>}
- </span>
- </td>
- <td>
+<header class="head">
+ <h2 class="package-name">$package</h2>
+ <p style="margin-top: 4px;">
+ $version
+ <a href="/index_notify.html" target="_parent">
+ <span class="notification" title="Notifications for this packages are enabled. Every status change reproducibly-wise will be emailed to the maintainer">$notify_maintainer</span>
+ </a><br />
+ $suite/$arch <br />
+ $status <br />
+ <span class="build-time">$build_time</span>
+ </p>
+ <ul class="menu">
+ <li><ul class="children">
+ $links
+ </ul></li>
+ <li>
+ <a href="https://tracker.debian.org/$package" target="main">PTS</a>
+ <a href="https://bugs.debian.org/src:$package" target="main">BTS</a>
+ </li>
+ <li>
+ <a href="https://sources.debian.net/src/$package/$version/" target="main">sources</a>
+ <a href="https://sources.debian.net/src/$package/$version/debian" target="main">debian/</a>
+ <ul class="children">
+ <li><a href="https://sources.debian.net/src/$package/$version/debian/changelog" target="main">changelog</a></li>
+ <li><a href="https://sources.debian.net/src/$package/$version/debian/control" target="main">control</a></li>
+ <li><a href="https://sources.debian.net/src/$package/$version/debian/rules" target="main">rules</a></li>
+ </ul>
+ </li>
+ </ul>
+
${suites_links}
- </td>
- <td style="text-align:right; font-size:0.9em;">
- <a href="/index_notify.html" target="_parent">
- <span class="red" style="font-size:1.5em;" title="Notifications for this packages are enabled. Every status change reproducibly-wise will be emailed to the maintainer">$notify_maintainer</span>
- </a>
- <a href="%s" target="_parent">
- reproducible builds
- </a>
- </td>
- </tr>
-</table>
+
+ <ul class="reproducible-links">
+ <li>
+ <a href="%s">Reproducible Builds</a><br />
+ <a href="https://wiki.debian.org/ReproducibleBuilds">Reproducible Wiki</a><br />
+ <a href="https://reproducible.debian.net/howto">Reproducible HowTo</a>
+ </li>
+ </ul>
+</header>
+
<iframe id="main" name="main" src="${default_view}">
<p>
Your browser does not support iframes.
@@ -69,6 +78,7 @@ def gen_status_link_icon(status, icon, suite, arch):
html += tab*6 + '<a href="/{suite}/{arch}/index_{status}.html"' + \
' target="_parent" title="{status}">\n'
html += tab*9 + '<img src="/static/{icon}" alt="{status}" />\n'
+ html += tab*9 + ' {status}\n'
if status != 'untested':
html += tab*8 + '</a>\n'
return html.format(status=status, icon=icon, suite=suite, arch=arch)
@@ -88,45 +98,51 @@ def link_buildlogs(package, eversion, suite, arch):
return html
+def link_diffs(package, eversion, suite, arch, status):
+ html = ''
+ dbd = DBD_PATH + '/' + suite + '/' + arch + '/' + package + '_' + \
+ eversion + '.debbindiff.html'
+ dbdtxt = DBDTXT_PATH + '/' + suite + '/' + arch + '/' + package + '_' + \
+ eversion + '.debbindiff.txt.gz'
+ dbd_url = DBD_URI + '/' + suite + '/' + arch + '/' + package + '_' + \
+ eversion + '.debbindiff.html'
+ dbdtxt_url = DBDTXT_URI + '/' + suite + '/' + arch + '/' + package + '_' + \
+ eversion + '.debbindiff.txt'
+ if os.access(dbd, os.R_OK):
+ html += '<li><a href="' + dbd_url + '" target="main">differences</a>\n'
+ if os.access(dbdtxt, os.R_OK):
+ html += '<a href="' + dbdtxt_url + '" target="main">(txt)</a>\n'
+ html += '</li>\n'
+ else:
+ log.debug('debbindiff not detetected at ' + dbd)
+ if status == 'unreproducible' and not args.ignore_missing_files:
+ log.critical(REPRODUCIBLE_URL + '/' + suite + '/' + arch + '/' + package +
+ ' is unreproducible, but without diffoscope output.')
+ return html, dbd_url
+
+
def gen_extra_links(package, version, suite, arch, status):
eversion = strip_epoch(version)
notes = NOTES_PATH + '/' + package + '_note.html'
buildinfo = BUILDINFO_PATH + '/' + suite + '/' + arch + '/' + package + \
'_' + eversion + '_' + arch + '.buildinfo'
- dbd = DBD_PATH + '/' + suite + '/' + arch + '/' + package + '_' + \
- eversion + '.debbindiff.html'
- dbdtxt = DBDTXT_PATH + '/' + suite + '/' + arch + '/' + package + '_' + \
- eversion + '.debbindiff.txt.gz'
links = ''
default_view = ''
if os.access(notes, os.R_OK):
url = NOTES_URI + '/' + package + '_note.html'
- links += '<a href="' + url + '" target="main">notes</a>\n'
+ links += '<li><a href="' + url + '" target="main">notes</a></li>\n'
default_view = url
else:
log.debug('notes not detected at ' + notes)
- if os.access(dbd, os.R_OK):
- url = DBD_URI + '/' + suite + '/' + arch + '/' + package + '_' + \
- eversion + '.debbindiff.html'
- links += '<a href="' + url + '" target="main">debbindiff</a>\n'
- if not default_view:
- default_view = url
- else:
- log.debug('debbindiff not detetected at ' + dbd)
- if status == 'unreproducible' and not args.ignore_missing_files:
- log.critical(REPRODUCIBLE_URL + '/' + suite + '/' + arch + '/' + package +
- ' is unreproducible, but without diffoscope output.')
- if os.access(dbdtxt, os.R_OK):
- url = DBDTXT_URI + '/' + suite + '/' + arch + '/' + package + '_' + \
- eversion + '.debbindiff.txt'
- links += '<a href="' + url + '" target="main">(txt)</a>\n'
- if not default_view:
- default_view = url
+ dbd = link_diffs(package, eversion, suite, arch, status)
+ links += dbd[0] if dbd[0] else ''
+ if dbd[0] and not default_view:
+ default_view = dbd[1]
if pkg_has_buildinfo(package, version, suite):
url = BUILDINFO_URI + '/' + suite + '/' + arch + '/' + package + \
'_' + eversion + '_' + arch + '.buildinfo'
- links += '<a href="' + url + '" target="main">buildinfo</a>\n'
+ links += '<li><a href="' + url + '" target="main">buildinfo</a></li>\n'
if not default_view:
default_view = url
elif not args.ignore_missing_files and status not in \
@@ -136,40 +152,43 @@ def gen_extra_links(package, version, suite, arch, status):
if rbuild: # being a tuple (rbuild path, size), empty if non existant
url = RBUILD_URI + '/' + suite + '/' + arch + '/' + package + '_' + \
eversion + '.rbuild.log' # apache ignores the trailing .gz
- links +='<a href="' + url + '" target="main">rbuild (' + \
+ links +='<li><a href="' + url + '" target="main">rbuild (' + \
sizeof_fmt(rbuild[1]) + ')</a>\n'
if not default_view:
default_view = url
+ links += link_buildlogs(package, eversion, suite, arch) + '</li>\n'
elif status not in ('untested', 'blacklisted') and not args.ignore_missing_files:
log.critical(REPRODUCIBLE_URL + '/' + suite + '/' + arch + '/' + package +
' didn\'t produce a buildlog, even though it has been built.')
- links += link_buildlogs(package, eversion, suite, arch)
default_view = '/untested.html' if not default_view else default_view
return (links, default_view)
-def gen_suites_links(package, suite, arch):
- html = ''
- for s in SUITES:
- if s == suite: # don't link the current suite
- continue
- status = package.get_status(s, arch)
- if not status: # The package is not available in that suite/arch
- continue
- version = package.get_tested_version(s, arch)
- html += '<span class="avoidwrap">\n' + tab
- if status != 'untested':
- prefix = '<a href="/{}/{}/index_{}.html">'.format(s, arch, status)
- suffix = '</a>\n'
- else:
- prefix = ''
- suffix = '\n'
- icon = prefix + '<img src="/static/{icon}" alt="{status}" title="{status}"/>' + suffix
- html += icon.format(icon=join_status_icon(status)[1], status=status)
- html += tab + ' <a href="' + RB_PKG_URI + '/' + s + '/' + arch + \
- '/' + package.name + '.html" target="_parent">' + s + \
- ':' + version + '</a>\n'
- html += '</span>\n'
+def gen_suites_links(package):
+ html = '<ul>\n'
+ for a in ARCHS:
+ html += tab + '<li>{}\n'.format(a)
+ html += tab + '<ul class="children">\n'
+ for s in SUITES:
+ status = package.get_status(s, a)
+ if not status: # The package is not available in that suite/arch
+ continue
+ version = package.get_tested_version(s, a)
+ html += '<li><span class="suite">\n' + tab
+ if status != 'untested':
+ prefix = '<a href="/{}/{}/index_{}.html">'.format(s, a, status)
+ suffix = '</a>\n'
+ else:
+ prefix = ''
+ suffix = '\n'
+ icon = prefix + '<img src="/static/{icon}" alt="{status}" title="{status}"/>' + suffix
+ html += icon.format(icon=join_status_icon(status)[1], status=status)
+ html += (tab*2 + ' <a href="{}/{}/{}/{}.html" target="_parent"' + \
+ ' title="{}: {}">{}</a></li>\n').format(RB_PKG_URI,
+ s, a, package.name, status, version, s)
+ html += '</span>\n'
+ html += tab + '</ul></li>'
+ html += '</ul>\n'
return tab*5 + (tab*7).join(html.splitlines(True))
@@ -195,7 +214,7 @@ def gen_packages_html(packages, no_clean=False):
links, default_view = gen_extra_links(
pkg, version, suite, arch, status)
- suites_links = gen_suites_links(package, suite, arch)
+ suites_links = gen_suites_links(package)
status, icon = join_status_icon(status, pkg, version)
status = gen_status_link_icon(status, icon, suite, arch)
@@ -215,7 +234,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)
+ noheader=True, noendpage=True, indexes=True)
log.debug("Package page generated at " + desturl)
if not no_clean:
purge_old_pages() # housekeep is always good