Whamcloud - gitweb
LU-5919 build: Make "make rpms" use "make srpm" output 61/12961/11
authorDmitry Eremin <dmitry.eremin@intel.com>
Wed, 1 Apr 2015 19:27:03 +0000 (15:27 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 25 May 2015 03:04:29 +0000 (03:04 +0000)
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 <dmitry.eremin@intel.com>
Signed-off-by: Christopher J. Morrone <morrone2@llnl.gov>
Change-Id: I9b2e83e000aca62b5d4841e2ebe9e91fa1db300f
Reviewed-on: http://review.whamcloud.com/12961
Tested-by: Jenkins
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
autoMakefile.am
config/lustre-build.m4
configure.ac

index c6aff1f..78f31ac 100644 (file)
@@ -99,11 +99,45 @@ EXTRA_DIST = @PACKAGE_TARNAME@.spec \
        build/Rules.in                  \
        build/gen_filelist.sh
 
        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
 
 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
 
 # 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
index c3bf669..d17fb4b 100644 (file)
@@ -521,7 +521,6 @@ AS_IF([test x$enable_server = xyes],
 #
 AC_DEFUN([LB_CONFIG_RPMBUILD_OPTIONS], [
 RPMBINARGS=
 #
 AC_DEFUN([LB_CONFIG_RPMBUILD_OPTIONS], [
 RPMBINARGS=
-RPMSRCARGS=
 CONFIGURE_ARGS=
 eval set -- $ac_configure_args
 for arg; do
 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
 fi
 
 RPMBUILD_BINARY_ARGS=$RPMBINARGS
-RPMBUILD_SOURCE_ARGS=$RPMSRCARGS
 
 AC_SUBST(RPMBUILD_BINARY_ARGS)
 
 AC_SUBST(RPMBUILD_BINARY_ARGS)
-AC_SUBST(RPMBUILD_SOURCE_ARGS)
 ]) # LB_CONFIG_RPMBUILD_OPTIONS
 
 #
 ]) # LB_CONFIG_RPMBUILD_OPTIONS
 
 #
index 92cd6ee..c6219c5 100644 (file)
@@ -16,9 +16,10 @@ AM_MAINTAINER_MODE([enable])
 
 AC_PROG_CC
 AC_PROG_LIBTOOL
 
 AC_PROG_CC
 AC_PROG_LIBTOOL
-
+AC_PROG_MKDIR_P
 AM_PROG_AS
 
 AM_PROG_AS
 
+AC_PATH_PROG(RPMBUILD, rpmbuild)
 AC_CHECK_TOOLS(AR, ar)
 
 LB_CONFIGURE
 AC_CHECK_TOOLS(AR, ar)
 
 LB_CONFIGURE