From adb0970f8db376244d9217027dca679eb271169b Mon Sep 17 00:00:00 2001 From: Mattia Rizzolo Date: Tue, 24 Feb 2015 08:37:38 +0100 Subject: reproducible: json.py: update to a new database schema supporting multiple suites --- bin/reproducible_json.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/bin/reproducible_json.py b/bin/reproducible_json.py index f8dff814..3d63a030 100755 --- a/bin/reproducible_json.py +++ b/bin/reproducible_json.py @@ -13,23 +13,24 @@ from reproducible_common import * import json -result = sorted(query_db('SELECT name, version, status , build_date ' + - 'FROM source_packages ' + - 'WHERE status != ""')) -count = int(query_db('SELECT COUNT(name) FROM source_packages ' + - 'WHERE status != ""')[0][0]) +output = [] -log.info('processing ' + str(count) + ' package to create .json output') +log.info('Creating json dump of current reproducible status') -all_pkgs = [] -keys = ['package', 'version', 'status', 'build_date'] +query = 'SELECT s.name, r.version, s.suite, r.status, r.build_date ' + \ + 'FROM results AS r JOIN sources AS s ON r.package_id = s.id '+ \ + 'WHERE status != ""' +result = sorted(query_db(query)) +log.info('\tprocessing ' + str(len(result))) + +keys = ['package', 'version', 'suite', 'status', 'build_date'] for row in result: pkg = dict(zip(keys, row)) - pkg['suite'] = 'sid' - all_pkgs.append(pkg) + log.debug(pkg) + output.append(pkg) with open(REPRODUCIBLE_JSON, 'w') as fd: - json.dump(all_pkgs, fd, indent=4, sort_keys=True) + json.dump(output, fd, indent=4, sort_keys=True) log.info(REPRODUCIBLE_URL + '/reproducible.json has been updated.') -- cgit v1.2.3-70-g09d2