[Qa-jenkins-scm] [jenkins.debian.net] 01/05: reproducible: build: refactor: move the db quering to pick up the package to be build in its own function choose_package()

Holger Levsen holger at moszumanska.debian.org
Sat Apr 18 15:25:00 UTC 2015


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 0190d00fd21673a459db9aba92b533f4874ed1c1
Author: Mattia Rizzolo <mattia at mapreri.org>
Date:   Mon Apr 6 00:02:50 2015 +0200

    reproducible: build: refactor: move the db quering to pick up the package to be build in its own function choose_package()
---
 bin/reproducible_build.sh | 27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/bin/reproducible_build.sh b/bin/reproducible_build.sh
index 73dfd43..b7ed13f 100755
--- a/bin/reproducible_build.sh
+++ b/bin/reproducible_build.sh
@@ -160,22 +160,20 @@ call_debbindiff() {
 	print_out_duration
 }
 
-TMPDIR=$(mktemp --tmpdir=/srv/reproducible-results -d)
-TMPCFG=$(mktemp -t pbuilderrc_XXXX)
-trap cleanup_all INT TERM EXIT
-cd $TMPDIR
-
-RESULT=$(sqlite3 -init $INIT ${PACKAGES_DB} "SELECT s.suite, s.id, s.name, sch.date_scheduled, sch.save_artifacts FROM schedule AS sch JOIN sources AS s ON sch.package_id=s.id WHERE sch.date_build_started = '' ORDER BY date_scheduled LIMIT 1")
-if [ -z "$RESULT" ] ; then
-	echo "No packages scheduled, sleeping 30m."
-	sleep 30m
-else
-	set +x
+choose_package () {
+	local RESULT=$(sqlite3 -init $INIT ${PACKAGES_DB} "SELECT s.suite, s.id, s.name, sch.date_scheduled, sch.save_artifacts FROM schedule AS sch JOIN sources AS s ON sch.package_id=s.id WHERE sch.date_build_started = '' ORDER BY date_scheduled LIMIT 1")
 	SUITE=$(echo $RESULT|cut -d "|" -f1)
 	SRCPKGID=$(echo $RESULT|cut -d "|" -f2)
 	SRCPACKAGE=$(echo $RESULT|cut -d "|" -f3)
 	SCHEDULED_DATE=$(echo $RESULT|cut -d "|" -f4)
 	SAVE_ARTIFACTS=$(echo $RESULT|cut -d "|" -f5)
+	if [ -z "$RESULT" ] ; then
+		echo "No packages scheduled, sleeping 30m."
+		sleep 30m
+		exit 0
+	fi
+}
+
 	if [ $SAVE_ARTIFACTS -eq 1 ] ; then
 		AANOUNCE=" Artifacts will be preserved."
 	else
@@ -192,7 +190,14 @@ else
 	# mark build attempt
 	sqlite3 -init $INIT ${PACKAGES_DB} "REPLACE INTO schedule (package_id, date_scheduled, date_build_started) VALUES ('$SRCPKGID', '$SCHEDULED_DATE', '$DATE');"
 
+TMPDIR=$(mktemp --tmpdir=/srv/reproducible-results -d)
+TMPCFG=$(mktemp -t pbuilderrc_XXXX)
+trap cleanup_all INT TERM EXIT
+cd $TMPDIR
+
 	RBUILDLOG=/var/lib/jenkins/userContent/rbuild/${SUITE}/${ARCH}/${SRCPACKAGE}_None.rbuild.log
+choose_package
+
 	echo "Starting to build ${SRCPACKAGE}/${SUITE} on $DATE" | tee ${RBUILDLOG}
 	echo "The jenkins build log is/was available at $BUILD_URL/console" | tee -a ${RBUILDLOG}
 	set +e

-- 
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