From d2728ceca963fb1a0d7138a67927bc44e0739749 Mon Sep 17 00:00:00 2001 From: Alexander Couzens Date: Sat, 6 Aug 2016 02:15:18 +0200 Subject: reproducible/openwrt|lede: decouple node and master cleanup master and nodes use a different cleanup function because the node have different build dirs Signed-off-by: Holger Levsen --- bin/reproducible_openwrt_common.sh | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'bin') diff --git a/bin/reproducible_openwrt_common.sh b/bin/reproducible_openwrt_common.sh index 2041e989..77649087 100644 --- a/bin/reproducible_openwrt_common.sh +++ b/bin/reproducible_openwrt_common.sh @@ -10,23 +10,25 @@ GENERIC_NODE1=profitbricks-build3-amd64.debian.net GENERIC_NODE2=profitbricks-build4-amd64.debian.net # run on jenkins master -master_cleanup_tmpdirs() { - ssh $GENERIC_NODE1 reproducible_$TYPE node node_cleanup_tmpdirs $TMPDIR || true - ssh $GENERIC_NODE2 reproducible_$TYPE node node_cleanup_tmpdirs $TMPDIR || true - # cleanup local dirs - cleanup_tmpdirs -} # only called direct on a remote build node node_cleanup_tmpdirs() { export TMPDIR=$1 - export TMPBUILDDIR=$TMPDIR/build - cleanup_tmpdirs + cd + # (very simple) check we are deleting the right stuff + if [ "${TMPDIR:0:26}" != "/srv/reproducible-results/" ] || [ ${#TMPDIR} -le 26 ] ; then + echo "Something very strange with \$TMPDIR=$TMPDIR exiting instead of doing cleanup." + exit 1 + fi + rm -rf $TMPDIR } # called as trap handler # called on cleanup -cleanup_tmpdirs() { +master_cleanup_tmpdirs() { + ssh $GENERIC_NODE1 reproducible_$TYPE node node_cleanup_tmpdirs $TMPDIR || true + ssh $GENERIC_NODE2 reproducible_$TYPE node node_cleanup_tmpdirs $TMPDIR || true + cd # (very simple) check we are deleting the right stuff if [ "${TMPDIR:0:26}" != "/srv/reproducible-results/" ] || [ ${#TMPDIR} -le 26 ] || \ @@ -230,7 +232,7 @@ openwrt_build() { exit 1 fi mkdir -p $TMPBUILDDIR - trap cleanup_tmpdirs INT TERM EXIT + trap node_cleanup_tmpdirs INT TERM EXIT # we have also to set the TMP -- cgit v1.2.3-70-g09d2