summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattia Rizzolo <mattia@mapreri.org>2015-08-09 12:43:26 +0000
committerHolger Levsen <holger@layer-acht.org>2015-08-09 14:58:20 +0200
commit3a689b4f8b6755adaf170e0d1a27453d197a6225 (patch)
treee619ab35800346cf2f6f653db75abf74e3af93e8
parentcf22f33fdc00edcafe2fe7c620dcb0bd0bd56be4 (diff)
downloadjenkins.debian.net-3a689b4f8b6755adaf170e0d1a27453d197a6225.tar.xz
reproducible: remote_scheduler: join on the notes table only when needed
-rwxr-xr-xbin/reproducible_remote_scheduler.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/bin/reproducible_remote_scheduler.py b/bin/reproducible_remote_scheduler.py
index 2e5f7a9e..59e2498e 100755
--- a/bin/reproducible_remote_scheduler.py
+++ b/bin/reproducible_remote_scheduler.py
@@ -106,15 +106,16 @@ if arch not in ARCHS:
sys.exit(1)
if issue or status or built_after or built_before:
- formatter = dict(suite=suite)
+ formatter = dict(suite=suite, notes_table='')
log.info('Querying packages with given issues/status...')
query = 'SELECT s.name ' + \
- 'FROM sources AS s, notes AS n, results AS r ' + \
- 'WHERE n.package_id=s.id AND r.package_id=s.id ' + \
+ 'FROM sources AS s, {notes_table} results AS r ' + \
+ 'WHERE r.package_id=s.id ' + \
'AND s.suite = "{suite}" AND r.status != "blacklisted" '
if issue:
- query += 'AND n.issues LIKE "%{issue}%" '
+ query += 'AND n.package_id=s.id AND n.issues LIKE "%{issue}%" '
formatter['issue'] = issue
+ formatter['notes_table'] = 'notes AS n,'
if status:
query += 'AND r.status = "{status}"'
formatter['status'] = status