From 12a743d0d213112f7ef712c7f9b5662f854c4857 Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Fri, 16 Oct 2015 18:09:35 +0200 Subject: 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 94b4c825..f8c405cb 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 dee34e9d..34eb5529 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 -- cgit v1.2.3-70-g09d2