[Qa-jenkins-scm] [jenkins.debian.net] 01/01: reproducible: refactor, try harder to download sources

Holger Levsen holger at moszumanska.debian.org
Sat Oct 3 00:02:10 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 00f973b9c84f16b2099f5204023267a1d1585d03
Author: Holger Levsen <holger at layer-acht.org>
Date:   Sat Oct 3 02:01:38 2015 +0200

    reproducible: refactor, try harder to download sources
---
 bin/reproducible_build.sh | 28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/bin/reproducible_build.sh b/bin/reproducible_build.sh
index b3855ac..648cf36 100755
--- a/bin/reproducible_build.sh
+++ b/bin/reproducible_build.sh
@@ -427,7 +427,7 @@ choose_package() {
 	echo "The jenkins build log is/was available at ${BUILD_URL}console" | tee -a ${RBUILDLOG}
 }
 
-get_source_package() {
+download_source() {
 	set +e
 	local TMPLOG=$(mktemp --tmpdir=$TMPDIR)
 	if [ "$MODE" != "master" ] ; then
@@ -438,24 +438,28 @@ get_source_package() {
 	fi
 	PARSED_RESULT=$(egrep 'E: (Unable to find a source package for|Failed to fetch.*(Unable to connect to|Connection failed|Size mismatch|Cannot initiate the connection to|Bad Gateway))' ${TMPLOG})
 	cat ${TMPLOG} >> ${RBUILDLOG}
+	rm ${TMPLOG}
+	set -e
+}
+
+download_again_if_needed() {
 	if [ "$(ls ${SRCPACKAGE}_*.dsc 2> /dev/null)" = "" ] || [ ! -z "$PARSED_RESULT" ] ; then
 		# sometimes apt-get cannot download a package for whatever reason.
 		# if so, wait some time and try again. only if that fails, give up.
-		echo "$(date -u ) - download of ${SRCPACKAGE} sources from ${SUITE} failed." | tee -a ${RBUILDLOG}
+		echo "$(date -u ) - download of ${SRCPACKAGE} sources (for ${SUITE}) failed." | tee -a ${RBUILDLOG}
 		ls -l ${SRCPACKAGE}* | tee -a ${RBUILDLOG}
 		echo "$(date -u ) - sleeping 5m before re-trying..." | tee -a ${RBUILDLOG}
 		sleep 5m
-		if [ "$MODE" != "master" ] ; then
-			schroot --directory $TMPDIR -c source:jenkins-reproducible-$SUITE apt-get -- --download-only --only-source source ${SRCPACKAGE} 2>&1 | tee ${TMPLOG}
-		else
-			# the build master only needs to the the .dsc file
-			schroot --directory $TMPDIR -c source:jenkins-reproducible-$SUITE apt-get -- --download-only --only-source --print-uris source ${SRCPACKAGE} | grep \.dsc|cut -d " " -f1|xargs -r wget --timeout=180 --tries=3 2>&1 | tee ${TMPLOG}
-		fi
-		PARSED_RESULT=$(egrep 'E: (Unable to find a source package for|Failed to fetch.*(Unable to connect to|Connection failed|Size mismatch|Cannot initiate the connection to|Bad Gateway))' ${TMPLOG})
+		download_source
 	fi
-	set -e
-	cat ${TMPLOG} >> ${RBUILDLOG}
-	rm ${TMPLOG}
+}
+
+get_source_package() {
+	PARSED_RESULT=""
+	download_source
+	download_again_if_needed
+	download_again_if_needed
+	download_again_if_needed # yes, this is called three times. this should really not happen
 	if [ "$(ls ${SRCPACKAGE}_*.dsc 2> /dev/null)" = "" ] || [ ! -z "$PARSED_RESULT" ] ; then
 		if [ "$MODE" = "master" ] ; then
 			handle_404

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