#!/usr/bin/python3 # -*- coding: utf-8 -*- # # Copyright © 2015 Holger Levsen # based on ~jenkins.d.n:~mattia/status.sh by Mattia Rizzolo # Licensed under GPL-2 # # Depends: python3 # from reproducible_common import * def generate_live_status(): """ the schedule pages are very different than others index pages """ log.info('Building live status page...') title = 'Live status of reproducible.debian.net' query = 'SELECT s.id, s.name, s.version, s.suite, s.architecture AS arch, ' + \ 'p.scheduler, p.date_scheduled as "scheduled on", p.date_build_started AS "build started on", ' + \ 'r.status, r.version, r.build_duration AS duration, p.builder, p.notify' + \ 'FROM sources AS s JOIN schedule AS p ON p.package_id=s.id LEFT JOIN results AS r ON s.id=r.package_id' + \ 'WHERE p.scheduler != "" OR p.date_build_started != "" OR p.notify != ""' + \ 'ORDER BY date_scheduled desc;' html = '' rows = query_db(query) html += '

\n' + tab html += '' html += '' html += '' html += '' html += '\n' for row in rows: pkg = row[1] arch = row[4] suite = row[3] html += tab + '' html += '' html += '' html += '' html += '' html += '' html += '\n' html += '
#src pkg idnameversionsuitearchscheduled byscheduled onbuild startedstatus
version buildingprevious build durationbuilder jobnotify
 ' + row[0] + '' html += link_package(pkg, suite, arch) html += '' + row[1] + '' + row[2] + '' + row[3] + '' + row[4] + '' + row[5] + '' + row[6] + '' + row[7] + '' + row[8] + '' + row[9] + '' + row[10] + '' + row[11] + '' + row[12] + '

\n' destfile = BASE + '/live_status.html' desturl = REPRODUCIBLE_URL + '/live_status.html' write_html_page(title=title, body=html, destfile=destfile, style_note=True) if __name__ == '__main__': generate_live_status