[Qa-jenkins-scm] [Git][qa/jenkins.debian.net][master] 3 commits: reproducible debian: build: declare and define the variables separately, to...

Mattia Rizzolo (@mattia) gitlab at salsa.debian.org
Tue Oct 5 15:00:11 BST 2021



Mattia Rizzolo pushed to branch master at Debian QA / jenkins.debian.net


Commits:
532d3a0b by Mattia Rizzolo at 2021-10-05T15:43:05+02:00
reproducible debian: build: declare and define the variables separately, to avoid masking the subshell return code

Here the `schroot --begin-session` call was failing, but the failure was
masking by the declaration being done at the same time, so the `set -e`
was just wasted.

Signed-off-by: Mattia Rizzolo <mattia at debian.org>

- - - - -
9b0620f6 by Mattia Rizzolo at 2021-10-05T15:58:20+02:00
reproducible debian: build: properly handle schroot errors when invoking diffoscope, instead of brushing them off under the rug

Signed-off-by: Mattia Rizzolo <mattia at debian.org>

- - - - -
83cb0c67 by Mattia Rizzolo at 2021-10-05T16:00:01+02:00
reproducible debian: build: add fixme

Signed-off-by: Mattia Rizzolo <mattia at debian.org>

- - - - -


1 changed file:

- bin/reproducible_build.sh


Changes:

=====================================
bin/reproducible_build.sh
=====================================
@@ -333,22 +333,41 @@ dbd_timeout() {
 }
 
 call_diffoscope_on_changes_files() {
+	local TMPLOG TIMEOUT TEMP MSG_PART1 session diffoscope_version
+	# DIFFOSCOPE is globally used
 	# filter lines describing .buildinfo files from .changes file
 	sed -i -e '/^ [a-f0-9]\{32,64\} .*\.buildinfo$/d' b{1,2}/$CHANGES
-	local TMPLOG=$(mktemp --tmpdir=$TMPDIR)
-	local TIMEOUT="120m"  # note that below there is another instance of this + 5 minutes
+	TMPLOG=$(mktemp --tmpdir=$TMPDIR)
+	TIMEOUT="120m"  # note that below there is another instance of this + 5 minutes
 	DBDSUITE=$SUITE
 	if [ "$SUITE" = "experimental" ] ; then
 		# there is no extra diffoscope-schroot for experimental ( because we specical case ghc enough already )
 		DBDSUITE="unstable"
 	fi
 	# diffoscope temporary files are going to end up in this
-	local TEMP=$(mktemp --tmpdir=$TMPDIR -d dbd-tmp-XXXXXXX)
-	local session="$(schroot --begin-session -c "chroot:jenkins-reproducible-$DBDSUITE-diffoscope")"
-	DIFFOSCOPE="$(schroot --directory $TMPDIR --run-session -c "$session" diffoscope -- --version 2>&1 || true)"
+	TEMP=$(mktemp --tmpdir="$TMPDIR" -d dbd-tmp-XXXXXXX)
+	if ! session=$(schroot --begin-session -c "chroot:jenkins-reproducible-$DBDSUITE-diffoscope") ; then
+		# FIXME: probably this (and the one below) should not end in a FTPR, but rather some tempfail situation.
+		RESULT=99
+		DIFFOSCOPE="diffoscope (schroot error—uset)"
+		MSG_PART1="The schroot service is not available.  Error message:"
+		handle_ftbr "$MSG_PART1" "\n" "$session"
+		irc_message debian-reproducible-changes "$MSG_PART1 Please check $RBUILDLOG and $DEBIAN_URL/$SUITE/$ARCH/$SRCPACKAGE"
+		return
+	fi
+	if ! diffoscope_version=$(schroot --directory "$TMPDIR" --run-session -c "$session" diffoscope -- --version 2>&1) ; then
+		RESULT=98
+		DIFFOSCOPE="diffoscope (diffoscope error—unset)"
+		MSG_PART1="First call to diffoscope failed.  Error message:"
+		handle_ftbr "$MSG_PART1" "\n" "$diffoscope_version"
+		irc_message debian-reproducible-changes "$MSG_PART1 Please check $RBUILDLOG and $DEBIAN_URL/$SUITE/$ARCH/$SRCPACKAGE"
+		return
+	fi
+
+	# we have a working diffoscope!
 	log_info "$DIFFOSCOPE will be used to compare the two builds:"
-	set +e
 	set -x
+	set +e
 	( timeout 125m nice schroot \
 		--directory $TMPDIR \
 		--run-session \
@@ -362,8 +381,8 @@ call_diffoscope_on_changes_files() {
 			$TMPDIR/b2/${CHANGES}" \
 	2>&1 ) >> $TMPLOG
 	RESULT=$?
-	if ! "$DEBUG" ; then set +x ; fi
 	set -e
+	if ! "$DEBUG" ; then set +x ; fi
 	log_file $TMPLOG  # print dbd output
 	schroot --end-session -c "$session"
 	rm $TMPLOG
@@ -388,7 +407,7 @@ call_diffoscope_on_changes_files() {
 			if (( $RESULT > 128 )) && (( $RESULT <= 128+31 )); then
 				RESULT="$RESULT (SIG$(kill -l $(($RESULT - 128))))"
 			fi
-			local MSG_PART1="Something weird happened, $DIFFOSCOPE exited with $RESULT and I don't know how to handle it."
+			MSG_PART1="Something weird happened, $DIFFOSCOPE exited with $RESULT and I don't know how to handle it."
 			handle_ftbr "$MSG_PART1"
 			irc_message debian-reproducible-changes "$MSG_PART1 Please check $RBUILDLOG and $DEBIAN_URL/$SUITE/$ARCH/$SRCPACKAGE"
 			;;



View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/compare/744aeb6bd1cd8d2854c2ee28efbfe50ae96c10bf...83cb0c67d982b40bace017a800dd1ea970bcf983

-- 
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/compare/744aeb6bd1cd8d2854c2ee28efbfe50ae96c10bf...83cb0c67d982b40bace017a800dd1ea970bcf983
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/qa-jenkins-scm/attachments/20211005/02f6d3fc/attachment-0001.htm>


More information about the Qa-jenkins-scm mailing list