From 5cc58bc4d8a7acf730e7f540d682b114d1a26483 Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Mon, 29 Sep 2014 23:13:53 +0200 Subject: reproducible: only scheduled failed random packages for which a different (=never) version exists --- bin/reproducible_build.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/bin/reproducible_build.sh b/bin/reproducible_build.sh index 8fcdd679..473f24e6 100755 --- a/bin/reproducible_build.sh +++ b/bin/reproducible_build.sh @@ -41,6 +41,10 @@ if [ ! -f ${PACKAGES_DB} ] ; then CREATE TABLE job_sources (name TEXT NOT NULL, job TEXT NOT NULL)' + sqlite3 ${PACKAGES_DB} ' + CREATE TABLE sources + (name TEXT NOT NULL, + version TEXT NOT NULL)' fi # 30 seconds timeout when trying to get a lock INIT=/var/lib/jenkins/reproducible.init @@ -77,13 +81,19 @@ if [[ $1 =~ ^-?[0-9]+$ ]] ; then sqlite3 -init $INIT ${PACKAGES_DB} "REPLACE INTO job_sources VALUES ('$PKG','random')" done else - # this is kind of a hack: if $1 is 0, then schedule 33 failed packages which were nadomly picked + # this is kind of a hack: if $1 is 0, then schedule 33 failed packages which were nadomly picked and where a new version is available + CSVFILE=$(mktemp) + sqlite3 -csv -init $INIT ${PACKAGES_DB} "DELETE from sources" + (xzcat $TMPFILE | egrep "(^Package:|^Version:)" | sed -s "s#^Version: ##g; s#Package: ##g; s#\n# #g"| while read PKG ; do read VERSION ; echo "$PKG,$VERSION" ; done) > $CSVFILE + echo ".import $CSVFILE sources" | sqlite3 -csv -init $INIT ${PACKAGES_DB} + rm $CSVFILE AMOUNT=33 - PACKAGES=$(sqlite3 -init $INIT ${PACKAGES_DB} "SELECT source_packages.name FROM source_packages,job_sources WHERE (( source_packages.status = 'unreproducible' OR source_packages.status = 'FTBFS') AND source_packages.name = job_sources.name AND job_sources.job = 'random') ORDER BY source_packages.build_date LIMIT $AMOUNT" | xargs -r echo) + PACKAGES=$(sqlite3 -init $INIT ${PACKAGES_DB} "SELECT DISTINCT source_packages.name FROM source_packages,sources,job_sources WHERE (( source_packages.status = 'unreproducible' OR source_packages.status = 'FTBFS') AND source_packages.name = job_sources.name AND source_packages.name = sources.name AND job_sources.job = 'random' AND source_packages.version != sources.version) ORDER BY source_packages.build_date LIMIT $AMOUNT" | xargs -r echo) AMOUNT=0 for PKG in $PACKAGES ; do let "AMOUNT=AMOUNT+1" done + rm $CSVFILE fi # update amount of available packages (for doing statistics later) P_IN_SOURCES=$(xzcat $TMPFILE | grep "^Package" | grep -v "^Package-List:" | cut -d " " -f2 | wc -l) -- cgit v1.2.3-70-g09d2