[Qa-jenkins-scm] [jenkins.debian.net] 03/03: reproducible arch: build in /tmp/$PKG-$(basename $TMPDIR) instead of /tmp/$PKG

Holger Levsen holger at moszumanska.debian.org
Fri Oct 16 16:10:26 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 12a743d0d213112f7ef712c7f9b5662f854c4857
Author: Holger Levsen <holger at layer-acht.org>
Date:   Fri Oct 16 18:09:35 2015 +0200

    reproducible arch: build in /tmp/$PKG-$(basename $TMPDIR) instead of /tmp/$PKG
---
 TODO                               |  3 +--
 bin/reproducible_build_arch_pkg.sh | 26 ++++++++++++++++++--------
 2 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/TODO b/TODO
index 94b4c82..f8c405c 100644
--- a/TODO
+++ b/TODO
@@ -294,8 +294,7 @@ properties:
 
 * create a job, to bootstrap an arch schroot: done. needs to be made idempotent.
 * use regular maintenace job to update the arch schroot: 'schroot --directory /tmp -c source:jenkins-reproducible-arch -u root -- pacman -Syu --noconfirm'
-* create another job, to build a single package and a webpage for it…
-** WIP…
+* created another job (WIP), to build a single package and a webpage for it…
 ** introduce variations: USER, TZ, LANG, LC_ALL, umask
 * create a simple scheduler and build a few more packages…
 ** schroot, find packages in /var/abs/core/, schedule those
diff --git a/bin/reproducible_build_arch_pkg.sh b/bin/reproducible_build_arch_pkg.sh
index dee34e9..34eb552 100755
--- a/bin/reproducible_build_arch_pkg.sh
+++ b/bin/reproducible_build_arch_pkg.sh
@@ -14,10 +14,16 @@ set -e
 
 cleanup_all() {
 	cd
+	# delete main work dir
 	rm $TMPDIR -r
 	echo "$(date -u) - $TMPDIR deleted."
+	# delete makekpg work dir
+	if [ ! -z $SRCPACKAGE ] && [ -d /tmp/$SRCPACKAGE-$(basename $TMPDIR) ] ; then
+		rm -r /tmp/$SRCPACKAGE-$(basename $TMPDIR)
+	fi
+	# delete session if it still exists
 	if [ "$MODE" != "master" ] ; then
-		schroot --end-session -c arch-$SRCPACKAGE-$(basename $TMDPIR) > /dev/null 2>&1 || true
+		schroot --end-session -c arch-$SRCPACKAGE-$(basename $TMPDIR) > /dev/null 2>&1 || true
 	fi
 }
 
@@ -37,10 +43,12 @@ first_build() {
 	echo "Date UTC: $(date -u)"
 	echo "============================================================================="
 	set -x
-	local SESSION="arch-$SRCPACKAGE-$(basename $TMDPIR)"
+	local SESSION="arch-$SRCPACKAGE-$(basename $TMPDIR)"
+	local BUILDDIR="/tmp/$SRCPACKAGE-$(basename $TMPDIR)"
 	schroot --begin-session --session-name=$SESSION -c jenkins-reproducible-arch
-	schroot --run-session -c $SESSION --directory /tmp -- cp -r /var/abs/core/$SRCPACKAGE /tmp
-	schroot --run-session -c $SESSION --directory /tmp/$SRCPACKAGE -- makepkg --skippgpcheck
+	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 -- makepkg --skippgpcheck
 	schroot --end-session -c $SESSION
 	if ! "$DEBUG" ; then set +x ; fi
 }
@@ -52,10 +60,12 @@ second_build() {
 	echo "Date UTC: $(date -u)"
 	echo "============================================================================="
 	set -x
-	local SESSION="arch-$SRCPACKAGE-$(basename $TMDPIR)"
+	local SESSION="arch-$SRCPACKAGE-$(basename $TMPDIR)"
+	local BUILDDIR="/tmp/$SRCPACKAGE-$(basename $TMPDIR)"
 	schroot --begin-session --session-name=$SESSION -c jenkins-reproducible-arch
-	schroot --run-session -c $SESSION --directory /tmp -- cp -r /var/abs/core/$SRCPACKAGE /tmp
-	schroot --run-session -c $SESSION --directory /tmp/$SRCPACKAGE -- makepkg --skippgpcheck
+	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 -- makepkg --skippgpcheck
 	schroot --end-session -c $SESSION
 	if ! "$DEBUG" ; then set +x ; fi
 }
@@ -131,7 +141,7 @@ elif [ "$1" = "1" ] || [ "$1" = "2" ] ; then
 	else
 		second_build
 	fi
-	mv -v /tmp/$SRCPACKAGE $TMPDIR/b$MODE/archlinux/
+	mv -v /tmp/$SRCPACKAGE-$(basename $TMPDIR) $TMPDIR/b$MODE/archlinux/
 	echo "$(date -u) - build #$MODE for $SRCPACKAGE on $HOSTNAME done."
 	exit 0
 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