From 62a956483e4163bff07a2cba9aa272ff0da2c3c1 Mon Sep 17 00:00:00 2001 From: Mattia Rizzolo Date: Fri, 6 Mar 2015 18:59:00 +0100 Subject: reproducible: html_packages: build pages also for untested packages. Add another icon --- bin/reproducible_common.py | 1 + bin/reproducible_html_packages.py | 37 ++++++++++++++++++++++--------------- 2 files changed, 23 insertions(+), 15 deletions(-) (limited to 'bin') diff --git a/bin/reproducible_common.py b/bin/reproducible_common.py index ff5496e0..554e95ed 100755 --- a/bin/reproducible_common.py +++ b/bin/reproducible_common.py @@ -336,6 +336,7 @@ def join_status_icon(status, package=None, version=None): '404': 'weather-severe-alert.png', 'not for us': 'weather-few-clouds-night.png', 'not_for_us': 'weather-few-clouds-night.png', + 'untested': 'weather-clear-night.png', 'blacklisted': 'error.png'} if status == 'unreproducible': status = 'FTBR' diff --git a/bin/reproducible_html_packages.py b/bin/reproducible_html_packages.py index 197e96bc..442edee6 100755 --- a/bin/reproducible_html_packages.py +++ b/bin/reproducible_html_packages.py @@ -19,7 +19,7 @@ html_package_page = Template((tab*2).join((""" $status - at $build_time: + $build_time: $links PTS BTS @@ -69,15 +69,25 @@ def check_package_status(package, suite, nocheck=False): 'AND s.suite="{suite}"').format(pkg=package, suite=suite) result = query_db(query)[0] except IndexError: - if nocheck: - return False - print_critical_message('This query produces no results: ' + query + - '\nThis means there is no tested package with the name ' + - package + '.') - raise + query = 'SELECT version FROM sources WHERE name="{pkg}" AND suite="{suite}"' + query = query.format(pkg=package, suite=suite) + try: + result = query_db(query)[0][0] + if result: + result = ('untested', str(result), False) + except IndexError: + if nocheck: + return False + print_critical_message('This query produces no results: ' + query + + '\nThis means there is no available package with the name ' + + package + '.') + raise status = str(result[0]) version = str(result[1]) - build_date = str(result[2])+" UTC" + if result[2]: + build_date = 'at ' + str(result[2]) + ' UTC' + else: + build_date = 'UNTESTED' return (status, version, build_date) def gen_extra_links(package, version, suite, arch): @@ -132,7 +142,7 @@ def gen_extra_links(package, version, suite, arch): def gen_suites_links(package, suite): html = '' query = 'SELECT s.suite, s.architecture ' + \ - 'FROM sources AS s JOIN results AS r ON r.package_id=s.id ' + \ + 'FROM sources AS s ' + \ 'WHERE s.name="{pkg}"'.format(pkg=package) results = query_db(query) if len(results) < 1: @@ -215,9 +225,7 @@ def gen_packages_html(packages, suite=None, arch=None, no_clean=False, nocheck=F purge_old_pages() # housekeep is always good def gen_all_rb_pkg_pages(suite='sid', arch='amd64', no_clean=False): - query = 'SELECT s.name ' + \ - 'FROM results AS r JOIN sources AS s ON r.package_id=s.id ' + \ - 'WHERE r.status !="" AND s.suite="%s"' % suite + query = 'SELECT name FROM sources WHERE suite="%s" AND architecture="%s"' % (suite, arch) rows = query_db(query) pkgs = [str(i[0]) for i in rows] log.info('Processing all the package pages, ' + str(len(pkgs))) @@ -238,9 +246,8 @@ def purge_old_pages(): for page in presents: pkg = page.rsplit('.', 1)[0] query = 'SELECT s.name ' + \ - 'FROM results AS r ' + \ - 'JOIN sources AS s ON r.package_id=s.id ' + \ - 'WHERE s.name="{name}" AND r.status != "" ' + \ + 'FROM sources AS s ' + \ + 'WHERE s.name="{name}" ' + \ 'AND s.suite="{suite}" AND s.architecture="{arch}"' query = query.format(name=pkg, suite=suite, arch=arch) result = query_db(query) -- cgit v1.2.3-70-g09d2