summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Levsen <holger@layer-acht.org>2014-11-03 03:54:51 +0100
committerHolger Levsen <holger@layer-acht.org>2014-11-03 03:54:51 +0100
commitcbca7c3a6b0d04ad0a001e8e028e701817a82b2f (patch)
tree2a3901796f712bec5097a275264492100fdc4be1
parent8178375e27fe80db2429811c9195a43f7840e3a8 (diff)
downloadjenkins.debian.net-cbca7c3a6b0d04ad0a001e8e028e701817a82b2f.tar.xz
reproducible_setup_schroot: cleanup writelock properly on failure
-rwxr-xr-xbin/reproducible_setup_schroot.sh13
-rw-r--r--logparse/reproducible.rules1
2 files changed, 10 insertions, 4 deletions
diff --git a/bin/reproducible_setup_schroot.sh b/bin/reproducible_setup_schroot.sh
index 399b8a9b..0dc50ec8 100755
--- a/bin/reproducible_setup_schroot.sh
+++ b/bin/reproducible_setup_schroot.sh
@@ -74,6 +74,12 @@ bootstrap $@
trap - INT TERM EXIT
+remove_writelock() {
+ # remove the lock
+ rm $DBDCHROOT_WRITELOCK
+}
+
+trap remove_writelock INT TERM EXIT
# aquire a write lock in any case
touch $DBDCHROOT_WRITELOCK
if [ -f $DBDCHROOT_READLOCK ] ; then
@@ -102,7 +108,7 @@ sudo mv $CHROOT_TARGET $SCHROOT_BASE/"$TARGET"
if [ -d $SCHROOT_BASE/"$TARGET"-"$rand" ]
then
- sudo rm -rf --one-file-system $SCHROOT_BASE/"$TARGET"-"$rand"
+ sudo rm -rf --one-file-system $SCHROOT_BASE/"$TARGET"-"$rand" || ( echo "Warning: $SCHROOT_BASE/${TARGET}-$rand could not be fully removed." ; ls $SCHROOT_BASE/${TARGET}-$rand -la )
fi
# write the schroot config
@@ -117,6 +123,5 @@ sudo tee /etc/schroot/chroot.d/jenkins-"$TARGET" <<-__END__
union-type=aufs
__END__
-# remove the lock
-rm $DBDCHROOT_WRITELOCK
-
+trap - INT TERM EXIT
+remove_writelock
diff --git a/logparse/reproducible.rules b/logparse/reproducible.rules
index b52eaed3..047be037 100644
--- a/logparse/reproducible.rules
+++ b/logparse/reproducible.rules
@@ -8,4 +8,5 @@ warning /Warning: old temp directories found in .+/
warning /Warning: lock .+ still exists, exiting./
warning /Warning: processes found which should not be there/
warning /Warning: packages found where the build was started more than 24h ago:/
+warning /Warning: .+ could not be fully removed./