[PATCH] waf: cleanup properly if something goes wrong with autogen.sh

Rusty Russell rusty at rustcorp.com.au
Fri Aug 13 01:45:05 MDT 2010

eg. full disk:
 rusty at vivaldi:~/devel/cvs/samba/source4 (master)$ ./autogen.sh
 Setting up for waf build
 Looking for the buildtools directory
 Found buildtools in ./../buildtools
 Setting up configure
 sed: couldn't flush stdout: No space left on device
 Setting up Makefile
 sed: couldn't flush stdout: No space left on device
 done. Now run ./configure or ./configure.developer then make.
 rusty at vivaldi:~/devel/cvs/samba/source4 (master)$ echo $?
 rusty at vivaldi:~/devel/cvs/samba/source4 (master)$ ls -l configure Makefile
 -rwxr-xr-x 1 rusty rusty 0 2010-08-13 16:19 configure
 -rw-r--r-- 1 rusty rusty 0 2010-08-13 16:19 Makefile

Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>
 buildtools/scripts/autogen-waf.sh |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/buildtools/scripts/autogen-waf.sh b/buildtools/scripts/autogen-waf.sh
index 7a6e94c..174b62c 100755
--- a/buildtools/scripts/autogen-waf.sh
+++ b/buildtools/scripts/autogen-waf.sh
@@ -1,7 +1,13 @@
+# Abort on error
+set -e
 p=`dirname $0`
+# Erase configure and Makefile if something goes wrong...
+trap "rm -f $p/configure $p/Makefile" 0
 echo "Setting up for waf build"
 echo "Looking for the buildtools directory"
@@ -25,3 +31,6 @@ if [ $p != "." ]; then
 	echo "Notice: The build invoke path is not 'source4'! Use make with the parameter"
 	echo "-C <'source4' path>. Example: make -C source4 all"
+# Don't erase any more!
+trap 0

More information about the samba-technical mailing list