summaryrefslogtreecommitdiffstats
path: root/bin/reproducible_html_packages.py
diff options
context:
space:
mode:
authorValerie R Young <spectranaut@riseup.net>2017-01-07 10:07:54 -0500
committerHolger Levsen <holger@layer-acht.org>2017-01-07 16:58:19 +0100
commit3fa5b6c2e7e810fae739141bed67e93b76bda410 (patch)
treec1422bd6b4373680bf557d377be10e0648fe1701 /bin/reproducible_html_packages.py
parent04b36b86c5c5f92cbde4b61a7528688ba25e7240 (diff)
downloadjenkins.debian.net-3fa5b6c2e7e810fae739141bed67e93b76bda410.tar.xz
reproducibe Debian: speed up cleaning old pages
Signed-off-by: Holger Levsen <holger@layer-acht.org>
Diffstat (limited to 'bin/reproducible_html_packages.py')
-rwxr-xr-xbin/reproducible_html_packages.py23
1 files changed, 9 insertions, 14 deletions
diff --git a/bin/reproducible_html_packages.py b/bin/reproducible_html_packages.py
index 2c2a742f..d5047848 100755
--- a/bin/reproducible_html_packages.py
+++ b/bin/reproducible_html_packages.py
@@ -443,6 +443,12 @@ def purge_old_pages():
raise # directory' error (errno 17)
presents = []
log.debug('page presents: ' + str(presents))
+
+ # get the existing packages
+ query = "SELECT name, suite, architecture FROM sources " + \
+ "WHERE suite='{}' AND architecture='{}'".format(suite, arch)
+ cur_pkgs = set([(p.name, p.suite, p.architecture) for p in query_db(query)])
+
for page in presents:
# When diffoscope results exist for a package, we create a page
# that displays the diffoscope results by default in the main iframe
@@ -450,13 +456,8 @@ def purge_old_pages():
if page == 'diffoscope-results':
continue
pkg = page.rsplit('.', 1)[0]
- query = "SELECT s.name " + \
- "FROM sources AS s " + \
- "WHERE s.name='{name}' " + \
- "AND s.suite='{suite}' AND s.architecture='{arch}'"
- query = query.format(name=pkg, suite=suite, arch=arch)
- result = query_db(query)
- if not result: # actually, the query produces no results
+
+ if (pkg, suite, arch) not in cur_pkgs:
log.info('There is no package named ' + pkg + ' from ' +
suite + '/' + arch + ' in the database. ' +
'Removing old page.')
@@ -476,13 +477,7 @@ def purge_old_pages():
log.debug('diffoscope page presents: ' + str(presents))
for page in presents:
pkg = page.rsplit('.', 1)[0]
- query = "SELECT s.name " + \
- "FROM sources AS s " + \
- "WHERE s.name='{name}' " + \
- "AND s.suite='{suite}' AND s.architecture='{arch}'"
- query = query.format(name=pkg, suite=suite, arch=arch)
- result = query_db(query)
- if not result: # actually, the query produces no results
+ if (pkg, suite, arch) not in cur_pkgs:
log.info('There is no package named ' + pkg + ' from ' +
suite + '/' + arch + '/diffoscope-results in ' +
'the database. Removing old page.')