summaryrefslogtreecommitdiffstats
path: root/bin/reproducible_json.py
diff options
context:
space:
mode:
authorMattia Rizzolo <mattia@mapreri.org>2015-02-24 08:37:38 +0100
committerHolger Levsen <holger@layer-acht.org>2015-02-26 17:13:54 +0100
commitadb0970f8db376244d9217027dca679eb271169b (patch)
tree30cefa917e4497e788fd040530b43489c39f73a3 /bin/reproducible_json.py
parent4dc7b6ee2523ae1bd7c14f0bc7862325c98ef13c (diff)
downloadjenkins.debian.net-adb0970f8db376244d9217027dca679eb271169b.tar.xz
reproducible: json.py: update to a new database schema supporting multiple suites
Diffstat (limited to 'bin/reproducible_json.py')
-rwxr-xr-xbin/reproducible_json.py23
1 files 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.')