[Qa-jenkins-scm] [jenkins.debian.net] 01/01: reproducibe Debian: speed up cleaning old pages
Holger Levsen
holger at layer-acht.org
Sat Jan 7 15:58:28 UTC 2017
This is an automated email from the git hooks/post-receive script.
holger pushed a commit to branch master
in repository jenkins.debian.net.
commit 3fa5b6c2e7e810fae739141bed67e93b76bda410
Author: Valerie R Young <spectranaut at riseup.net>
Date: Sat Jan 7 10:07:54 2017 -0500
reproducibe Debian: speed up cleaning old pages
Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
bin/reproducible_html_packages.py | 23 +++++++++--------------
1 file changed, 9 insertions(+), 14 deletions(-)
diff --git a/bin/reproducible_html_packages.py b/bin/reproducible_html_packages.py
index 2c2a742..d504784 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.')
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/qa/jenkins.debian.net.git
More information about the Qa-jenkins-scm
mailing list