2 # libguestfs autobuild script
3 # Copyright (C) 2009-2011 Red Hat Inc.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 # This script is used to download and test the latest tarball on
20 # Debian and other platforms. It runs from a cron job and sends email
21 # to the mailing list about the status.
25 # Subject line of email prefix.
26 prefix="${1:-[autobuild]}"
29 mailto="rjones@redhat.com"
31 # Move to temporary directory for building.
32 tmpdir="$(mktemp -d --tmpdir=/var/tmp)"
35 # The libguestfs index page contains some hidden fields to help us
36 # find the latest version programmatically.
37 version=$(wget --no-cache -O- -q http://libguestfs.org |
38 grep '^LATEST-VERSION:' | awk '{print $2}')
39 url=$(wget --no-cache -O- -q http://libguestfs.org |
40 grep '^LATEST-URL:' | awk '{print $2}')
41 filename=$(basename "$url")
42 directory=$(basename "$url" .tar.gz)
44 echo "--------------------------------------------------"
46 echo "libguestfs $version"
48 echo "build dir $tmpdir/$directory"
49 echo "--------------------------------------------------"
51 # Grab the latest tarball from upstream.
60 # This function is called if any step fails.
63 tail -100 ../build.log > ../build.log.tail
64 mutt -s "$prefix libguestfs $version FAILED $1" "$mailto" -a ../build.log.tail <<EOF
65 Autobuild failed. The last 100 lines of the build log are
68 For the full log see the build machine, in
74 # This function is called if the build is successful.
77 mutt -s "$prefix libguestfs $version ok" "$mailto" <<EOF
78 Autobuild was successful.
80 For the full log see the build machine, in
85 # Ensure that we get full debugging output.
86 export LIBGUESTFS_DEBUG=1
87 export LIBGUESTFS_TRACE=1
89 # Configure and build.
91 ./configure > ../build.log 2>&1 || {
96 make >> ../build.log 2>&1 || {
103 make check >> ../build.log 2>&1 || {