[ooo-build-commit] bin/tinbuild

Thorsten Behrens thorsten at kemper.freedesktop.org
Mon Dec 7 09:27:22 PST 2009


 bin/tinbuild |   85 ++++++++++++++++++++++++++++++++++++-----------------------
 1 file changed, 53 insertions(+), 32 deletions(-)

New commits:
commit 297859b8a54b44f461169bd46a5c6c5f955729e9
Author: Thorsten Behrens <thb at openoffice.org>
Date:   Mon Dec 7 16:57:24 2009 +0100

    More tinderbox robustness, better error reporting
    
    * bin/tinbuild:

diff --git a/bin/tinbuild b/bin/tinbuild
index 1f9ff38..f9fce3f 100755
--- a/bin/tinbuild
+++ b/bin/tinbuild
@@ -18,14 +18,14 @@ usage ()
 
 reportError ()
 {
-	commit=`git-log --pretty=oneline -n1`
-	author=`git-log --pretty=short -n1 | sed -ne '/^Author: / s/^Author: //p'`
+	commit=`git log --pretty=oneline -n1`
+	author=`git log --pretty=short -n1 | sed -ne '/^Author: / s/^Author: //p'`
 
-	echo "$1" 1>&2
-	echo "Culprit: $author with $commit" 1>&2
+	echo "$*" 1>&2
+	echo "Last commit: $author - $commit" 1>&2
 	if test $SEND_MAIL -eq 1; then
-		subject="tinderbox failure caused by: $commit"
-		echo "$1" | mail -s "$subject" "$author"
+		subject="tinderbox failure, last commit: $commit"
+		echo "$*" | mail -s "$subject" "$author"
 	fi
 }
 
@@ -40,39 +40,60 @@ while getopts w:lmh opt ; do
 	esac
 done
 
+which git > /dev/null 2>&1 || {
+    echo "You need git for this!"
+	exit 1
+}
 test $HTML_OUTPUT -eq 1 && export BUILD_HTML_OUTPUT=true
 
 good_head=""
 while true; do
 	err_msg=""
-	old_head=$(git-rev-parse --verify HEAD) && err_msg=$(git-pull -r 2>&1) || 
-	{
-		reportError("git repo f*cked up - error is: \n$err_msg")
-		exit 1
-	}
-	new_head=$(git-rev-parse --verify HEAD)
 
-	if test "$old_head" = "$new_head"; then
-		sleep $PAUSE_SECONDS
+	# cleanup
+	make clean-local
+
+	# try to build
+	if ! err_msg=$(./autogen.sh 2>&1); then
+		reportError "autogen.sh / configure failed - error is:" $'\n' "$err_msg"
+	elif ! err_msg=$(./download 2>&1); then
+		reportError "download failed - error is:" $'\n' "$err_msg"
+	elif ! make dev-install >build.log 2>&1 ; then
+		reportError "building failed - error is:" $'\n' $(tail -n50 build.log)
 	else
-		# something has changed, do a build
-		if ! err_msg=$(./autogen.sh); then
-			reportError("autogen.sh / configure failed - error is: \n$err_msg")
-		elif ! err_msg=$(./download); then
-			reportError("download failed - error is: \n$err_msg")
-		elif ! err_msg=$(./make patch.apply 2>&1 | tail -n 50); then
-			reportError("patch.apply failed - error is: \n$err_msg")
-		elif ! err_msg=$(./make dev-install 2>&1 | tail -n 50); then
-			reportError("building failed - error is: \n$err_msg")
-		else
-			# successful build, maybe do a smoketest/first.bas?
-			good_head=$new_head
-			if test -d build-*; then
-				rm -rf build-*
-			fi
-			mv build "build-$good_head" || exit 1
+		echo build done
+
+		prev_head=$good_head
+
+		# successful build, maybe do a smoketest/first.bas?
+		good_head=$(git rev-parse --verify HEAD)
+		mv build "build-$good_head" || 
+		{
+			test -z "$prev_head" || echo "Leaving build-$prev_head around, exiting now"
+			exit 1
+		}
+
+		if test -n "$prev_head"; then
+			rm -rf "build-$prev_head"
 		fi
-		# cleanup
-		make clean-local
 	fi
+
+	echo updating repo
+
+	# new commits?
+	while true; do
+		old_head=$(git rev-parse --verify HEAD) && err_msg=$(git pull -r 2>&1) || 
+		{
+			echo "git repo f*cked up - error is:"
+			echo $err_msg
+			test -z "$prev_head" || echo "Leaving build-$prev_head around, exiting now"
+			exit 1
+		}
+		new_head=$(git rev-parse --verify HEAD)
+		
+		if test "$old_head" != "$new_head"; then
+			break
+		fi
+		sleep $PAUSE_SECONDS
+	done
 done


More information about the ooo-build-commit mailing list