[sheepdog-users] [PATCH stable-0.8 1/2] rpm: make dependencies of zookeeper and fuse packages optional

Hitoshi Mitake mitake.hitoshi at lab.ntt.co.jp
Mon Feb 24 06:46:38 CET 2014


Current "make rpm" requires zookeeper-lib-devel and fuse-devel
unconditionally. When users don't want zookeeper driver or sheepfs,
they should be disabled.

Related issue:
https://bugs.launchpad.net/sheepdog-project/+bug/1264253

Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
 Makefile.am      |   20 ++++++++++++++++++++
 sheepdog.spec.in |    6 +++---
 2 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 4487fad..4b5a098 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -62,6 +62,26 @@ RPMBUILDOPTS = --define "_sourcedir $(abs_builddir)" \
 		--define "_srcrpmdir $(abs_builddir)" \
 		--define "_rpmdir $(abs_builddir)"
 
+RPMBUILD_CONFIG_OPTS =
+RPMBUILD_REQ_OPTS =
+RPMBUILD_BUILD_REQ_OPTS =
+
+if BUILD_ZOOKEEPER
+RPMBUILD_CONFIG_OPTS += --enable-zookeeper
+RPMBUILD_REQ_OPTS += zookeeper
+RPMBUILD_BUILD_REQ_OPTS += zookeeper-lib-devel
+endif
+
+if BUILD_SHEEPFS
+RPMBUILD_CONFIG_OPTS += --enable-sheepfs
+RPMBUILD_REQ_OPTS += fuse
+RPMBUILD_BUILD_REQ_OPTS += fuse-devel
+endif
+
+RPMBUILDOPTS += --define "_configopts $(RPMBUILD_CONFIG_OPTS)"
+RPMBUILDOPTS += --define "_requires $(RPMBUILD_REQ_OPTS)"
+RPMBUILDOPTS += --define "_buildrequires $(RPMBUILD_BUILD_REQ_OPTS)"
+
 $(TARFILE):
 	$(MAKE) dist
 
diff --git a/sheepdog.spec.in b/sheepdog.spec.in
index 261bd73..8d190f7 100644
--- a/sheepdog.spec.in
+++ b/sheepdog.spec.in
@@ -8,14 +8,14 @@ URL: http://www.osrg.net/sheepdog
 Source0: http://downloads.sourceforge.net/project/sheepdog/%{name}/%{version}/%{name}-%{version}.tar.gz
 
 # Runtime bits
-Requires: corosync fuse zookeeper
+Requires: corosync %{_requires}
 Requires(post): chkconfig
 Requires(preun): chkconfig
 Requires(preun): initscripts
 
 # Build bits
 BuildRequires: autoconf automake
-BuildRequires: corosynclib-devel userspace-rcu-devel fuse-devel zookeeper-lib-devel
+BuildRequires: corosynclib-devel userspace-rcu-devel %{_buildrequires}
 
 BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
 
@@ -28,7 +28,7 @@ a distributed object storage system for QEMU.
 
 %build
 ./autogen.sh
-%{configure} --with-initddir=%{_initrddir} --enable-sheepfs --enable-zookeeper
+%{configure} --with-initddir=%{_initrddir} %{_config_opts}
 
 make %{_smp_mflags}
 
-- 
1.7.10.4




More information about the sheepdog-users mailing list