diff options
| -rw-r--r-- | configure.ac | 7 | ||||
| -rw-r--r-- | extras/Makefile.am | 2 | ||||
| -rw-r--r-- | extras/ocf/Makefile.am | 2 | ||||
| -rw-r--r-- | glusterfs.spec.in | 49 | ||||
| -rwxr-xr-x | tests/basic/rpm.t | 78 | ||||
| -rw-r--r-- | tests/include.rc | 2 | 
6 files changed, 129 insertions, 11 deletions
diff --git a/configure.ac b/configure.ac index 9640c9d50..f24f4a384 100644 --- a/configure.ac +++ b/configure.ac @@ -174,10 +174,11 @@ AC_ARG_WITH(launchddir,  AC_SUBST(launchddir)  AC_ARG_WITH([ocf], -            [AS_HELP_STRING([--with-ocf], [build OCF-compliant cluster resource agents])], +            [AS_HELP_STRING([--without-ocf], [build OCF-compliant cluster resource agents])],              , -            [with_ocf=no]) -AM_CONDITIONAL(WITH_OCF, [ test "$with_ocf" = "yes" ]) +            [OCF_SUBDIR='ocf'], +            ) +AC_SUBST(OCF_SUBDIR)  # LEX needs a check  AC_PROG_LEX diff --git a/extras/Makefile.am b/extras/Makefile.am index 9f2237a2f..47ace72e5 100644 --- a/extras/Makefile.am +++ b/extras/Makefile.am @@ -3,7 +3,7 @@ docdir = $(datadir)/doc/glusterfs/  EditorModedir = $(docdir)/  EditorMode_DATA = glusterfs-mode.el glusterfs.vim -SUBDIRS = init.d benchmarking hook-scripts ocf +SUBDIRS = init.d benchmarking hook-scripts $(OCF_SUBDIR)  confdir = $(sysconfdir)/glusterfs  conf_DATA = glusterfs-logrotate diff --git a/extras/ocf/Makefile.am b/extras/ocf/Makefile.am index 2d7410099..c49a835fb 100644 --- a/extras/ocf/Makefile.am +++ b/extras/ocf/Makefile.am @@ -1,6 +1,5 @@  EXTRA_DIST = glusterd.in volume.in -if WITH_OCF  # The root of the OCF resource agent hierarchy  # Per the OCF standard, it's always "lib",  # not "lib64" (even on 64-bit platforms). @@ -10,4 +9,3 @@ ocfdir = $(prefix)/lib/ocf  radir = $(ocfdir)/resource.d/$(PACKAGE_NAME)  ra_SCRIPTS = glusterd volume -endif diff --git a/glusterfs.spec.in b/glusterfs.spec.in index eb5862ece..a30f9e0dd 100644 --- a/glusterfs.spec.in +++ b/glusterfs.spec.in @@ -31,6 +31,10 @@  %{?_without_georeplication:%global _without_georeplication --disable-geo-replication}  %endif +# if you wish to compile an rpm without the OCF resource agents... +# rpmbuild -ta @PACKAGE_NAME@-@PACKAGE_VERSION@.tar.gz --without ocf +%{?_without_ocf:%global _without_ocf --without-ocf} +  Summary: Cluster File System  Name: @PACKAGE_NAME@  Version: %{version} @@ -42,7 +46,7 @@ Packager: @PACKAGE_BUGREPORT@  URL: http://www.gluster.org/docs/index.php/GlusterFS  Source0: @PACKAGE_NAME@-@PACKAGE_VERSION@.tar.gz  BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) -Requires: openssl >= 1.0 +Requires: openssl  Requires(post): /sbin/chkconfig  Requires(preun): /sbin/service, /sbin/chkconfig  Requires(postun): /sbin/service @@ -56,7 +60,6 @@ BuildRequires: python-devel  %else  BuildRequires: python-ctypes  %endif -BuildRequires: openssl-devel >= 1.0  Obsoletes:        %{name}-libs <= 2.0.0  Obsoletes:        %{name}-common < %{version}-%{release} @@ -159,6 +162,35 @@ is in user space and easily manageable.  This package provides the glusterfs server daemon and translators that  are loaded on the server. +%if 0%{!?_without_ocf:1} +%package resource-agents +Summary:          OCF Resource Agents for GlusterFS +License:          GPLv3+ +# this Group handling comes from the Fedora resource-agents package +%if 0%{?fedora} || 0%{?centos_version} || 0%{?rhel} +Group:            System Environment/Base +%else +Group:            Productivity/Clustering/HA +%endif +# for glusterd +Requires:         glusterfs-server +# depending on the distribution, we need pacemaker or resource-agents +Requires:         %{_prefix}/lib/ocf/resource.d + +%description resource-agents +GlusterFS is a clustered file-system capable of scaling to several +petabytes. It aggregates various storage bricks over Infiniband RDMA +or TCP/IP interconnect into one large parallel network file +system. GlusterFS is one of the most sophisticated file systems in +terms of features and extensibility.  It borrows a powerful concept +called Translators from GNU Hurd kernel. Much of the code in GlusterFS +is in user space and easily manageable. + +This package provides the resource agents which plug glusterd into +Open Cluster Framework (OCF) compliant cluster resource managers, +like Pacemaker. +%endif +  %package devel  Summary:        Development Libraries  License:        GPLv2 or LGPLv3+ @@ -180,8 +212,7 @@ This package provides the development libraries.  %setup -q -n %{name}-%{version}  %build -./autogen.sh -%configure %{?_without_rdma} %{?_without_epoll} %{?_with_fusermount} %{?_without_georeplication} +%configure %{?_without_rdma} %{?_without_epoll} %{?_with_fusermount} %{?_without_georeplication} %{?_without_ocf}  # Remove rpath  sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool @@ -427,6 +458,13 @@ fi  %ghost %dir %attr(0755,-,-) %{_sharedstatedir}/glusterd/peers  %ghost %dir %attr(0755,-,-) %{_sharedstatedir}/glusterd/groups +%if 0%{!?_without_ocf:1} +%files resource-agents +%defattr(-,root,root) +# /usr/lib is the standard for OCF, also on x86_64 +%{_prefix}/lib/ocf/resource.d/glusterfs +%endif +  %files devel  %defattr(-,root,root,-)  %{_includedir}/glusterfs @@ -438,6 +476,9 @@ fi  * Tue Dec 11 2012 Filip Pytloun <filip.pytloun@gooddata.com>  - add sysconfig file +* Thu Oct 25 2012 Niels de Vos <ndevos@redhat.com> +- Add a sub-package for the OCF resource agents +  * Wed Sep 05 2012 Niels de Vos <ndevos@redhat.com>  - Don't use python-ctypes on SLES (from Jörg Petersen) diff --git a/tests/basic/rpm.t b/tests/basic/rpm.t new file mode 100755 index 000000000..7ef9ac570 --- /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 + diff --git a/tests/include.rc b/tests/include.rc index 7877bd5c1..7772bf2d4 100644 --- a/tests/include.rc +++ b/tests/include.rc @@ -13,7 +13,7 @@ mkdir -p $B0;  mkdir -p $M0 $M1;  mkdir -p $N0 $N1; -testcnt=`egrep '^[ \t]*(EXPECT|TEST|EXPECT_WITHIN|EXPECT_KEYWORD)' $0 | wc -l`; +testcnt=`egrep '^[[:space:]]*(EXPECT|TEST|EXPECT_WITHIN|EXPECT_KEYWORD)' $0 | wc -l`;  echo 1..$testcnt  t=1  | 
