From: Richard W.M. Jones <rjones@redhat.com>
Date: Tue, 7 Dec 2010 10:17:47 +0000 (+0000)
Subject: Add autobuild script.
X-Git-Tag: 3.2~6
X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=2dfc659c33c5ceb298e8027e219547416b286661;p=febootstrap.git

Add autobuild script.

This script is run on the builder(s) regularly.
---

diff --git a/.gitignore b/.gitignore
index b8a4aea..a2707fb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -41,6 +41,7 @@ lib/time.h
 lib/unistd.h
 lib/warn-on-use.h
 lib/wchar.h
+/local*
 INSTALL
 install-sh
 missing
diff --git a/autobuild.sh b/autobuild.sh
new file mode 100755
index 0000000..3eefc7c
--- /dev/null
+++ b/autobuild.sh
@@ -0,0 +1,64 @@
+#!/bin/bash -
+
+PROJECT=febootstrap
+MAILTO=libguestfs@redhat.com
+
+#----------------------------------------------------------------------
+# Helper functions.
+
+failed ()
+{
+    mail -s "$(hostname -s) $PROJECT FAILED $1 $gitsha" $MAILTO < local-log
+}
+
+ok ()
+{
+    mail -s "$(hostname -s) $PROJECT success $gitsha" $MAILTO < local-log
+}
+
+#----------------------------------------------------------------------
+
+set -e
+set -x
+
+rm -f local-log
+cat > local-log <<EOF
+
+This is an automatic message generated by the builder on
+$(hostname -s) for $PROJECT.  Log files from the build
+follow below.
+
+$(uname -a)
+$(date)
+
+-----
+
+EOF
+exec >> local-log 2>&1
+
+# Pull from the public repo so that we don't need ssh-agent.
+git pull --rebase git://git.annexia.org/git/febootstrap.git master
+git clean -d -f
+
+# The git version we are building.
+gitsha=$(git log|head -1|awk '{print $2}')
+
+# Do the configure step.
+./autogen.sh || {
+    failed "configure step"
+    exit 1
+}
+
+# Do the build step.
+make || {
+    failed "build step"
+    exit 1
+}
+
+# Run the tests.
+make check || {
+    failed "tests"
+    exit 1
+}
+
+ok