New autobuild script.
authorRichard W.M. Jones <rjones@redhat.com>
Sat, 20 Aug 2011 09:49:35 +0000 (10:49 +0100)
committerRichard W.M. Jones <rjones@redhat.com>
Sat, 20 Aug 2011 09:49:35 +0000 (10:49 +0100)
Remove the old top-level autobuild.sh that confused a lot
of people.

Add an autobuild.sh script that builds from the latest tarball.

autobuild.sh [deleted file]
contrib/README
contrib/autobuild/autobuild.sh [new file with mode: 0755]

diff --git a/autobuild.sh b/autobuild.sh
deleted file mode 100755 (executable)
index 77068c8..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-#!/bin/bash -
-
-PROJECT=libguestfs
-FEBOOTSTRAP_PATH=$HOME/d/febootstrap
-MAILTO=libguestfs@redhat.com
-HOSTNAME="$(hostname -s)"
-
-#----------------------------------------------------------------------
-# Helper functions.
-
-failed ()
-{
-    mail -s "$HOSTNAME $PROJECT FAILED $1 $gitsha" $MAILTO < local-log
-}
-
-ok ()
-{
-    mail -s "$HOSTNAME $PROJECT success $gitsha" $MAILTO < local-log
-}
-
-#----------------------------------------------------------------------
-
-set -e
-set -x
-
-# Make sure we build and test against latest febootstrap.
-PATH=$FEBOOTSTRAP_PATH:$FEBOOTSTRAP_PATH/helper:$PATH
-
-# Remove any old cache directories.
-rm -rf /tmp/guestfs.* ||:
-
-rm -f local-log
-cat > local-log <<EOF
-
-This is an automatic message generated by the builder on
-$HOSTNAME 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/libguestfs.git master
-git clean -d -f
-
-# The git version we are building.
-gitsha=$(git log|head -1|awk '{print $2}')
-
-# Do the configure step.
-./bootstrap ||:
-./autogen.sh --enable-gcc-warnings || {
-    failed "configure step"
-    exit 1
-}
-
-make clean ||:
-
-# Do the build step.
-make || {
-    failed "build step"
-    exit 1
-}
-
-# Tests that are skipped (note that these tests should be fixed).
-case "$HOSTNAME" in
-    builder-ubuntu)
-        # get_e2uuid: /dev/vdc: [no error message]
-        # get_e2label: /dev/vda1: [no error message]
-        # Diagnosis: either mkjournal is not writing a UUID or blkid is
-        # unable to pick it up.
-        export SKIP_TEST_GET_E2UUID=1
-        export SKIP_TEST_SET_E2UUID=1
-        export SKIP_TEST_SET_E2LABEL=1
-
-       # Avoids:
-       # device-mapper: ioctl: unable to remove open device temporary-cryptsetup-661
-       # device-mapper: remove ioctl failed: Device or resource busy
-       # guestfsd: error: Device lukstest is busy.
-       # Diagnosis: appears to be a bug in cryptsetup on Ubuntu.
-       # https://bugzilla.redhat.com/show_bug.cgi?id=527056
-       export SKIP_TEST_LUKS_SH=1
-       ;;
-esac
-
-# Run the tests.
-make check || {
-    failed "tests"
-    exit 1
-}
-
-ok
index 7050241..ce695ec 100644 (file)
@@ -1,6 +1,10 @@
 Random contributions and things which don't fit in anywhere else
 ----------------------------------------------------------------------
 
+autobuild/
+        The autobuild script that we use to build and test the
+        tarballs on Debian and elsewhere.
+
 centos5.3-libguestfs.spec
         [REMOVED]
         This used to be a centos5.3 specfile.  Please use the specfile
diff --git a/contrib/autobuild/autobuild.sh b/contrib/autobuild/autobuild.sh
new file mode 100755 (executable)
index 0000000..6ec1bfc
--- /dev/null
@@ -0,0 +1,100 @@
+#!/bin/bash -
+# libguestfs autobuild script
+# Copyright (C) 2009-2011 Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+# This script is used to download and test the latest tarball on
+# Debian and other platforms.  It runs from a cron job and sends email
+# to the mailing list about the status.
+
+set -e
+
+# Subject line of email prefix.
+prefix="${1:-[autobuild]}"
+
+# Where we send mail.
+mailto="rjones@redhat.com"
+
+# Move to temporary directory for building.
+tmpdir="$(mktemp -d --tmpdir=/var/tmp)"
+cd "$tmpdir"
+
+# The libguestfs index page contains some hidden fields to help us
+# find the latest version programmatically.
+version=$(wget --no-cache -O- -q http://libguestfs.org |
+          grep '^LATEST-VERSION:' | awk '{print $2}')
+url=$(wget --no-cache -O- -q http://libguestfs.org |
+      grep '^LATEST-URL:' | awk '{print $2}')
+filename=$(basename "$url")
+directory=$(basename "$url" .tar.gz)
+
+echo "--------------------------------------------------"
+echo "prefix     $prefix"
+echo "libguestfs $version"
+echo "url        $url"
+echo "build dir  $tmpdir/$directory"
+echo "--------------------------------------------------"
+
+# Grab the latest tarball from upstream.
+wget "$url"
+
+# Unpack the tarball.
+tar zxf "$filename"
+
+# Enter directory.
+cd "$directory"
+
+# This function is called if any step fails.
+failed ()
+{
+    mutt -s "$prefix libguestfs $version FAILED $1" "$mailto" -a ../build.log <<EOF
+Autobuild failed.  See the attached log file.
+EOF
+}
+
+# This function is called if the build is successful.
+ok ()
+{
+    mutt -s "$prefix libguestfs $version ok" "$mailto" -a ../build.log <<EOF
+Autobuild was successful.  The full log file is attached.
+EOF
+}
+
+# Ensure that we get full debugging output.
+export LIBGUESTFS_DEBUG=1
+export LIBGUESTFS_TRACE=1
+
+# Configure and build.
+echo "configure"
+./configure > ../build.log 2>&1 || {
+    failed "configure"
+    exit 1
+}
+echo "make"
+make >> ../build.log 2>&1 || {
+    failed "make"
+    exit 1
+}
+
+# Run the tests.
+echo "make check"
+make check >> ../build.log 2>&1 || {
+    failed "make check"
+    exit 1
+}
+
+echo "finished"
+ok