[Sheepdog] [PATCH] Add sheepdog RPM generation to autotools system

Steven Dake sdake at redhat.com
Fri Aug 20 20:38:02 CEST 2010


This patch adds the logic necessary to generate an RPM file within the
sheepdog working dir by running the command "make rpm".

Signed-off-by: Steven Dake <sdake at redhat.com>
---
 Makefile.am      |   39 ++++++++++++++++++++++++++++++++++++++-
 sheepdog.spec.in |   52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 90 insertions(+), 1 deletions(-)
 create mode 100644 sheepdog.spec.in

diff --git a/Makefile.am b/Makefile.am
index 88b174c..7bff145 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,8 @@
-EXTRA_DIST		= 
+SPEC			= $(PACKAGE_NAME).spec
+
+TARFILE			= $(PACKAGE_NAME)-$(VERSION).tar.gz
+
+EXTRA_DIST		= autogen.sh
 
 AUTOMAKE_OPTIONS	= foreign
 
@@ -16,8 +20,41 @@ sheepdogsysconf_DATA	=
 SUBDIRS			= lib collie sheep include script
 
 install-exec-local:
+	$(INSTALL) -d $(DESTDIR)/${localstatedir}/lib/sheepdog
 
 uninstall-local:
+	rmdir $(DESTDIR)/${localstatedir}/lib/sheepdog || :;
 
 dist-clean-local:
 	rm -f autoconf automake autoheader
+
+clean-generic:
+	rm -rf $(SPEC) $(TARFILE)
+
+$(SPEC): $(SPEC).in
+	rm -f $@-t $@
+	LC_ALL=C date="$(shell date "+%a %b %d %Y")" && \
+	sed \
+	-e "s#@version@#$(VERSION)#g" \
+	-e "s#@date@#$$date#g" \
+	$< > $@-t
+	chmod a-w $@-t
+	mv $@-t $@
+
+RPMBUILDOPTS = --define "_sourcedir $(abs_builddir)" \
+		--define "_specdir $(abs_builddir)" \
+		--define "_builddir $(abs_builddir)" \
+		--define "_srcrpmdir $(abs_builddir)" \
+		--define "_rpmdir $(abs_builddir)"
+
+$(TARFILE):
+	$(MAKE) dist
+
+srpm: clean
+	$(MAKE) $(SPEC) $(TARFILE)
+	rpmbuild $(RPMBUILDOPTS) --nodeps -bs $(SPEC)
+
+rpm: clean
+	$(MAKE) $(SPEC) $(TARFILE)
+	rpmbuild $(RPMBUILDOPTS) -ba $(SPEC)
+
diff --git a/sheepdog.spec.in b/sheepdog.spec.in
new file mode 100644
index 0000000..dd9a94e
--- /dev/null
+++ b/sheepdog.spec.in
@@ -0,0 +1,52 @@
+Name: sheepdog
+Summary: The Sheepdog Distributed Storage System for KVM/QEMU
+Version: @version@
+Release: 1%{?dist}
+License: GPL
+Group: System Environment/Base
+URL: http://www.osrg.net/sheepdog
+Source0: http://sourceforge.net/project/sheepdog/files/%{name}-%{version}.tar.gz
+
+# Runtime bits
+Requires: corosync corosynclib
+
+# Build bits
+BuildRequires: autoconf automake
+BuildRequires: corosync corosynclib corosynclib-devel
+
+BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
+
+%prep
+%setup -q -n %{name}-%{version}
+
+%build
+./autogen.sh
+%{configure} --with-initddir=%{_initrddir}
+
+make %{_smp_mflags}
+
+%install
+rm -rf %{buildroot}
+
+make install DESTDIR=%{buildroot}
+
+## tree fixup
+# drop static libs
+rm -f %{buildroot}%{_libdir}/*.a
+
+%clean
+rm -rf %{buildroot}
+
+%description
+This package contains the Sheepdog server, and command line tool.
+
+%files
+%defattr(-,root,root,-)
+%doc COPYING README
+%{_sbindir}/sheep
+%{_sbindir}/collie
+%dir %{_localstatedir}/lib/sheepdog
+
+%changelog
+* @date@ Autotools generated version <nobody at nowhere.org> - @version at -1.@alphatag@
+- Autotools generated version
-- 
1.7.2.1




More information about the sheepdog mailing list