[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] [RFC] make rpm and make srpm for master branches (call for votes ;))



Hi all,

the patch in attachment adds $subject to cluster.git master branch as a
PoC.

The spec file that we are adding at this point in time is "simple".
By simple I mean that it doesn't handle upgrades from STABLE3 rpm yet
(it will once the whole split tree is converted to autotools and will
have rpm targets) and it does assume and install bits as you were
downloading rpm from any fedora repository. AKA no custom prefixes or
path are supported (I don't plan to add them either as they introduce a
level of complexity I am not sure we even care to handle).
The versioning of the package is basic and needs to improve to include
information such as git commit and set alpha tags. This is just a PoC
for now, so keep that in mind.

I strongly believe this change will have different positive effects:

1) people developing bits higher up in the split tree (for example
gfs2-utils), will not be required to build, install and manually keep
updated the dependency trees (at least the process is highly simplified
for them).

2) we will have spec files ready for review for F13.

3) people that want to remove bits, will be able to do it easily with
rpm instead of manual rm of files or have to remember to run make
uninstall.

4) upgrades from git trees in high development phase won't leave
leftovers on the system because rpm will do the right thing for them.

5) at somepoint we might be able to generate new rpm in an automatic
fashion either on a daily or per commit base.

Possible cons:

1) the spec file needs to be updated as changes go in the tree. This
could be a little bit of overhead but for experience I know is minimal.

2) in order to use the make rpm/srpm targes, more developer tools are
required on the system (note that those targets are NOT invoked by
default. So you need those tools only if you want to build rpm).

How to use it (assuming you have the default set of autotools
installed):

yum install fedora-packager (to pull in all rpmbuild bits or make sure
to have rpmbuild and git installed)

cd cluster
./autogen.sh && ./configure
(note that no options are required to configure)
make rpm (or srpm)

building the rpm _could_ fail if the rpm build dependencies are missing
(but so would building from the git tree). Nothing I can automate
here...

the results will be stored in the git tree directory:

.build-....log contains the full build log
x86_64/ contains the RPM (or i586 or..)
cluster-$(VERSION).tar.gz is the source tarball at that specific point
in time
cluster-$(VERSION)...src.rpm is the srpm of course.
cluster-$(VERSION)/ directory contains the build tree/objects from the
rpm build process. Useful to investigate failures.

NOTE that none of those bits are part of any make clean target.

Please let me know if we should keep moving on this front, or just skip
it.

Cheers
Fabio
diff --git a/Makefile.am b/Makefile.am
index b845c7a..b0fae9d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,6 @@
-EXTRA_DIST		= autogen.sh make/lcrso.mk
+SPEC			= $(PACKAGE_NAME).spec
+
+EXTRA_DIST		= autogen.sh make/lcrso.mk $(SPEC).in
 
 AUTOMAKE_OPTIONS	= foreign
 
@@ -18,6 +20,36 @@ if BUILD_BINDINGS
 SUBDIRS			+= bindings
 endif
 
+$(PACKAGE_NAME)-$(VERSION).tar.gz:
+			cd $(srcdir) && \
+			git archive \
+				--format=tar \
+				--prefix=$(PACKAGE_NAME)-$(VERSION)/ \
+				HEAD | tar xp && \
+			tar cp $(PACKAGE_NAME)-$(VERSION) | \
+				gzip -9 \
+				> $(abs_builddir)/$(PACKAGE_NAME)-$(VERSION).tar.gz && \
+			rm -rf $(PACKAGE_NAME)-$(VERSION)
+
+RPMBUILDOPTS		= --define "_sourcedir $(abs_builddir)" \
+			  --define "_specdir $(abs_builddir)" \
+			  --define "_builddir $(abs_builddir)" \
+			  --define "_srcrpmdir $(abs_builddir)" \
+			  --define "_rpmdir $(abs_builddir)"
+
+$(SPEC): $(SPEC).in
+
+srpm: $(SPEC) $(PACKAGE_NAME)-$(VERSION).tar.gz
+			rpmbuild \
+				$(RPMBUILDOPTS) \
+				--nodeps -bs $(SPEC)
+
+rpm: $(SPEC) $(PACKAGE_NAME)-$(VERSION).tar.gz srpm
+			rpmbuild \
+				$(RPMBUILDOPTS) \
+				-ba $(SPEC) 2>&1 | \
+			tee .build-$(VERSION).log
+
 install-exec-local:
 			$(INSTALL) -d $(DESTDIR)/$(LOGDIR)
 			$(INSTALL) -d $(DESTDIR)/$(CLUSTERVARRUN)
