Add autobuild script.
[libguestfs.git] / autobuild.sh
1 #!/bin/bash -
2
3 PROJECT=libguestfs
4 FEBOOTSTRAP_PATH=$HOME/d/febootstrap
5 MAILTO=libguestfs@redhat.com
6
7 #----------------------------------------------------------------------
8 # Helper functions.
9
10 failed ()
11 {
12     mail -s "$(hostname -s) $PROJECT FAILED $1 $gitsha" $MAILTO < local-log
13 }
14
15 ok ()
16 {
17     mail -s "$(hostname -s) $PROJECT success $gitsha" $MAILTO < local-log
18 }
19
20 #----------------------------------------------------------------------
21
22 set -e
23 set -x
24
25 # Make sure we build and test against latest febootstrap.
26 PATH=$FEBOOTSTRAP_PATH:$FEBOOTSTRAP_PATH/helper:$PATH
27
28 # Remove any old cache directories.
29 rm -rf /tmp/guestfs.* ||:
30
31 rm -f local-log
32 cat > local-log <<EOF
33
34 This is an automatic message generated by the builder on
35 $(hostname -s) for $PROJECT.  Log files from the build
36 follow below.
37
38 $(uname -a)
39 $(date)
40
41 -----
42
43 EOF
44 exec >> local-log 2>&1
45
46 # Pull from the public repo so that we don't need ssh-agent.
47 git pull --rebase git://git.annexia.org/git/libguestfs.git master
48 git clean -d -f
49
50 # The git version we are building.
51 gitsha=$(git log|head -1|awk '{print $2}')
52
53 # Do the configure step.
54 ./bootstrap ||:
55 ./autogen.sh --enable-gcc-warnings || {
56     failed "configure step"
57     exit 1
58 }
59
60 # Do the build step.
61 make || {
62     failed "build step"
63     exit 1
64 }
65
66 # Run the tests.
67 make check || {
68     failed "tests"
69     exit 1
70 }
71
72 ok