[NEW PATCH] Add control script for automated builds (via gerrit-bot)
Federico Simoncelli
fsimonce at redhat.com
Mon Aug 22 14:14:15 UTC 2011
New patch submitted by Federico Simoncelli (fsimonce at redhat.com)
You can review this change at: http://gerrit.usersys.redhat.com/839
commit c7e7daa03776114f5083c9f877a6f5291a88fdcf
Author: Daniel P. Berrange <berrange at redhat.com>
Date: Mon Aug 22 14:39:56 2011 +0100
Add control script for automated builds
The http://autobuild.org/ tool is a framework for doing automated
builds from upstream source, including builds of RPMs. The file
autobuild.sh is a simple script that integrates with this tool.
It can also be run directly by developers
export AUTOBUILD_INSTALL_ROOT=$HOME/builder
./autobuild.sh
* vdsm.spec.in: Add a unique counter for automated builds
* .gitignore: Ignore results.log file
* autobuild.sh: Add script for doing automated builds of source
and RPM
Change-Id: Idf6f525ad6c0693325f441a8a71865aaf9ab081b
diff --git a/.gitignore b/.gitignore
index acab38d..b273bb1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -32,3 +32,4 @@ vdsm_cli/vdsClient
vdsm_cli/vdscli.py
vdsm_reg/deployUtil.py
vdsm_reg/vdsm-reg.conf
+results.log
diff --git a/autobuild.sh b/autobuild.sh
new file mode 100755
index 0000000..d1020cd
--- /dev/null
+++ b/autobuild.sh
@@ -0,0 +1,54 @@
+#!/bin/sh
+
+set -e
+set -v
+
+# Make things clean.
+
+test -n "$1" && RESULTS=$1 || RESULTS=results.log
+: ${AUTOBUILD_INSTALL_ROOT=$HOME/builder}
+
+test -f Makefile && make -k distclean || :
+
+./autogen.sh --prefix="$AUTOBUILD_INSTALL_ROOT"
+
+# If the MAKEFLAGS envvar does not yet include a -j option,
+# add -jN where N depends on the number of processors.
+case $MAKEFLAGS in
+ *-j*) ;;
+ *) n=$(getconf _NPROCESSORS_ONLN 2> /dev/null)
+ test "$n" -gt 0 || n=1
+ n=$(expr $n + 1)
+ MAKEFLAGS="$MAKEFLAGS -j$n"
+ export MAKEFLAGS
+ ;;
+esac
+
+make
+make install
+
+# set -o pipefail is a bashism; this use of exec is the POSIX alternative
+exec 3>&1
+st=$(
+ exec 4>&1 >&3
+ { make check 2>&1 3>&- 4>&-; echo $? >&4; } | tee "$RESULTS"
+)
+exec 3>&-
+test "$st" = 0
+
+rm -f *.tar.gz
+make dist
+
+if [ -n "$AUTOBUILD_COUNTER" ]; then
+ EXTRA_RELEASE=".auto$AUTOBUILD_COUNTER"
+else
+ NOW=`date +"%s"`
+ EXTRA_RELEASE=".$USER$NOW"
+fi
+
+if [ -f /usr/bin/rpmbuild ]; then
+ rpmbuild --nodeps \
+ --define "extra_release $EXTRA_RELEASE" \
+ --define "_sourcedir `pwd`" \
+ -ba --clean vdsm.spec
+fi
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 9de01b6..7e1b43a 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -10,7 +10,7 @@ Source: %{vdsm_name}-%{version}.tar.gz
# tarball built from internal git repo with
# make tarball rpmversion=<version> rpmrelease=<release>
Version: @PACKAGE_VERSION@
-Release: @PACKAGE_RELEASE@%{?dist}
+Release: @PACKAGE_RELEASE@%{?dist}%{?extra_release}
License: GPLv2+
Group: Applications/System
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
More information about the vdsm-patches
mailing list