summaryrefslogtreecommitdiffstats
path: root/bin/reproducible_html_packages.py
diff options
context:
space:
mode:
authorMattia Rizzolo <mattia@mapreri.org>2015-10-09 15:24:03 +0000
committerMattia Rizzolo <mattia@mapreri.org>2015-10-09 15:39:03 +0000
commit605b2b71ba35bf22f84add00dd2d11dc24783547 (patch)
treedfb7a158c1301e8b05c190377658801dbb63b699 /bin/reproducible_html_packages.py
parentd1599889a9d75f7c5682a772ceb786e840cf319e (diff)
downloadjenkins.debian.net-605b2b71ba35bf22f84add00dd2d11dc24783547.tar.xz
reproducible: Add a history page, with a table with all the builds done of that package. Link it in the rb-pkg pages.
Diffstat (limited to 'bin/reproducible_html_packages.py')
-rwxr-xr-xbin/reproducible_html_packages.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/bin/reproducible_html_packages.py b/bin/reproducible_html_packages.py
index c3094cf3..39bbbd1a 100755
--- a/bin/reproducible_html_packages.py
+++ b/bin/reproducible_html_packages.py
@@ -36,6 +36,9 @@ html_package_page = Template((tab*2).join(("""
<li><a href="https://sources.debian.net/src/$package/$version/debian/rules">rules</a></li>
</ul>
</li>
+ <li>
+ <a href=$history" target="main">Build history</a>
+ </li>
</ul>
${suites_links}
@@ -205,6 +208,34 @@ def gen_suites_links(package, current_suite, current_arch):
return tab*5 + (tab*7).join(html.splitlines(True))
+def gen_history_page(package):
+ keys = ('build date', 'version', 'suite', 'architecture', 'result',
+ 'build duration', 'builder')
+ try:
+ head = package.history[0]
+ except IndexError:
+ html = '<p>No historical data available for this package.</p>'
+ return
+ else:
+ html = '<table>\n{tab}<tr>\n{tab}{tab}'.format(tab=tab)
+ for i in keys:
+ html += '<th>{}</th>'.format(i)
+ html += '\n{tab}</tr>'.format(tab=tab)
+ for record in package.history:
+ # huma formatting of build duration
+ record['build duration'] = convert_into_hms_string(
+ int(record['build duration']))
+ html += '\n{tab}<tr>\n{tab}{tab}'.format(tab=tab)
+ for i in keys:
+ html += '<td>{}</td>'.format(record[i])
+ html += '\n{tab}</tr>'.format(tab=tab)
+ html += '</table>'
+ destfile = os.path.join(HISTORY_PATH, package.name+'.html')
+ title = 'build history of {}'.format(package.name)
+ write_html_page(title=title, body=html, destfile=destfile,
+ noheader=True, noendpage=True)
+
+
def gen_packages_html(packages, no_clean=False):
"""
generate the /rb-pkg/package.html pages.
@@ -214,6 +245,7 @@ def gen_packages_html(packages, no_clean=False):
log.debug('Generating the pages of ' + str(total) + ' package(s)')
for package in sorted(packages, key=lambda x: x.name):
assert isinstance(package, Package)
+ gen_history_page(package)
pkg = package.name
for suite in SUITES:
for arch in ARCHS:
@@ -236,6 +268,7 @@ def gen_packages_html(packages, no_clean=False):
suites_links = gen_suites_links(package, suite, arch)
status, icon, spokenstatus = get_status_icon(status)
status = gen_status_link_icon(status, spokenstatus, icon, suite, arch)
+ history = '{}/{}.html'.format(HISTORY_URI, pkg)
html = html_package_page.substitute(
package=pkg,
@@ -244,6 +277,7 @@ def gen_packages_html(packages, no_clean=False):
status=status,
version=version,
build_time=build_date,
+ history=history,
links=links,
notify_maintainer=package.notify_maint,
suites_links=suites_links,