summaryrefslogtreecommitdiffstats
path: root/bin/reproducible_html_indexes.py
diff options
context:
space:
mode:
authorMattia Rizzolo <mattia@mapreri.org>2015-04-12 22:06:33 +0200
committerMattia Rizzolo <mattia@mapreri.org>2015-04-16 16:38:49 +0200
commit2875d50816ae4b5c71619dd0bb5dafa69f854de6 (patch)
treecf451d79392641665e6cfb64f12bf05bacb1fffe /bin/reproducible_html_indexes.py
parent2f2d1345d3dc1e04b167b8839427fc091bd127e6 (diff)
downloadjenkins.debian.net-2875d50816ae4b5c71619dd0bb5dafa69f854de6.tar.xz
reproducible: _html_indexes: move the code generating the schedule page to its own function. it does not make sense to bloat the generic code by special casing it
Diffstat (limited to 'bin/reproducible_html_indexes.py')
-rwxr-xr-xbin/reproducible_html_indexes.py65
1 files changed, 35 insertions, 30 deletions
diff --git a/bin/reproducible_html_indexes.py b/bin/reproducible_html_indexes.py
index 5a35c402..56046398 100755
--- a/bin/reproducible_html_indexes.py
+++ b/bin/reproducible_html_indexes.py
@@ -55,7 +55,6 @@ for issue in filtered_issues:
queries = {
'count_total': 'SELECT COUNT(*) FROM results AS r JOIN sources AS s ON r.package_id=s.id WHERE s.suite="{suite}" AND s.architecture="{arch}"',
- 'scheduled': 'SELECT sch.date_scheduled, s.suite, s.architecture, s.name FROM schedule AS sch JOIN sources AS s ON sch.package_id=s.id WHERE sch.date_build_started = "" ORDER BY sch.date_scheduled',
'reproducible_all': 'SELECT s.name FROM results AS r JOIN sources AS s ON r.package_id=s.id WHERE s.suite="{suite}" AND s.architecture="{arch}" AND r.status="reproducible" ORDER BY r.build_date DESC',
'reproducible_last24h': 'SELECT s.name FROM results AS r JOIN sources AS s ON r.package_id=s.id WHERE s.suite="{suite}" AND s.architecture="{arch}" AND r.status="reproducible" AND r.build_date > datetime("now", "-24 hours") ORDER BY r.build_date DESC',
'reproducible_last48h': 'SELECT s.name FROM results AS r JOIN sources AS s ON r.package_id=s.id WHERE s.suite="{suite}" AND s.architecture="{arch}" AND r.status="reproducible" AND r.build_date > datetime("now", "-48 hours") ORDER BY r.build_date DESC',
@@ -252,15 +251,6 @@ pages = {
}
global_pages = {
- 'scheduled': {
- 'title': 'Packages currently scheduled for testing for build reproducibility',
- 'body': [
- {
- 'query': 'scheduled',
- 'text': Template('$tot packages are currently scheduled for testing:')
- }
- ]
- }
}
@@ -309,28 +299,16 @@ def build_page_section(page, section, suite, arch):
raise
html = ''
footnote = True if rows else False
- if not rows and page != 'scheduled': # there are no package in this set
+ if not rows: # there are no package in this set
return (html, footnote) # do not output anything on the page.
html += build_leading_text_section(section, rows, suite, arch)
- if page == 'scheduled':
- html += '<p><table class="scheduled">\n' + tab + '<tr><th>#</th><th>scheduled at</th><th>suite</th><th>architecture</th><th>source package</th></tr>\n'
- else:
- html += '<p>\n' + tab + '<code>\n'
+ html += '<p>\n' + tab + '<code>\n'
for row in rows:
- if page == 'scheduled':
- pkg = row[3]
- url = RB_PKG_URI + '/' + row[1] + '/' + row[2] + '/' + pkg + '.html'
- html += tab + '<tr><td>&nbsp;</td><td>' + row[0] + '</td><td>' + row[1] + '</td><td>' + row[2] + '</td><td><code>'
- else:
- pkg = row[0]
- url = RB_PKG_URI + '/' + suite + '/' + arch + '/' + pkg + '.html'
- html += tab*2
+ pkg = row[0]
+ url = RB_PKG_URI + '/' + suite + '/' + arch + '/' + pkg + '.html'
+ html += tab*2
html += link_package(pkg, suite, arch, bugs)
- if page == 'scheduled':
- html += '</code></td></tr>'
html += '\n'
- if page == 'scheduled':
- html += '</table></p>\n'
else:
html += tab + '</code>\n'
html += '</p>'
@@ -361,8 +339,6 @@ def build_page(page, suite=None, arch=None):
for lsuite in SUITES:
for larch in ARCHES:
html += build_page_section(page, section, lsuite, larch)[0]
- if page == 'scheduled':
- break
footnote = True
else:
html1, footnote1 = build_page_section(page, section, suite, arch)
@@ -371,7 +347,7 @@ def build_page(page, suite=None, arch=None):
if not suite: # global page
destfile = BASE + '/index_' + page + '.html'
desturl = REPRODUCIBLE_URL + '/index_' + page + '.html'
- suite = defaultsuite # used for the links generated by write_html_page
+ suite = defaultsuite # used for the links generated by write_html_page
else:
destfile = BASE + '/' + suite + '/' + arch + '/index_' + page + '.html'
desturl = REPRODUCIBLE_URL + '/' + suite + '/' + arch + '/index_' + \
@@ -380,9 +356,38 @@ def build_page(page, suite=None, arch=None):
log.info('"' + title + '" now available at ' + desturl)
+def generate_schedule():
+ """ the schedule is very different than others index pages """
+ log.info('Building the schedule index page...')
+ title = 'Packages currently scheduled for testing for build reproducibility'
+ query = 'SELECT sch.date_scheduled, s.suite, s.architecture, s.name ' + \
+ 'FROM schedule AS sch JOIN sources AS s ON sch.package_id=s.id ' + \
+ 'WHERE sch.date_build_started = "" ORDER BY sch.date_scheduled'
+ text = Template('$tot packages are currently scheduled for testing:')
+ html = ''
+ rows = query_db(query)
+ html += build_leading_text_section({'text': text}, rows, defaultsuite, defaultarch)
+ html += '<p><table class="scheduled">\n' + tab
+ html += '<tr><th>#</th><th>scheduled at</th><th>suite</th>'
+ html += '<th>architecture</th><th>source package</th></tr>\n'
+ for row in rows:
+ # 0: date_scheduled, 1: suite, 2: arch, 3: pkg name
+ pkg = row[3]
+ url = RB_PKG_URI + '/' + row[1] + '/' + row[2] + '/' + pkg + '.html'
+ html += tab + '<tr><td>&nbsp;</td><td>' + row[0] + '</td>'
+ html += '<td>' + row[1] + '</td><td>' + row[2] + '</td><td><code>'
+ html += link_package(pkg, defaultsuite, defaultarch, bugs)
+ html += '</code></td></tr>\n'
+ html += '</table></p>\n'
+ destfile = BASE + '/index_scheduled.html'
+ desturl = REPRODUCIBLE_URL + '/index_scheduled.html'
+ write_html_page(title=title, body=html, destfile=destfile, style_note=True)
+
+
bugs = get_bugs()
if __name__ == '__main__':
+ generate_schedule()
for suite in SUITES:
for arch in ARCHES:
for page in pages.keys():