#!/usr/bin/python3 # -*- coding: utf-8 -*- # # Copyright © 2015 Mattia Rizzolo # Based on reproducible_json.sh © 2014 Holger Levsen # Licensed under GPL-2 # # Depends: python3 # # Build the reproducible.json file, to provide a nice datasource from reproducible_common import * import json output = [] log.info('Creating json dump of current reproducible status') 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)) log.debug(pkg) output.append(pkg) with open(REPRODUCIBLE_JSON, 'w') as fd: json.dump(output, fd, indent=4, sort_keys=True) log.info(REPRODUCIBLE_URL + '/reproducible.json has been updated.')