Whamcloud - gitweb
LU-14948 build: Warn about /usr/src/lustre.tar.bz2 77/44677/5
authorShaun Tancheff <shaun.tancheff@hpe.com>
Tue, 4 Jan 2022 15:22:57 +0000 (22:22 +0700)
committerOleg Drokin <green@whamcloud.com>
Wed, 26 Jan 2022 05:14:52 +0000 (05:14 +0000)
When /usr/src/lustre.tar.bz2 exists, make debs (and dkms-debs)
will fail with an error like:

  Extracting the package tarball, /usr/src/lustre.tar.bz2, ...
  ../../generic.sh: line 73: debian/rules: Permission denied
  BUILD FAILED!

Add the current git hash to the lustre tarball, as well as
attempt to remove the conflict from /usr/src.  Failing that,
give a warning to ask the user to remove the conflicting file.

HPE-bug-id: LUS-10308
Test-Parameters: trivial
Signed-off-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Change-Id: I4aaa803cb81c2ed8ffc0182bb49ea0bff5064df4
Reviewed-on: https://review.whamcloud.com/44677
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
autoMakefile.am
debian/rules

index 367e957..b73a74f 100644 (file)
@@ -234,10 +234,20 @@ srpm: @PACKAGE_TARNAME@.spec dist Makefile
        cp $$rpmbuilddir/SRPMS/$(distdir)-*.src.rpm $(top_srcdir) || exit 1; \
        rm -rf $$rpmbuilddir
 
+debs_common:
+       export SRC_GIT_HASH=$$(git log --oneline | head -1 | cut -d' ' -f1); \
+       rm -f /usr/src/lustre-$${SRC_GIT_HASH}.tar.bz2; \
+       if test -f /usr/src/lustre-$${SRC_GIT_HASH}.tar.bz2; then \
+               echo "************************************************************" ; \
+               echo "WARNING: move or remove /usr/src/lustre-$${SRC_GIT_HASH}.tar.bz2" ; \
+               echo "************************************************************" ; \
+               exit 1 ; \
+       fi
 # In the debs target, first make sure what's in the changelog reflects
 # the software version.
-debs: undef.h
+debs: undef.h debs_common
        cp -v debian/changelog.in debian/changelog ; \
+       export SRC_GIT_HASH=$$(git log --oneline | head -1 | cut -d' ' -f1); \
        lversion=$$(echo @VERSION@ | tr '_' '-'); \
        cversion=$$(sed -ne '1s/^lustre (\(.*\)-[0-9][0-9]*).*$$/\1/p' debian/changelog); \
        if [ "$$lversion" != "$$cversion" ]; then \
@@ -320,7 +330,7 @@ debs: undef.h
        pushd debian/tmp/modules-deb && \
        dpkg -x ../../../../lustre-source_$${version}_all.deb $$(pwd) && \
        mkdir usr_src/ && \
-       tar -C usr_src/ -xjf usr/src/lustre.tar.bz2 && \
+       tar -C usr_src/ -xjf usr/src/lustre-$${SRC_GIT_HASH}.tar.bz2 && \
        chmod 755 usr_src/modules/lustre/debian/rules && \
        mkdir -p usr_share_modass && \
        ln -s /usr/share/modass/include/ usr_share_modass/ && \
@@ -344,8 +354,9 @@ debs: undef.h
           ../lustre_$${VER}.tar.gz ../lustre-*-modules-$${KVERS}_$${VER}_*.deb \
           debs/
 
-dkms-debs: undef.h
+dkms-debs: undef.h debs_common
        cp -v debian/changelog.in debian/changelog ; \
+       export SRC_GIT_HASH=$$(git log --oneline | head -1 | cut -d' ' -f1); \
        lversion=$$(echo @VERSION@ | tr '_' '-'); \
        cversion=$$(sed -ne '1s/^lustre (\(.*\)-[0-9][0-9]*).*$$/\1/p' debian/changelog); \
        if [ "$$lversion" != "$$cversion" ]; then \
index 447ff78..30e8016 100755 (executable)
@@ -360,7 +360,7 @@ binary-$(SOURCE_PKG): build-stamp
               debian/$(SOURCE_PKG)/usr/src/modules/lustre/debian/patches/* 
        $(MAKE) -C debian/$(SOURCE_PKG)/usr/src/modules/lustre -f debian/rules clean
        # Create the module-source tarball.
-       cd debian/$(SOURCE_PKG)/usr/src && tar jcf lustre.tar.bz2 modules 
+       cd debian/$(SOURCE_PKG)/usr/src && tar jcf lustre-$${SRC_GIT_HASH}.tar.bz2 modules
        rm -rf debian/$(SOURCE_PKG)/usr/src/modules
        dh_install -p$(SOURCE_PKG)
        dh_installchangelogs -p $(SOURCE_PKG) lustre/ChangeLog