From 605b2b71ba35bf22f84add00dd2d11dc24783547 Mon Sep 17 00:00:00 2001 From: Mattia Rizzolo Date: Fri, 9 Oct 2015 15:24:03 +0000 Subject: reproducible: Add a history page, with a table with all the builds done of that package. Link it in the rb-pkg pages. --- bin/reproducible_html_packages.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'bin/reproducible_html_packages.py') 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(("""
  • rules
  • +
  • + Build history +
  • ${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 = '

    No historical data available for this package.

    ' + return + else: + html = '\n{tab}\n{tab}{tab}'.format(tab=tab) + for i in keys: + html += ''.format(i) + html += '\n{tab}'.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}\n{tab}{tab}'.format(tab=tab) + for i in keys: + html += ''.format(record[i]) + html += '\n{tab}'.format(tab=tab) + html += '
    {}
    {}
    ' + 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, -- cgit v1.2.3-54-g00ecf