Skip to content
Snippets Groups Projects
Commit 20a7b86c authored by Jelle van der Waa's avatar Jelle van der Waa Committed by Holger Levsen
Browse files

create per distro JSON reproducible info file


The current /debian/reproducible.json file contains other distribution
information as well such as from Arch Linux since the query does not
filter by distro. Resolve this issue by adjusting the SQL query to
filter on the passed distro which defaults to 'debian' if --distro is
not provided as argument. Due to the scripts logic, the created json
files will end up in the distro specific directories.

Signed-off-by: default avatarHolger Levsen <holger@layer-acht.org>
parent c057af34
No related branches found
No related tags found
No related merge requests found
......@@ -4,7 +4,7 @@
# Copyright © 2015-2017 Holger Levsen <holger@layer-acht.org>
# Licensed under GPL-2
from sqlalchemy import Table
from sqlalchemy import Table, text
from sqlalchemy.exc import NoSuchTableError, OperationalError
from .confparse import log
......@@ -75,3 +75,12 @@ def get_trailing_bug_icon(bug, bugs, package=None):
except KeyError:
pass
return html
def get_distribution_id(distroname):
query = text("SELECT id FROM distributions WHERE name=:distroname")
result = query_db(query, distroname=distroname)
if not result:
return
return result[0][0]
......@@ -18,10 +18,12 @@ apt_pkg.init_system()
import tempfile
import subprocess
from rblib import query_db
from sqlalchemy.sql import text
from rblib import query_db, get_distribution_id
from rblib.confparse import log
from rblib.const import (
DISTRO_URL,
DISTRO, DISTRO_URL,
REPRODUCIBLE_JSON, REPRODUCIBLE_TRACKER_JSON,
filter_query,
)
......@@ -29,15 +31,17 @@ from rblib.const import (
output = []
output4tracker = []
log.info('Creating json dump of current reproducible status')
log.info('Creating json dump of current reproducible status for %s', DISTRO)
distro_id = get_distribution_id(DISTRO)
# filter_query is defined in reproducible_common.py and excludes some FTBFS issues
query = "SELECT s.name, r.version, s.suite, s.architecture, r.status, r.build_date " + \
query = text("SELECT s.name, r.version, s.suite, s.architecture, r.status, r.build_date " + \
"FROM results AS r JOIN sources AS s ON r.package_id = s.id "+ \
"WHERE status != '' AND status NOT IN ('NFU', 'E404', 'blacklisted' ) AND (( status != 'FTBFS' ) OR " \
" ( status = 'FTBFS' and r.package_id NOT IN (SELECT n.package_id FROM NOTES AS n WHERE " + filter_query + " )))"
"WHERE status != '' AND s.distribution = :distro AND status NOT IN ('NFU', 'E404', 'blacklisted' ) AND (( status != 'FTBFS' ) OR " \
" ( status = 'FTBFS' and r.package_id NOT IN (SELECT n.package_id FROM NOTES AS n WHERE " + filter_query + " )))")
result = sorted(query_db(query))
result = sorted(query_db(query, distro=distro_id))
log.info('\tprocessing ' + str(len(result)))
keys = ['package', 'version', 'suite', 'architecture', 'status', 'build_date']
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment