From a71ab04971382c77f708d6a082e8ee2fa845e9be Mon Sep 17 00:00:00 2001 From: Dmitry Eremin Date: Wed, 1 Apr 2015 15:27:03 -0400 Subject: [PATCH 1/1] LU-5919 build: Make "make rpms" use "make srpm" output We rework the rpms and srpm Make targets. The srpm target generates the source rpm package much as it did before, but it puts the results in a known temporary rpm build tree. This allows the "make rpms" target to simply depend on the srpm target, and then build the binary rpms from the source rpm. Previously the rpm target _also_ generated a source rpm package, which could be redudant, and failed to verify that the source rpm package was itself buildable. Signed-off-by: Dmitry Eremin Signed-off-by: Christopher J. Morrone Change-Id: I9b2e83e000aca62b5d4841e2ebe9e91fa1db300f Reviewed-on: http://review.whamcloud.com/12961 Tested-by: Jenkins Reviewed-by: James Simmons Tested-by: Maloo Reviewed-by: Bob Glossman Reviewed-by: Oleg Drokin --- autoMakefile.am | 40 +++++++++++++++++++++++++++++++++++++--- config/lustre-build.m4 | 3 --- configure.ac | 3 ++- 3 files changed, 39 insertions(+), 7 deletions(-) diff --git a/autoMakefile.am b/autoMakefile.am index c6aff1f..78f31ac 100644 --- a/autoMakefile.am +++ b/autoMakefile.am @@ -99,11 +99,45 @@ EXTRA_DIST = @PACKAGE_TARNAME@.spec \ build/Rules.in \ build/gen_filelist.sh -rpms: @PACKAGE_TARNAME@.spec dist Makefile - rpmbuild @RPMBUILD_BINARY_ARGS@ -ta $(distdir).tar.gz +rpm-local: + @(if test -z "$(RPMBUILD)"; then \ + echo -e "\n" \ + "*** Required util 'rpmbuild' missing. Please install the\n" \ + "*** package for your distribution which provides 'rpmbuild',\n" \ + "*** re-run configure, and try again.\n"; \ + exit 1; \ + fi; \ + $(MKDIR_P) $(rpmbuilddir)/TMP && \ + $(MKDIR_P) $(rpmbuilddir)/BUILD && \ + $(MKDIR_P) $(rpmbuilddir)/RPMS && \ + $(MKDIR_P) $(rpmbuilddir)/SRPMS && \ + $(MKDIR_P) $(rpmbuilddir)/SPECS && \ + $(MKDIR_P) $(rpmbuilddir)/SOURCES) + +rpms: srpm + rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \ + $(MAKE) $(AM_MAKEFLAGS) \ + rpmbuilddir="$$rpmbuilddir" rpm-local || exit 1; \ + $(RPMBUILD) \ + --define "_tmppath $$rpmbuilddir/TMP" \ + --define "_topdir $$rpmbuilddir" \ + @RPMBUILD_BINARY_ARGS@ \ + --rebuild $(distdir)-*.src.rpm || exit 1; \ + cp $$rpmbuilddir/RPMS/*/*.rpm $(top_srcdir) || exit 1; \ + rm -rf $$rpmbuilddir srpm: @PACKAGE_TARNAME@.spec dist Makefile - rpmbuild @RPMBUILD_SOURCE_ARGS@ -ts $(distdir).tar.gz + rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \ + $(MAKE) $(AM_MAKEFLAGS) \ + rpmbuilddir="$$rpmbuilddir" rpm-local || exit 1; \ + $(RPMBUILD) \ + --define "_tmppath $$rpmbuilddir/TMP" \ + --define "_topdir $$rpmbuilddir" \ + --define "build_src_rpm 1" \ + --define "dist %{nil}" \ + -ts $(distdir).tar.gz || exit 1; \ + cp $$rpmbuilddir/SRPMS/$(distdir)-*.src.rpm $(top_srcdir) || exit 1; \ + rm -rf $$rpmbuilddir # In the debs target, first make sure what's in the changelog reflects # the software version. Here's how we could dig the version out of the diff --git a/config/lustre-build.m4 b/config/lustre-build.m4 index c3bf669..d17fb4b 100644 --- a/config/lustre-build.m4 +++ b/config/lustre-build.m4 @@ -521,7 +521,6 @@ AS_IF([test x$enable_server = xyes], # AC_DEFUN([LB_CONFIG_RPMBUILD_OPTIONS], [ RPMBINARGS= -RPMSRCARGS= CONFIGURE_ARGS= eval set -- $ac_configure_args for arg; do @@ -606,10 +605,8 @@ if test x$enable_manpages != xyes ; then fi RPMBUILD_BINARY_ARGS=$RPMBINARGS -RPMBUILD_SOURCE_ARGS=$RPMSRCARGS AC_SUBST(RPMBUILD_BINARY_ARGS) -AC_SUBST(RPMBUILD_SOURCE_ARGS) ]) # LB_CONFIG_RPMBUILD_OPTIONS # diff --git a/configure.ac b/configure.ac index 92cd6ee..c6219c5 100644 --- a/configure.ac +++ b/configure.ac @@ -16,9 +16,10 @@ AM_MAINTAINER_MODE([enable]) AC_PROG_CC AC_PROG_LIBTOOL - +AC_PROG_MKDIR_P AM_PROG_AS +AC_PATH_PROG(RPMBUILD, rpmbuild) AC_CHECK_TOOLS(AR, ar) LB_CONFIGURE -- 1.8.3.1