Whamcloud - gitweb
LU-19053 build: allow specifying "make rpms" build dir 10/59410/2
authorAndreas Dilger <adilger@whamcloud.com>
Sat, 24 May 2025 03:56:38 +0000 (21:56 -0600)
committerOleg Drokin <green@whamcloud.com>
Thu, 12 Jun 2025 06:36:21 +0000 (06:36 +0000)
Currently "make rpms" will create a temporary directory with mktemp
to hold the intermediate build products, and this ends up in /tmp.
This can cause issues if /tmp is not large enough for the full build.

Allow specifying "BUILDDIR=DIR" to redirect the intermediate build
products into the specified directory. This allows you to run:

    BUILDDIR=/var/tmp make rpms

or

    BUILDDIR=/var/tmp make debs

Test-Parameters: trivial
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I12f2e7444f0fc7f09f41d64b8e4dd4a429797a37
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/59410
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Reviewed-by: Timothy Day <timday@amazon.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
autoMakefile.am

index 543db02..b707807 100644 (file)
@@ -222,7 +222,7 @@ rpm-local:
 
 if SERVER
 dkms-srpm: $(PACKAGE)-dkms.spec dist Makefile
-       rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
+       rpmbuilddir=$$(mktemp -t $${BUILDDIR:+-p $$BUILDDIR} -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX); \
        $(MAKE) $(AM_MAKEFLAGS) \
                rpmbuilddir="$$rpmbuilddir" rpm-local || exit 1; \
        $(RPMBUILD) \
@@ -247,7 +247,7 @@ dkms-srpm: $(PACKAGE)-dkms.spec dist Makefile
        rm -rf $$rpmbuilddir
 
 dkms-rpm: dkms-srpm
-       rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
+       rpmbuilddir=$$(mktemp -t $${BUILDDIR:+-p $$BUILDDIR} -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX); \
        $(RPMBUILD) \
                --define "_tmppath $$rpmbuilddir/TMP" \
                --define "_topdir $$rpmbuilddir" \
@@ -271,7 +271,7 @@ dkms-rpm: dkms-srpm
 else
 
 dkms-srpm: $(PACKAGE)-dkms.spec dist Makefile
-       rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
+       rpmbuilddir=$$(mktemp -t $${BUILDDIR:+-p $$BUILDDIR} -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX); \
        $(MAKE) $(AM_MAKEFLAGS) \
                rpmbuilddir="$$rpmbuilddir" rpm-local || exit 1; \
        $(RPMBUILD) \
@@ -284,7 +284,7 @@ dkms-srpm: $(PACKAGE)-dkms.spec dist Makefile
        rm -rf $$rpmbuilddir
 
 dkms-rpm: dkms-srpm
-       rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
+       rpmbuilddir=$$(mktemp -t $${BUILDDIR:+-p $$BUILDDIR} -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX); \
        $(RPMBUILD) \
                --define "_tmppath $$rpmbuilddir/TMP" \
                --define "_topdir $$rpmbuilddir" \
@@ -301,7 +301,7 @@ dkms-srpms: dkms-srpm
 dkms-rpms: dkms-rpm
 
 rpms: srpm
-       rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
+       rpmbuilddir=$$(mktemp -t $${BUILDDIR:+-p $$BUILDDIR} -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX); \
        if test "x@CONFIG_CACHE_FILE@" != "x"; then \
                export CONFIG_CACHE_FILE="@CONFIG_CACHE_FILE@"; \
        fi; \
@@ -316,7 +316,7 @@ rpms: srpm
        rm -rf $$rpmbuilddir
 
 srpm: @PACKAGE_TARNAME@.spec dist Makefile
-       rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
+       rpmbuilddir=$$(mktemp -t $${BUILDDIR:+-p $$BUILDDIR} -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX); \
        $(MAKE) $(AM_MAKEFLAGS) \
                rpmbuilddir="$$rpmbuilddir" rpm-local || exit 1; \
        cp $(top_srcdir)/rpm/* $(top_srcdir); \
@@ -383,7 +383,7 @@ debs: undef.h debs_common
        if test "x@CONFIG_CACHE_FILE@" != "x"; then \
                export CONFIG_CACHE_FILE="@CONFIG_CACHE_FILE@"; \
        fi; \
-       debiantmp=$$(mktemp -t -d debbuild-$$USER-XXXXXXXX) ; \
+       debiantmp=$$(mktemp -t $${BUILDDIR:+-p $$BUILDDIR} -d debbuild-$$USER-XXXXXXXX) ; \
        cp debian/control.main $$debiantmp/control.main.bkp ; \
        cp debian/control.modules.in $$debiantmp/control.modules.in.bkp ; \
        if test "x@ENABLE_GSS@" = "xyes"; then \