From 1d97ac16d8ade4786202c2e9005896a2ac661340 Mon Sep 17 00:00:00 2001 From: Shaun Tancheff Date: Tue, 4 Jan 2022 22:22:57 +0700 Subject: [PATCH] LU-14948 build: Warn about /usr/src/lustre.tar.bz2 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 Change-Id: I4aaa803cb81c2ed8ffc0182bb49ea0bff5064df4 Reviewed-on: https://review.whamcloud.com/44677 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- autoMakefile.am | 17 ++++++++++++++--- debian/rules | 2 +- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/autoMakefile.am b/autoMakefile.am index 367e957..b73a74f 100644 --- a/autoMakefile.am +++ b/autoMakefile.am @@ -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 \ diff --git a/debian/rules b/debian/rules index 447ff78..30e8016 100755 --- a/debian/rules +++ b/debian/rules @@ -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 -- 1.8.3.1