add error checking. b=375219, r=dbaron
authorrhelmer@mozilla.com
Mon, 07 May 2007 16:11:40 -0700
changeset 1263 a9a8bbdd59ea7674f03f8cc67a005520cc55c115
parent 1262 1fb6c663ab926ee924086a70bb1e1112df995c2c
child 1264 dc43ac0fc996f24c52a2a2d1df340fde952827d8
push idunknown
push userunknown
push dateunknown
reviewersdbaron
bugs375219
milestone1.9a5pre
add error checking. b=375219, r=dbaron
tools/build/sync-configure
--- a/tools/build/sync-configure
+++ b/tools/build/sync-configure
@@ -21,27 +21,56 @@ TDIR="/tmp/c-s.$$"
 HOST=`/bin/hostname -f`
 
 export CVSROOT CVS_RSH PATH
 
 rm -rf ${TDIR}
 mkdir ${TDIR}
 cd ${TDIR}
 
-if [ "$BRANCH" = "HEAD" ]; then
-    ${CVS} -q checkout mozilla/configure.in mozilla/configure mozilla/build/autoconf mozilla/aclocal.m4
-else
-    ${CVS} -q checkout -r $BRANCH mozilla/configure.in mozilla/configure mozilla/build/autoconf mozilla/aclocal.m4
-fi
-
-cd mozilla
-${AC} -l build/autoconf
+use_tmpdir() 
+{
+    if [ "$BRANCH" = "HEAD" ]; then
+        ${CVS} -q checkout mozilla/configure.in mozilla/configure mozilla/build/autoconf mozilla/aclocal.m4
+    else
+        ${CVS} -q checkout -r $BRANCH mozilla/configure.in mozilla/configure mozilla/build/autoconf mozilla/aclocal.m4
+    fi
+    
+    CO_STATUS=$?
+    if [ $CO_STATUS != 0 ]
+    then
+        echo "ERROR cvs checkout exited with a non-zero exit code: $CO_STATUS"
+        return $CO_STATUS
+    fi
+    
+    cd mozilla
+    ${AC} -l build/autoconf
+    AC_STATUS=$?
+    if [ $AC_STATUS != 0 ]
+    then
+        echo "ERROR autoconf exited with a non-zero exit code: $AC_STATUS"
+        return $AC_STATUS
+    fi
+    
+    ${CVS} diff configure >/dev/null 2>&1
+    DIFF_STATUS=$?
+    if [ $DIFF_STATUS == 1 ]
+    then
+        ${CVS} commit -m"Automated update from host $HOST" configure
+        CI_STATUS=$?
+        if [ $CI_STATUS != 0 ]
+        then
+            echo "ERROR cvs commit exited with exit code: $CI_STATUS"
+            return $CI_STATUS
+        fi
+    elif [ $DIFF_STATUS == 0 ]
+    then
+        return 0
+    else 
+        echo "ERROR cvs diff exited with exit code: $DIFF_STATUS"
+        return $DIFF_STATUS
+    fi
+}
 
-${CVS} diff configure >/dev/null 2>&1
-if test "$?" != "0"
-then
-	${CVS} commit -m"Automated update from host $HOST" configure
-fi
-
-cd /tmp
-rm -rf ${TDIR}
-exit 0
-
+use_tmpdir
+result=$?
+rm -rf /tmp/${TDIR}
+exit $result