summaryrefslogtreecommitdiffstats
path: root/tests/basic/rpm.t
diff options
context:
space:
mode:
authorNiels de Vos <ndevos@redhat.com>2012-11-06 10:13:07 +0100
committerAnand Avati <avati@redhat.com>2012-12-12 10:58:45 -0800
commit06d4cced24f9854e3439f03a0c940adc5306de48 (patch)
tree62f967cad18e85f5c35c106957bd1277af100f95 /tests/basic/rpm.t
parent6d58cb0476dc13198596603a9efd5014ebcb0c45 (diff)
build: include OCF resource agents by default and package them
This change introduces a glusterfs-resource-agents sub-package that contains the Open Cluster Framework (OCF) Resource Agents (RA). It also changes the build infrastructure to include the RA by default, making them available for anyone who is interested in using them with a OCF compatible Hight-Availability solution like Pacemaker. Build the RPMs without RA: $ make dist && rpmbuild -ta --without ocf *.gz Build the RPMs with RA (default): $ make dist && rpmbuild -ta *.gz There is no need to run ./autogen.sh from within the .spec, the whole autotools infrastructure is included in the 'make dist' tarball already. This also adds a test-case which builds the rpms with mock for the latest two EPEL releases. Change-Id: I12ef5f30f466868825352376156fb4e56b135c58 BUG: 869559 Signed-off-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/4130 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Diffstat (limited to 'tests/basic/rpm.t')
-rwxr-xr-xtests/basic/rpm.t78
1 files changed, 78 insertions, 0 deletions
diff --git a/tests/basic/rpm.t b/tests/basic/rpm.t
new file mode 100755
index 00000000000..7ef9ac57057
--- /dev/null
+++ b/tests/basic/rpm.t
@@ -0,0 +1,78 @@
+#!/bin/bash
+
+. $(dirname $0)/../include.rc
+
+cleanup
+RESULT_DIR=$(mktemp -d -p /var/tmp rpm-tests.XXXXXXXX)
+
+# enable some extra debugging
+if [ -n "${DEBUG}" -a "${DEBUG}" != "0" ]
+then
+ exec &> ${RESULT_DIR}/log
+ set -x
+fi
+
+# checkout the sources to a new directory to execute ./configure and all
+REPO=${PWD}
+COMMIT=$(git describe)
+mkdir ${RESULT_DIR}/sources
+cd ${RESULT_DIR}/sources
+git clone -s file://${REPO} .
+git checkout ${COMMIT}
+
+# build the .tar.gz
+[ -e configure ] || ./autogen.sh
+TEST ./configure --enable-fusermount
+TEST make dist
+
+# need to use double quoting because the command is passed to TEST
+# EPEL-5 does not like new versions of rpmbuild and requires some _source_* defines
+TEST rpmbuild --define "'_srcrpmdir $PWD'" \
+ --define "'_source_payload w9.gzdio'" \
+ --define "'_source_filedigest_algorithm 1'" \
+ -ts *.tar.gz
+
+chmod g=rwx ${RESULT_DIR}
+chown :mock ${RESULT_DIR}
+
+# build for the last two Fedora EPEL releases (x86_64 only)
+for MOCK_CONF in $(ls -x1 /etc/mock/*.cfg | egrep -e 'epel-[0-9]+-x86_64.cfg$' | tail -n2)
+do
+ EPEL_RELEASE=$(basename ${MOCK_CONF} .cfg)
+ mkdir ${RESULT_DIR}/${EPEL_RELEASE}
+ chmod g=rwx ${RESULT_DIR}/${EPEL_RELEASE}
+ chown :mock ${RESULT_DIR}/${EPEL_RELEASE}
+ # expand the mock command line
+ MOCK_CMD=$(echo /usr/bin/mock --cleanup-after \
+ --resultdir=${RESULT_DIR}/${EPEL_RELEASE} \
+ -r ${EPEL_RELEASE} --rebuild ${PWD}/*.src.rpm)
+
+ # write the mock command to a file, so that its easier to execute
+ cat << EOF > ${RESULT_DIR}/${EPEL_RELEASE}/mock.sh
+#!/bin/sh
+${MOCK_CMD}
+EOF
+ chmod +x ${RESULT_DIR}/${EPEL_RELEASE}/mock.sh
+
+ # root can not run 'mock', it needs to drop priviledges
+ if (groups | grep -q mock)
+ then
+ # the current user is in group 'mock'
+ TEST ${RESULT_DIR}/${EPEL_RELEASE}/mock.sh
+ else
+ # switch to the user called 'mock'
+ chown mock:mock ${RESULT_DIR}/${EPEL_RELEASE}
+ # "su" might not work, using sudo instead
+ TEST sudo -u mock -E ${RESULT_DIR}/${EPEL_RELEASE}/mock.sh
+ fi
+done
+
+# we could build for the last two Fedora releases too, but that is not
+# possible on EPEL-5/6 installations, Fedora 17 and newer have unmet
+# dependencies on the build-server :-/
+
+# only remove ${RESULT_DIR} if we're not debugging
+[ "${DEBUG}" != "0" ] && rm -rf ${RESULT_DIR}
+
+cleanup
+