[Qa-jenkins-scm] [jenkins.debian.net] 01/01: reproducible arch: publish build logs and only do 2nd build if the 1st was successfull

Holger Levsen holger at moszumanska.debian.org
Fri Oct 16 20:41:03 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 818a99e1c042735e5bb885ce71e8dd14c38a565e
Author: Holger Levsen <holger at layer-acht.org>
Date:   Fri Oct 16 22:40:06 2015 +0200

    reproducible arch: publish build logs and only do 2nd build if the 1st was successfull
---
 bin/reproducible_build_arch_pkg.sh | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/bin/reproducible_build_arch_pkg.sh b/bin/reproducible_build_arch_pkg.sh
index 5cd8735..e15b830 100755
--- a/bin/reproducible_build_arch_pkg.sh
+++ b/bin/reproducible_build_arch_pkg.sh
@@ -47,11 +47,12 @@ first_build() {
 	set -x
 	local SESSION="arch-$SRCPACKAGE-$(basename $TMPDIR)"
 	local BUILDDIR="/tmp/$SRCPACKAGE-$(basename $TMPDIR)"
+	local LOG=$TMPDIR/b1/$SRCPACKAGE/build1.log
 	schroot --begin-session --session-name=$SESSION -c jenkins-reproducible-arch
 	echo "MAKEFLAGS=-j$NUM_CPU" | schroot --run-session -c $SESSION --directory /tmp -u root -- tee -a /etc/makepkg.conf
 	schroot --run-session -c $SESSION --directory /tmp -- mkdir $BUILDDIR
 	schroot --run-session -c $SESSION --directory /tmp -- cp -r /var/abs/core/$SRCPACKAGE $BUILDDIR/
-	schroot --run-session -c $SESSION --directory $BUILDDIR/$SRCPACKAGE -- makepkg --skippgpcheck
+	schroot --run-session -c $SESSION --directory $BUILDDIR/$SRCPACKAGE -- makepkg --skippgpcheck 2>&1 | tee -a $LOG
 	schroot --end-session -c $SESSION
 	if ! "$DEBUG" ; then set +x ; fi
 }
@@ -65,12 +66,13 @@ second_build() {
 	set -x
 	local SESSION="arch-$SRCPACKAGE-$(basename $TMPDIR)"
 	local BUILDDIR="/tmp/$SRCPACKAGE-$(basename $TMPDIR)"
+	local LOG=$TMPDIR/b2/$SRCPACKAGE/build2.log
 	NEW_NUM_CPU=$(echo $NUM_CPU-1|bc)
 	schroot --begin-session --session-name=$SESSION -c jenkins-reproducible-arch
 	echo "MAKEFLAGS=-j$NEW_NUM_CPU" | schroot --run-session -c $SESSION --directory /tmp -u root -- tee -a /etc/makepkg.conf
 	schroot --run-session -c $SESSION --directory /tmp -- mkdir $BUILDDIR
 	schroot --run-session -c $SESSION --directory /tmp -- cp -r /var/abs/core/$SRCPACKAGE $BUILDDIR/
-	schroot --run-session -c $SESSION --directory $BUILDDIR/$SRCPACKAGE -- makepkg --skippgpcheck
+	schroot --run-session -c $SESSION --directory $BUILDDIR/$SRCPACKAGE -- makepkg --skippgpcheck 2>&1 | tee -a $LOG
 	schroot --end-session -c $SESSION
 	if ! "$DEBUG" ; then set +x ; fi
 }
@@ -114,7 +116,10 @@ remote_build() {
 build_rebuild() {
 	mkdir b1 b2
 	remote_build 1
-	remote_build 2
+	# only do the 2nd build if the 1st produced some results
+	if [ ! -z "$(ls $TMPDIR/b1/$SRCPACKAGE/*.pkg.tar.xz)" ] ; then
+		remote_build 2
+	fi
 }
 
 #
@@ -127,7 +132,6 @@ cd $TMPDIR
 
 DATE=$(date -u +'%Y-%m-%d %H:%M')
 START=$(date +'%s')
-RBUILDLOG=$(mktemp --tmpdir=$TMPDIR)
 BUILDER="${JOB_NAME#reproducible_builder_}/${BUILD_ID}"
 
 #
@@ -183,12 +187,16 @@ build_rebuild
 TIMEOUT="30m"
 DIFFOSCOPE="$(schroot --directory /tmp -c source:jenkins-reproducible-${DBDSUITE}-diffoscope diffoscope -- --version 2>&1)"
 echo "$(date -u) - Running $DIFFOSCOPE now..."
+mkdir -p $BASE/archlinux/$SRCPACKAGE/
+cd $TMPDIR/b1/$SRCPACKAGE
+cp build1.log $BASE/archlinux/$SRCPACKAGE/
+cd $TMPDIR/b1/$SRCPACKAGE
+[ ! -f build2.log ] || cp build2.log $BASE/archlinux/$SRCPACKAGE/
 cd $TMPDIR/b1/$SRCPACKAGE
 for ARTIFACT in *.pkg.tar.xz ; do
 	call_diffoscope $SRCPACKAGE $ARTIFACT
 	# publish page
 	if [ -f $TMPDIR/$SRCPACKAGE/$ARTIFACT.html ] ; then
-		mkdir -p $BASE/archlinux/$SRCPACKAGE/
 		cp $TMPDIR/$SRCPACKAGE/$ARTIFACT.html $BASE/archlinux/$SRCPACKAGE/
 		echo "$(date -u) - $REPRODUCIBLE_URL/archlinux/$SRCPACKAGE/$ARTIFACT.html updated."
 	fi

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