[Qa-jenkins-scm] [jenkins.debian.net] 02/02: reproducible debian: handle new packages with multiple versions
Holger Levsen
holger at layer-acht.org
Mon Oct 24 22:18:48 UTC 2016
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 df98a2d7da2a0690e479c5ef44b31e77dec971a7
Author: Valerie R Young <spectranaut at riseup.net>
Date: Mon Oct 24 16:15:22 2016 -0400
reproducible debian: handle new packages with multiple versions
This commit fixes a bug introduced by 07849060
Commit 07849060 changed the UPSERT that added new packages to the sources
table into an INSERT. If the new package has two versions for (suite, arch)
in debian archive, then the INSERT to sources will fail on unique constraint.
The changes in this commit provide the same functionality without the UPSERT:
there will be no failure, instead only the second source encountered in
archive will be saved.
Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
bin/reproducible_scheduler.py | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/bin/reproducible_scheduler.py b/bin/reproducible_scheduler.py
index c69e290..b279e02 100755
--- a/bin/reproducible_scheduler.py
+++ b/bin/reproducible_scheduler.py
@@ -221,10 +221,21 @@ def update_sources(suite):
def update_sources_db(suite, arch, sources):
# extract relevant info (package name and version) from the sources file
- new_pkgs = []
+ new_pkgs = set()
+ newest_version = {}
for src in deb822.Sources.iter_paragraphs(sources.split('\n')):
pkg = (src['Package'], src['Version'], suite, arch)
- new_pkgs.append(pkg)
+
+ # only keep the most recent version of a src for each package/suite/arch
+ key = src['Package'] + suite + arch
+ if key in newest_version:
+ oldversion = newest_version[key]
+ oldpackage = (src['Package'], oldversion, suite, arch)
+ new_pkgs.remove(oldpackage)
+
+ newest_version[key] = src['Version']
+ new_pkgs.add(pkg)
+
# get the current packages in the database
query = "SELECT name, version, suite, architecture FROM sources " + \
"WHERE suite='{}' AND architecture='{}'".format(suite, arch)
--
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