diff --git a/cluster.spec.in b/cluster.spec.in
new file mode 100644
index 0000000..ff7a9d0
--- /dev/null
+++ b/cluster.spec.in
@@ -0,0 +1,194 @@
+###############################################################################
+###############################################################################
+##
+##  Copyright (C) 2004-2009 Red Hat, Inc.  All rights reserved.
+##
+##  This copyrighted material is made available to anyone wishing to use,
+##  modify, copy, or redistribute it subject to the terms and conditions
+##  of the GNU General Public License v.2.
+##
+###############################################################################
+###############################################################################
+
+# main (empty) package
+# http://www.rpm.org/max-rpm/s1-rpm-subpack-spec-file-changes.html
+
+# keep around ready for later user
+## define alphatag @VERSION@
+
+Name: cluster
+Summary: Red Hat Cluster
+Version: @VERSION@
+Release: 1%{?alphatag:.%{alphatag}}%{?dist}
+License: GPLv2+ and LGPLv2+
+Group: System Environment/Base
+URL: http://sources.redhat.com/cluster/wiki/
+Source0: ftp://sources.redhat.com/pub/cluster/releases/cluster-%{version}%{?alphatag:.%{alphatag}}.tar.gz
+
+## Setup/build bits
+
+BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
+
+%define buildtrunk 1
+%{?alphatag: %define buildtrunk 1}
+%{?_with_buildtrunk: %define buildtrunk 1}
+
+# Build dependencies
+
+BuildRequires: perl python
+BuildRequires: glibc-kernheaders glibc-devel
+BuildRequires: libxml2-devel
+BuildRequires: corosynclib-devel >= 0.98-1
+BuildRequires: openaislib-devel >= 0.97-1
+BuildRequires: openldap-devel perl(ExtUtils::MakeMaker)
+BuildRequires: automake autoconf libtool
+
+%prep
+%setup -q -n cluster-%{version}%{?alphatag:.%{alphatag}}
+
+%if %{buildtrunk}
+./autogen.sh
+%endif
+
+%{_configure}	CFLAGS="$(echo '%{optflags}')" \
+		--prefix=/usr \
+		--sysconfdir=/etc \
+		--localstatedir=/var \
+		--libdir=%{_libdir} \
+		--enable-bindings
+
+%build
+make %{_smp_mflags}
+
+%install
+rm -rf %{buildroot}
+make install DESTDIR=%{buildroot}
+
+## tree fix up
+# logrotate name
+mv %{buildroot}%{_sysconfdir}/logrotate.d/cluster \
+	%{buildroot}%{_sysconfdir}/logrotate.d/cman
+# remove static libraries and libtool leftovers
+find %{buildroot} -name "*.a" -exec rm {} \;
+find %{buildroot} -name "*.la" -exec rm {} \;
+find %{buildroot} -type f -exec chrpath -d {} >/dev/null 2>&1 \;
+# fix library permissions or fedora strip helpers won't work.
+find %{buildroot} -name "lib*.so.*" -exec chmod 0755 {} \;
+# fix lcrso permissions or fedora strip helpers won't work.
+find %{buildroot} -name "*.lcrso" -exec chmod 0755 {} \;
+# remove docs
+rm -rf %{buildroot}/usr/share/doc/cluster
+# cleanup perl bindings bits
+find %{buildroot} -type f -name .packlist -exec rm -f {} \;
+find %{buildroot} -type f -name perllocal.pod -exec rm -f {} \;
+find %{buildroot} -type f -name '*.bs' -a -empty -exec rm -f {} \;
+find %{buildroot} -type f -name CCS.so -exec chmod 755 {} \;
+
+%clean
+rm -rf %{buildroot}
+
+## Runtime and subpackages section
+
+# main empty package
+%description
+Red Hat Cluster
+
+## subpackages
+
+%package -n cman
+Group: System Environment/Base
+Summary: Red Hat Cluster Manager
+Requires(post): chkconfig
+Requires(preun): initscripts
+Requires(preun): chkconfig
+Requires: corosync >= 0.98-1
+Requires: openais >= 0.97-1
+Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
+Requires: ricci >= 0.15.0-4 modcluster >= 0.15.0-3
+
+%description -n cman
+Red Hat Cluster Manager
+
+%post -n cman
+/sbin/chkconfig --add cman
+
+# make sure to stop cman always as last
+%preun -n cman
+if [ "$1" = 0 ]; then
+	/sbin/service cman stop >/dev/null 2>&1
+	/sbin/chkconfig --del cman
+fi
+
+%files -n cman
+%defattr(-,root,root,-)
+%doc doc/COPYING.* doc/COPYRIGHT doc/README.licence doc/*.txt config/plugins/ldap/*.ldif
+%dir %{_sysconfdir}/cluster
+# %{_sysconfdir}/rc.d/init.d/cman
+%dir %{_sysconfdir}/cluster/cman-notify.d
+%config(noreplace) %{_sysconfdir}/logrotate.d/cman
+%{_sbindir}/ccs*
+%{_sbindir}/cman*
+%{_sbindir}/confdb2ldif
+%{_sbindir}/group*
+%{_sbindir}/*qdisk*
+/usr/libexec/*
+# %dir %{_datadir}/cluster
+# %{_datadir}/cluster/cluster.rng
+%{perl_vendorarch}/*
+%dir /var/log/cluster
+%{_mandir}/man3/*
+%{_mandir}/man5/*
+%{_mandir}/man8/ccs*
+%{_mandir}/man8/cman*
+%{_mandir}/man8/confdb2ldif*
+%{_mandir}/man8/group*
+%{_mandir}/man8/*qdisk*
+
+%package -n clusterlib
+Group: System Environment/Libraries
+Summary: The Red Hat Cluster libraries
+Conflicts: cman < 3.0.0-5.alpha4
+Provides: cmanlib = %{version}
+Obsoletes: cmanlib < 3.0.0-5.alpha4
+
+%description -n clusterlib
+The Red Hat Cluster libraries package
+
+%files -n clusterlib
+%defattr(-,root,root,-)
+%doc doc/COPYING.* doc/COPYRIGHT doc/README.licence
+%{_libdir}/libcman.so.*
+%{_libdir}/libccs*.so.*
+%{_libdir}/liblogthread*.so.*
+
+%post -n clusterlib -p /sbin/ldconfig
+
+%postun -n clusterlib -p /sbin/ldconfig
+
+%package -n clusterlib-devel
+Group: Development/Libraries
+Summary: The Red Hat Cluster libraries development package
+Requires: clusterlib = %{version}-%{release}
+Requires: pkgconfig
+Provides: cman-devel = %{version}
+Obsoletes: cman-devel < 3.0.0-5.alpha4
+Provides: cmanlib-devel = %{version}
+Obsoletes: cmanlib-devel < 3.0.0-5.alpha4
+
+%description -n clusterlib-devel
+The Red Hat Cluster libraries development package
+
+%files -n clusterlib-devel
+%defattr(-,root,root,-)
+%doc doc/COPYING.* doc/COPYRIGHT doc/README.licence
+%{_libdir}/libcman.so
+%{_libdir}/libccs*.so
+%{_libdir}/liblogthread*.so
+%{_includedir}/ccs.h
+%{_includedir}/libcman.h
+%{_includedir}/liblogthread.h
+%{_libdir}/pkgconfig/*.pc
+
+%changelog
+* Sat Jun 20 2009 Autotools generated version <nobody nowhere org> - @VERSION -1
+- Unstable snapshot
diff --git a/configure.ac b/configure.ac
index 1d4844e..2ff8bdb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -303,6 +303,7 @@ AC_CONFIG_FILES([Makefile
 		 bindings/Makefile
 		 bindings/perl/Makefile
 		 bindings/perl/ccs/Makefile
+		 cluster.spec
 		 ])
 
 AC_OUTPUT

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]