[PATCH build 09/10] Further consolidate "KEEP-GOING" logic.

Trevor Woerner twoerner at gmail.com
Sat Sep 18 13:12:30 PDT 2010


From: Trevor Woerner <twoerner at gmail.com>

Signed-off-by: Trevor Woerner <twoerner at gmail.com>
---
 build.sh |  115 +++++++++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 91 insertions(+), 24 deletions(-)

diff --git a/build.sh b/build.sh
index 0677c99..5a0501b 100755
--- a/build.sh
+++ b/build.sh
@@ -91,12 +91,8 @@ errout() {
 }
 
 failed() {
-    if [ -n "$KEEPGOING" ]; then
-	errout "***** $1 failed on $2/$3"
-	failed_components+="$2/$3 "
-    else
-	exit 1
-    fi
+    errout "***** $1 failed on $2/$3"
+    failed_components+="$2/$3 "
 }
 
 # print a pretty title with the given string
@@ -115,6 +111,9 @@ module_title() {
     echo -e "\n=== $1  ${_line:${#1}}"
 }
 
+# returns:
+#   0 - good
+#   1 - bad
 checkfortars() {
     M=$1
     C=$2
@@ -172,12 +171,18 @@ checkfortars() {
                     if [ "$jj" = "gz" ]; then
                         TAROPTS=xzf
                     fi
-                    tar $TAROPTS $TARFILE -C $ii || failed tar $1 $2
+                    tar $TAROPTS $TARFILE -C $ii
+		    if [ $? -ne 0 ]; then
+			failed tar $1 $2
+			return 1
+		    fi
                 fi
-                return
+                return 0
             fi
         done
     done
+
+    return 0
 }
 
 # the git clone command needs special processing in order to correctly
@@ -268,6 +273,9 @@ process() {
         CONFCMD="autogen.sh"
     else
         checkfortars $1 $2
+	if [ $? -ne 0 ]; then
+	    return 1
+	fi
         CONFCMD="configure"
     fi
 
@@ -282,18 +290,34 @@ process() {
     fi
 
     old_pwd=`pwd`
-    cd $SRCDIR || failed cd1 $1 $2
+    cd $SRCDIR
+    if [ $? -ne 0 ]; then
+	failed cd $1 $2
+	cd $old_pwd
+	return 1
+    fi
 
     if [ -n "$PULL" ]; then
-	git pull --rebase || failed "git pull" $1 $2
+	git pull --rebase
+	if [ $? -ne 0 ]; then
+	    failed "git pull" $1 $2
+	    cd $old_pwd
+	    return 1
+	fi
     fi
 
     # Build outside source directory
     if [ -n "$DIR_ARCH" ] ; then
-	mkdir -p "$DIR_ARCH" || failed mkdir $1 $2
-	if cd "$DIR_ARCH" ; then :; else
-	    failed cd2 $1 $2
-	    cd ${old_pwd}
+	mkdir -p "$DIR_ARCH"
+	if [ $? -ne 0 ]; then
+	    failed mkdir $1 $2
+	    cd $old_pwd
+	    return 1
+	fi
+	cd $DIR_ARCH
+	if [ $? -ne 0 ]; then
+	    failed cd $1 $2
+	    cd $old_pwd
 	    return 1
 	fi
     fi
@@ -313,28 +337,71 @@ process() {
 	# Use "sh autogen.sh" since some scripts are not executable in CVS
 	sh ${DIR_CONFIG}/${CONFCMD} --prefix=${PREFIX} ${LIB_FLAGS} \
 	    ${MOD_SPECIFIC} ${QUIET:+--quiet} \
-	    ${CACHE:+--cache-file=}${CACHE} ${CONFFLAGS} "$CONFCFLAGS" || \
-	    failed ${CONFCMD} $1 $2
+	    ${CACHE:+--cache-file=}${CACHE} ${CONFFLAGS} "$CONFCFLAGS"
+	if [ $? -ne 0 ]; then
+	    failed $CONFCMD $1 $2
+	    cd $old_pwd
+	    return 1
+	fi
     fi
 
-    ${MAKE} $MAKEFLAGS || failed make $1 $2
+    # make
+    ${MAKE} $MAKEFLAGS
+    if [ $? -ne 0 ]; then
+	failed "$MAKE $MAKEFLAGS" $1 $2
+	cd $old_pwd
+	return 1
+    fi
+
+    # make check
     if [ -n "$CHECK" ]; then
-        ${MAKE} $MAKEFLAGS check || failed check $1 $2
+        ${MAKE} $MAKEFLAGS check
+	if [ $? -ne 0 ]; then
+	    failed "$MAKE $MAKEFLAGS check" $1 $2
+	    cd $old_pwd
+	    return 1
+	fi
     fi
+
+    # make clean
     if [ -n "$CLEAN" ]; then
-	${MAKE} $MAKEFLAGS clean || failed clean $1 $2
+	${MAKE} $MAKEFLAGS clean
+	if [ $? -ne 0 ]; then
+	    failed "$MAKE $MAKEFLAGS clean" $1 $2
+	    cd $old_pwd
+	    return 1
+	fi
     fi
+
+    # make dist
     if [ -n "$DIST" ]; then
-	${MAKE} $MAKEFLAGS dist || failed dist $1 $2
+	${MAKE} $MAKEFLAGS dist
+	if [ $? -ne 0 ]; then
+	    failed "$MAKE $MAKEFLAGS dist" $1 $2
+	    cd $old_pwd
+	    return 1
+	fi
     fi
+
+    # make distcheck
     if [ -n "$DISTCHECK" ]; then
-	${MAKE} $MAKEFLAGS distcheck || failed distcheck $1 $2
+	${MAKE} $MAKEFLAGS distcheck
+	if [ $? -ne 0 ]; then
+	    failed "$MAKE $MAKEFLAGS distcheck" $1 $2
+	    cd $old_pwd
+	    return 1
+	fi
     fi
-    $SUDO env LD_LIBRARY_PATH=$LD_LIBRARY_PATH ${MAKE} $MAKEFLAGS install || \
-	failed install $1 $2
 
-    cd ${old_pwd}
+    # make install
+    $SUDO env LD_LIBRARY_PATH=$LD_LIBRARY_PATH ${MAKE} $MAKEFLAGS install
+    if [ $? -ne 0 ]; then
+	failed "$SUDO env LD_LIBRARY_PATH=$LD_LIBRARY_PATH ${MAKE} $MAKEFLAGS install" $1 $2
+	cd $old_pwd
+	return 1
+    fi
 
+    cd ${old_pwd}
     return 0
 }
 
-- 
1.7.3.rc2



More information about the xorg-devel mailing list