From ffad8bd07af2727fda3fa8e53c4ec77ca53adb8f Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 20 May 2021 04:01:00 +0000 Subject: [PATCH 1/5] Makefile: remove an always false condition git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9422 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- Makefile | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 78bb23af2..92831a6d4 100644 --- a/Makefile +++ b/Makefile @@ -387,11 +387,7 @@ dpkg: ../scst_$(VERSION).orig.tar.gz else \ buildopts+=(-j4); \ fi && \ - if false; then \ - dpkg-buildpackage "$${buildopts[@]}"; \ - else \ - debuild "$${buildopts[@]}" --lintian-opts --profile debian; \ - fi && \ + debuild "$${buildopts[@]}" --lintian-opts --profile debian && \ mkdir -p dpkg && \ for f in "$${output_files[@]}" ../scst_$(VERSION).orig.tar.[gx]z; do\ mv $$f dpkg || true; \ From 143ea7b5463a1b5bbe0709f7aa9c5c70582ed566 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 20 May 2021 04:01:24 +0000 Subject: [PATCH 2/5] debian: make sure KVER and KDIR are visible to dpkg build The debuild clears up the environment, thus the essential SCST variables KVER and KDIR are cleared out. This patch fixes it. Note: technically, `debild` supports `--preserve-env` option. But in reality making use of it makes no difference, variables still do not appear. Work around it by using DEB_foo_SET from `man dpkg-buildflags` git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9423 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- Makefile | 2 +- debian/rules | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 92831a6d4..77ad72294 100644 --- a/Makefile +++ b/Makefile @@ -387,7 +387,7 @@ dpkg: ../scst_$(VERSION).orig.tar.gz else \ buildopts+=(-j4); \ fi && \ - debuild "$${buildopts[@]}" --lintian-opts --profile debian && \ + DEB_KVER_SET=$(KVER) DEB_KDIR_SET=$(KDIR) debuild "$${buildopts[@]}" --lintian-opts --profile debian && \ mkdir -p dpkg && \ for f in "$${output_files[@]}" ../scst_$(VERSION).orig.tar.[gx]z; do\ mv $$f dpkg || true; \ diff --git a/debian/rules b/debian/rules index f78e364a0..8342862e9 100755 --- a/debian/rules +++ b/debian/rules @@ -17,6 +17,11 @@ SUBDIRS=scst fcst iscsi-scst qla2x00t/qla2x00-target scst_local scstadmin srpt DESTDIR=$(CURDIR)/debian/tmp VERSION:=$(shell head -n1 debian/changelog | sed 's/.*(\([0-9.]*\).*).*/\1/') +# rules won't see variables unless they're using DEB_foo_SET syntax. So use that as +# an intermediary. Also, export variables for sub-makes to be able to see them. +export KVER=$(DEB_KVER_SET) +export KDIR=$(DEB_KDIR_SET) + %: echo "*** dh $@ ***" dh $@ From fc2135c345400219237fdd146c0584833a6ee518 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 20 May 2021 04:01:46 +0000 Subject: [PATCH 3/5] debian: fix wrong kernel version used in preinst This script is used in the non-dkms scst package. The purpose of package is to determine kernel location at compile-time, as opposed to the package installation time. However, calling `uname -r` in package installation time violates that idea because it would get some random kernel that was running on the machine. This problem is particularly seen in containers, because in those `uname` shows the kernel running on the host, rather than the one running inside container. Fix this by determining the kernel location in `preinst` script at compile time as well. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9424 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- Makefile | 2 ++ debian/rules | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 77ad72294..0df19af3f 100644 --- a/Makefile +++ b/Makefile @@ -367,6 +367,8 @@ dpkg: ../scst_$(VERSION).orig.tar.gz [ -z "$$DEBFULLNAME" ] || export DEBFULLNAME="Bart Van Assche" &&\ sed 's/%{scst_version}/$(VERSION)/' \ debian/scst.dkms && \ + sed 's/%{KVER}/$(KVER)/' \ + debian/scst.preinst && \ output_files=( \ ../*_$(VERSION)-$(DEBIAN_REVISION)_*.deb \ ../*_$(VERSION)-$(DEBIAN_REVISION)_*.ddeb \ diff --git a/debian/rules b/debian/rules index 8342862e9..0c49bded8 100755 --- a/debian/rules +++ b/debian/rules @@ -29,7 +29,7 @@ export KDIR=$(DEB_KDIR_SET) clean: dh_testdir && \ dh_prep -Xqla_isp/TAGS -Xdebian/changelog && \ - scripts/clean-source-tree -x debian/changelog -x debian/compat + scripts/clean-source-tree -x debian/changelog -x debian/compat -x debian/scst.preinst build: make 2release && \ From 2de5765c9ca9ac9f4a1afa8918270bf2207674c4 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 20 May 2021 04:02:06 +0000 Subject: [PATCH 4/5] debian: make sure depmod uses the correct version By default it uses the currently running kernel, which is not necessary the kernel the package was built for. Fix this by generating the path on package creation stage. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9425 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- Makefile | 2 ++ debian/rules | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 0df19af3f..8becf0947 100644 --- a/Makefile +++ b/Makefile @@ -369,6 +369,8 @@ dpkg: ../scst_$(VERSION).orig.tar.gz debian/scst.dkms && \ sed 's/%{KVER}/$(KVER)/' \ debian/scst.preinst && \ + sed 's/%{KVER}/$(KVER)/' \ + debian/scst.postinst && \ output_files=( \ ../*_$(VERSION)-$(DEBIAN_REVISION)_*.deb \ ../*_$(VERSION)-$(DEBIAN_REVISION)_*.ddeb \ diff --git a/debian/rules b/debian/rules index 0c49bded8..af061fb37 100755 --- a/debian/rules +++ b/debian/rules @@ -29,7 +29,8 @@ export KDIR=$(DEB_KDIR_SET) clean: dh_testdir && \ dh_prep -Xqla_isp/TAGS -Xdebian/changelog && \ - scripts/clean-source-tree -x debian/changelog -x debian/compat -x debian/scst.preinst + scripts/clean-source-tree -x debian/changelog -x debian/compat -x debian/scst.preinst \ + -x debian/scst.postinst build: make 2release && \ From bbc5c2544579419537b9396d720b907079eaca7a Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 20 May 2021 04:02:37 +0000 Subject: [PATCH 5/5] debian: make sure CC variable is passed through to the build See also https://github.com/bvanassche/scst/pull/37. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9426 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- Makefile | 2 +- debian/rules | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8becf0947..36545d500 100644 --- a/Makefile +++ b/Makefile @@ -391,7 +391,7 @@ dpkg: ../scst_$(VERSION).orig.tar.gz else \ buildopts+=(-j4); \ fi && \ - DEB_KVER_SET=$(KVER) DEB_KDIR_SET=$(KDIR) debuild "$${buildopts[@]}" --lintian-opts --profile debian && \ + DEB_CC_SET="$(CC)" DEB_KVER_SET=$(KVER) DEB_KDIR_SET=$(KDIR) debuild "$${buildopts[@]}" --lintian-opts --profile debian && \ mkdir -p dpkg && \ for f in "$${output_files[@]}" ../scst_$(VERSION).orig.tar.[gx]z; do\ mv $$f dpkg || true; \ diff --git a/debian/rules b/debian/rules index af061fb37..efd2cf134 100755 --- a/debian/rules +++ b/debian/rules @@ -21,6 +21,7 @@ VERSION:=$(shell head -n1 debian/changelog | sed 's/.*(\([0-9.]*\).*).*/\1/') # an intermediary. Also, export variables for sub-makes to be able to see them. export KVER=$(DEB_KVER_SET) export KDIR=$(DEB_KDIR_SET) +export CC=$(DEB_CC_SET) %: echo "*** dh $@ ***"