From 20b80e6283d55cadf736bbdbffcc93887c05d74b Mon Sep 17 00:00:00 2001 From: Dan Mick Date: Fri, 16 Oct 2015 18:01:33 -0700 Subject: [PATCH] build-ceph-{deb-native,rpm}.sh: Clean up build directories on failure A recent change to a wip branch was leaving a .git file (as in a submodule pointer to ../../.git/modules/) behind in the out~ or rpmbuild/BUILD dirs when failing the build, and then because these scripts both have -e, they immediately exited. Then, when the next build came around, it tried "git clean", which recursed into the build dir, found the .git, tried to dereference into the ultimate dir, and failed. Harden against this sort of failure by making sure to remove the workdir immediately, and then fail, when the actual build worker fails. Signed-off-by: Dan Mick --- build-ceph-deb-native.sh | 2 +- build-ceph-rpm.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build-ceph-deb-native.sh b/build-ceph-deb-native.sh index 59ba97b..c481b3d 100755 --- a/build-ceph-deb-native.sh +++ b/build-ceph-deb-native.sh @@ -54,7 +54,7 @@ fi # build the debs mkdir -p out~ rm -rf out~/* || true -GNUPGHOME="/srv/gnupg" ionice -c3 nice -n20 /srv/ceph-build/build_snapshot_native.sh out~ $DIST +GNUPGHOME="/srv/gnupg" ionice -c3 nice -n20 /srv/ceph-build/build_snapshot_native.sh out~ $DIST || ( rm -rf out~ && exit 1 ) VER=`cat out~/version` echo "VER is $VER" diff --git a/build-ceph-rpm.sh b/build-ceph-rpm.sh index 068d903..af71761 100755 --- a/build-ceph-rpm.sh +++ b/build-ceph-rpm.sh @@ -114,7 +114,7 @@ cp ceph.spec /tmp/ceph.spec # Build RPMs BUILDAREA=`readlink -fn ${BUILDAREA}` ### rpm wants absolute path -rpmbuild -ba --define "_topdir ${BUILDAREA}" ceph.spec +rpmbuild -ba --define "_topdir ${BUILDAREA}" ceph.spec || ( rm -rf ${BUILDAREA} && exit 1 ) # Create and build an RPM for the repository -- 2.39.5