From 65446e9be4491624368111b82f3057a0e29a7569 Mon Sep 17 00:00:00 2001 From: Mattia Rizzolo Date: Wed, 18 Feb 2015 00:36:35 +0100 Subject: reproducible: common: update the init querying to the new schema, querying data only for sid --- bin/reproducible_common.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'bin/reproducible_common.py') diff --git a/bin/reproducible_common.py b/bin/reproducible_common.py index c7b37fc1..daef5857 100755 --- a/bin/reproducible_common.py +++ b/bin/reproducible_common.py @@ -427,12 +427,18 @@ def get_trailing_icon(package, bugs): conn_db = start_db_connection() # the local sqlite3 reproducible db conn_udd = start_udd_connection() -# do the db querying +# query some data we need everywhere (relative to sid, we care only about sid here) try: - amount = int(query_db('SELECT count(name) FROM sources')[0][0]) - count_total = int(query_db('SELECT COUNT(name) FROM source_packages')[0][0]) - count_good = int(query_db('SELECT COUNT(name) FROM source_packages ' + \ - 'WHERE status="reproducible"')[0][0]) + amount = int(query_db('SELECT count(*) FROM sources WHERE suite="sid"')[0][0]) + count_total = int(query_db('''SELECT COUNT(*) + FROM results AS r JOIN sources AS s + ON r.package_id=s.id + WHERE s.suite="sid"''')[0][0]) + count_good = int(query_db('''SELECT COUNT(*) + FROM results AS r JOIN sources AS s + ON r.package_id=s.id + WHERE s.suite="sid" + AND r.status="reproducible"''')[0][0]) except sqlite3.OperationalError: log.critical('Error performing basic queries. You have to setup the ' + \ 'database to successfully continue after this point.') -- cgit v1.2.3-70-g09d2