From patchwork Tue Dec 26 13:52:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13504894 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C1B004EB42; Tue, 26 Dec 2023 13:52:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="nyKhjWua" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 005C9C433C7; Tue, 26 Dec 2023 13:52:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703598777; bh=AQY7dmprZJmESi+61/lhMwT1uO26gspqlrGm0b7sd2s=; h=From:To:Cc:Subject:Date:From; b=nyKhjWua2/XlcnQVnS4Osre4jpkurB2edDocb5nMDx/FaT1Fly7efvMGfHw1+FdHo n9630IsYXcWl6KXaUngiBDlgOOlKRRjFILzeYM6+QSVSSvkp9b0S/8LdWpD0OJ34ss 9RlApq4B+HNswz1S4fx31VY9L6ZB8vkftf8LbanXwjYi0uvX5UHQ3o/v10ua/BaWqC NejKrVi/5Dz9tf8S2w9lqcIMhtGgfgErYUkCz5LOS03M2haCm28BJTl63ipDO6y91G W4MNo+9flDX7OL4N+soUKWzqIFCML2P3JtT5wwV6mkPC91RVdjYTX+MzmqKq2HiZ09 Kva6jwhM37W3A== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Ben Hutchings , Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier , linux-kernel@vger.kernel.org Subject: [PATCH 1/6] kbuild: deb-pkg: factor out common Make options in debian/rules Date: Tue, 26 Dec 2023 22:52:38 +0900 Message-Id: <20231226135243.1393780-1-masahiroy@kernel.org> X-Mailer: git-send-email 2.40.1 Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This avoid code duplication between binary-arch and built-arch. Signed-off-by: Masahiro Yamada Reviewed-by: Nicolas Schier --- scripts/package/debian/rules | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/package/debian/rules b/scripts/package/debian/rules index 3dafa9496c63..26bc6239e200 100755 --- a/scripts/package/debian/rules +++ b/scripts/package/debian/rules @@ -10,20 +10,20 @@ ifneq (,$(filter-out parallel=1,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))) MAKEFLAGS += -j$(NUMJOBS) endif +make-opts = ARCH=$(ARCH) KERNELRELEASE=$(KERNELRELEASE) + .PHONY: binary binary-indep binary-arch binary: binary-arch binary-indep binary-indep: build-indep binary-arch: build-arch - $(MAKE) -f $(srctree)/Makefile ARCH=$(ARCH) \ - KERNELRELEASE=$(KERNELRELEASE) \ + $(MAKE) -f $(srctree)/Makefile $(make-opts) \ run-command KBUILD_RUN_COMMAND=+$(srctree)/scripts/package/builddeb .PHONY: build build-indep build-arch build: build-arch build-indep build-indep: build-arch: - $(MAKE) -f $(srctree)/Makefile ARCH=$(ARCH) \ - KERNELRELEASE=$(KERNELRELEASE) \ + $(MAKE) -f $(srctree)/Makefile $(make-opts) \ $(shell $(srctree)/scripts/package/deb-build-option) \ olddefconfig all From patchwork Tue Dec 26 13:52:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13504895 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6E2924F1EC; Tue, 26 Dec 2023 13:52:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="muzM/KiE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 969DAC433CB; Tue, 26 Dec 2023 13:52:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703598778; bh=qV21Ddxy565YeVMxc5SZLejjsKbZ8CTNjuyHTzJU14s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=muzM/KiEaiuwfCK9I8JLbD7PghAhWtcrnCeYuBNt+0ShtQnRV8n5Df7aT0Lpc2hAN N1+3Pv87ppFluNbnEVskEMzSuuHelElRCW48pSbylCY5SauirAP+oGtWEPWFUp4CvG kciQIGtBN+PIkvNl3GzjeTgcbuO4Fwvn/rZJP4pw5zS7O4NLntNqh1hmsgFn/Ly6qw aWubuNusZ4E+iJIzkb6FlTB3N61MIcGBJOyovSmPxXF6LxcoJy4F6WLh473JNwNQd1 /byx4TG9CwIhmHcULXe63+cDKNuqMXEc/TnW8ulT3LWneaKcWGb26YZhXH0IbK/dk+ qJMGtqb5cUDKA== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Ben Hutchings , Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier , linux-kernel@vger.kernel.org Subject: [PATCH 2/6] kbuild: deb-pkg: squash scripts/package/deb-build-option to debian/rules Date: Tue, 26 Dec 2023 22:52:39 +0900 Message-Id: <20231226135243.1393780-2-masahiroy@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231226135243.1393780-1-masahiroy@kernel.org> References: <20231226135243.1393780-1-masahiroy@kernel.org> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The binary-arch target needs to use the same CROSS_COMPILE as used in build-arch; otherwise, 'make run-command' may attempt to resync the .config file. Squash scripts/package/deb-build-option into debian/rules, as it is a small amount of code. Signed-off-by: Masahiro Yamada Reviewed-by: Nicolas Schier --- scripts/package/deb-build-option | 14 -------------- scripts/package/debian/rules | 5 +++-- 2 files changed, 3 insertions(+), 16 deletions(-) delete mode 100755 scripts/package/deb-build-option diff --git a/scripts/package/deb-build-option b/scripts/package/deb-build-option deleted file mode 100755 index 7950eff01781..000000000000 --- a/scripts/package/deb-build-option +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -# SPDX-License-Identifier: GPL-2.0-only - -# Set up CROSS_COMPILE if not defined yet -if [ "${CROSS_COMPILE+set}" != "set" -a "${DEB_HOST_ARCH}" != "${DEB_BUILD_ARCH}" ]; then - echo CROSS_COMPILE=${DEB_HOST_GNU_TYPE}- -fi - -version=$(dpkg-parsechangelog -S Version) -debian_revision="${version##*-}" - -if [ "${version}" != "${debian_revision}" ]; then - echo KBUILD_BUILD_VERSION=${debian_revision} -fi diff --git a/scripts/package/debian/rules b/scripts/package/debian/rules index 26bc6239e200..529b71b55efa 100755 --- a/scripts/package/debian/rules +++ b/scripts/package/debian/rules @@ -10,7 +10,9 @@ ifneq (,$(filter-out parallel=1,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))) MAKEFLAGS += -j$(NUMJOBS) endif -make-opts = ARCH=$(ARCH) KERNELRELEASE=$(KERNELRELEASE) +revision = $(lastword $(subst -, ,$(shell dpkg-parsechangelog -S Version))) +CROSS_COMPILE ?= $(filter-out $(DEB_BUILD_GNU_TYPE)-, $(DEB_HOST_GNU_TYPE)-) +make-opts = ARCH=$(ARCH) KERNELRELEASE=$(KERNELRELEASE) KBUILD_BUILD_VERSION=$(revision) $(addprefix CROSS_COMPILE=,$(CROSS_COMPILE)) .PHONY: binary binary-indep binary-arch binary: binary-arch binary-indep @@ -24,7 +26,6 @@ build: build-arch build-indep build-indep: build-arch: $(MAKE) -f $(srctree)/Makefile $(make-opts) \ - $(shell $(srctree)/scripts/package/deb-build-option) \ olddefconfig all .PHONY: clean From patchwork Tue Dec 26 13:52:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13504896 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E21984F216; Tue, 26 Dec 2023 13:53:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="I9whyM/H" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 356D2C43391; Tue, 26 Dec 2023 13:52:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703598780; bh=GHEJTufmGu+U5ws6uli9pWrljzPPuOpjnKKiIXQ9OP4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I9whyM/HAPsMMSg1XN9ZxtCtIVJSCpjEhZks2t2pdHelgP0JVYZL44424b/PqLRlk 1mj56KFfHC5zKF6uCqgl5oG8JFqieAfs7TxhMVTsNgsfL8IdJ1TmpYHHTX7l0ljywv eT70jgQ6XmRk1MXCYd8YsfAKa/acYi9t3NHmY6AMsaenIEfUKrq0E6R70FO7TJIEk1 yR5Mkd3EDLZMot6wH3HRIRQMrAK8yAXTY+mOc+qm7AFEcQDLUQ+D3m/hiwa0fjooZE cjRcNfOtbpZkeX6UDNWUvrEfZmTqIg184pv/S1MV9u5sDx0DLvbSQMjtpeNbq8nKGf aWzljeUwtPAFQ== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Ben Hutchings , Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier , linux-kernel@vger.kernel.org Subject: [PATCH 3/6] kbuild: deb-pkg: set DEB_* variables if debian/rules is directly executed Date: Tue, 26 Dec 2023 22:52:40 +0900 Message-Id: <20231226135243.1393780-3-masahiroy@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231226135243.1393780-1-masahiroy@kernel.org> References: <20231226135243.1393780-1-masahiroy@kernel.org> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Since commit 491b146d4c13 ("kbuild: builddeb: Eliminate debian/arch use"), direct execution of debian/rules results in the following error: dpkg-architecture: error: unknown option 'DEB_HOST_MULTIARCH' The current code: dpkg-architecture -a$DEB_HOST_ARCH -qDEB_HOST_MULTIARCH ... does not look sensible because: - For this code to work correctly, DEB_HOST_ARCH must be pre-defined, which is true when the packages are built via dpkg-buildpackage. In this case, DEB_HOST_MULTIARCH is also likely defined, hence there is no need to query DEB_HOST_MULTIARCH in the first place. - If DEB_HOST_MULTIARCH is undefined, DEB_HOST_ARCH is likely undefined too. So, you cannot query DEB_HOST_MULTIARCH in this way. This is mostly the case where debian/rules is directly executed. When debian/rules is directly executed, querying DEB_HOST_MUCHARCH is not enough because we need to know DEB_{BUILD,HOST}_GNU_TYPE as well. All DEB_* variables are defined when the package build is initiated by dpkg-buildpackage, but otherwise, let's call dpkg-architecture to set all DEB_* environment variables. This implementation relies on dpkg commit 7c54fa2b232e ("dpkg-architecture: Add a --print-format option"). Signed-off-by: Masahiro Yamada Reviewed-by: Nicolas Schier --- scripts/package/builddeb | 5 ++--- scripts/package/debian/rules | 12 +++++++++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/scripts/package/builddeb b/scripts/package/builddeb index 2fe51e6919da..2eb4910f0ef3 100755 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -171,9 +171,8 @@ install_libc_headers () { # move asm headers to /usr/include//asm to match the structure # used by Debian-based distros (to support multi-arch) - host_arch=$(dpkg-architecture -a$DEB_HOST_ARCH -qDEB_HOST_MULTIARCH) - mkdir $pdir/usr/include/$host_arch - mv $pdir/usr/include/asm $pdir/usr/include/$host_arch/ + mkdir "$pdir/usr/include/${DEB_HOST_MULTIARCH}" + mv "$pdir/usr/include/asm" "$pdir/usr/include/${DEB_HOST_MULTIARCH}" } rm -f debian/files diff --git a/scripts/package/debian/rules b/scripts/package/debian/rules index 529b71b55efa..8f24a8e84bf2 100755 --- a/scripts/package/debian/rules +++ b/scripts/package/debian/rules @@ -30,5 +30,15 @@ build-arch: .PHONY: clean clean: - rm -rf debian/files debian/linux-* + rm -rf debian/files debian/linux-* debian/deb-env.vars $(MAKE) -f $(srctree)/Makefile ARCH=$(ARCH) clean + +# If DEB_HOST_ARCH is empty, it is likely that debian/rules was executed +# directly. Run 'dpkg-architecture --print-set --print-format=make' to +# generate a makefile construct that exports all DEB_* variables. +ifndef DEB_HOST_ARCH +-include debian/deb-env.vars + +debian/deb-env.vars: + dpkg-architecture -a$$(cat debian/arch) --print-set --print-format=make > $@ +endif From patchwork Tue Dec 26 13:52:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13504897 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6B3D94F611; Tue, 26 Dec 2023 13:53:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="FF9W5eoD" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C482AC433CA; Tue, 26 Dec 2023 13:53:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703598782; bh=Yf/hVKai4B6D9hPEEtKdrrl+YI82sgCF8wTLgHt9pu4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FF9W5eoD+RTmcaGMUHt0CAUOkEsYUbbmUx8w7n/lVKh6ddtIVeEZt0obusP1CTZek sJ3Q+wFhHbA/vVxU5DpdNwn7kS3CN0BD94l2va+qgGhvkCoKTOAcLXvehz+zjmQWEF fHdS1zN+1RPHY9osh/y3yOb+xVH7lZnRJIRbUt3hsnRf6iDVtXmA6Jp8kwb1SaXERm HRZfJWhyZ4tm8uzLlXLsKYC6TQME0c562eviHKIAqmkfaLVlMtCiH1RzB1b6XWysgh dT5ukV8lBxq5mS6khHHxYIyKbXhDmcGL4OSu7LDIJCIvSEYMOp/iG/q9p5Q7Vhsk80 eJ8lgoieLWw+Q== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Ben Hutchings , Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier , linux-kernel@vger.kernel.org Subject: [PATCH 4/6] kbuild: deb-pkg: allow to run debian/rules from output directory Date: Tue, 26 Dec 2023 22:52:41 +0900 Message-Id: <20231226135243.1393780-4-masahiroy@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231226135243.1393780-1-masahiroy@kernel.org> References: <20231226135243.1393780-1-masahiroy@kernel.org> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 'make O=... deb-pkg' creates the debian directory in the output directory. However, currently it is impossible to run debian/rules created in the separate output directory. This commit delays the $(srctree) expansion by escaping '$' and by quating the entire command, making it possible to run debian/rules in the output directory. Signed-off-by: Masahiro Yamada Reviewed-by: Nicolas Schier --- scripts/package/debian/rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/package/debian/rules b/scripts/package/debian/rules index 8f24a8e84bf2..6b2333e3cf96 100755 --- a/scripts/package/debian/rules +++ b/scripts/package/debian/rules @@ -19,7 +19,7 @@ binary: binary-arch binary-indep binary-indep: build-indep binary-arch: build-arch $(MAKE) -f $(srctree)/Makefile $(make-opts) \ - run-command KBUILD_RUN_COMMAND=+$(srctree)/scripts/package/builddeb + run-command KBUILD_RUN_COMMAND='+$${srctree}/scripts/package/builddeb' .PHONY: build build-indep build-arch build: build-arch build-indep From patchwork Tue Dec 26 13:52:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13504898 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 270FC4F8A6; Tue, 26 Dec 2023 13:53:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="g6Ryscme" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60B44C433CB; Tue, 26 Dec 2023 13:53:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703598783; bh=fSRgbph1yPaaUtk0eAjQa+ArlTVll7f5fkppZKDNpBg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g6RyscmeMEpXnOlMRmKtwyX7WOTR+p/iLVqxnGz2NW9MO6CnLueLYmiwj7XefRDiT v1c+KjwFOBGsMkFAxXJIlyj6Y0bY5A6bg/IsXu5q6EpCqfuFo7UYHgVx/naEMxGBlt oruY50rGDqPaglzXdzH1Aa0Uye7SirKLoqBWow9FvWHZMwujHjgpAV81Jflkul3pW/ rFdRIcVWX3pVi2eDCV1NhzH+dSc1/GjDEJvHcQP5S0I5WufY3fi9IeYdeX8jHivXIQ 6T3qHH7axfU3psgo8U09LX4QYvbNXqBrqjXlw2cNEKPB7vqjlJSaNSY0y59mp81Dho KYO5nVEyuJ1KA== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Ben Hutchings , Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier , linux-kernel@vger.kernel.org Subject: [PATCH 5/6] kbuild: deb-pkg: remove unneeded '-f $srctree/Makefile' in debian/rules Date: Tue, 26 Dec 2023 22:52:42 +0900 Message-Id: <20231226135243.1393780-5-masahiroy@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231226135243.1393780-1-masahiroy@kernel.org> References: <20231226135243.1393780-1-masahiroy@kernel.org> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This is unneeded because the Makefile in the output directory wraps the top-level Makefile in the srctree. Just run $(MAKE) irrespective of the build location. Signed-off-by: Masahiro Yamada Reviewed-by: Nicolas Schier --- scripts/package/debian/rules | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/scripts/package/debian/rules b/scripts/package/debian/rules index 6b2333e3cf96..36d51f60f98d 100755 --- a/scripts/package/debian/rules +++ b/scripts/package/debian/rules @@ -3,8 +3,6 @@ include debian/rules.vars -srctree ?= . - ifneq (,$(filter-out parallel=1,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))) NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) MAKEFLAGS += -j$(NUMJOBS) @@ -18,20 +16,20 @@ make-opts = ARCH=$(ARCH) KERNELRELEASE=$(KERNELRELEASE) KBUILD_BUILD_VERSION=$(r binary: binary-arch binary-indep binary-indep: build-indep binary-arch: build-arch - $(MAKE) -f $(srctree)/Makefile $(make-opts) \ + $(MAKE) $(make-opts) \ run-command KBUILD_RUN_COMMAND='+$${srctree}/scripts/package/builddeb' .PHONY: build build-indep build-arch build: build-arch build-indep build-indep: build-arch: - $(MAKE) -f $(srctree)/Makefile $(make-opts) \ + $(MAKE) $(make-opts) \ olddefconfig all .PHONY: clean clean: rm -rf debian/files debian/linux-* debian/deb-env.vars - $(MAKE) -f $(srctree)/Makefile ARCH=$(ARCH) clean + $(MAKE) ARCH=$(ARCH) clean # If DEB_HOST_ARCH is empty, it is likely that debian/rules was executed # directly. Run 'dpkg-architecture --print-set --print-format=make' to From patchwork Tue Dec 26 13:52:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13504899 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D130B4EB5E; Tue, 26 Dec 2023 13:53:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="sgBVAgpa" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F16D5C433CA; Tue, 26 Dec 2023 13:53:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703598785; bh=Xd3RiHeuNxlRf7T5i6AVEz2ZQo7xF4C6gARQq5XvO3U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sgBVAgpa6Mx1oNF36hARX877uYe/EOtNlyhZoVHLngzwJVt6yp2RDtyng8vyZUCsW PTqrIWxpbVVeQgO4Oz/SnlroG04pZdSQ3BPOqNpBDJ5kTb71GMuT9cQXd+5P7+0+ap zHoAlPNpgIpv9PHUpizffQ09MQqNUbC9o7TlsgwB66ke/FmncOgMNxTUix4NF6Tjpe SnBDzugE8xAVvBWS84voRh6oAh0RW4B6PdgzJbapSVNkpikfsB8Oy+OhUVwgpsEkpJ 7xRFDYEJE3B43+8Ps/VnYzYUcbcM6q/WZN4WWzPzMYI6al4Y+f2Yk4EtKkvx1ZeD/e jbYrym1T/OTcw== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Ben Hutchings , Masahiro Yamada , Nicolas Schier , Nathan Chancellor , Nick Desaulniers , Nicolas Schier , linux-kernel@vger.kernel.org Subject: [PATCH 6/6] kbuild: deb-pkg: use more debhelper commands in builddeb Date: Tue, 26 Dec 2023 22:52:43 +0900 Message-Id: <20231226135243.1393780-6-masahiroy@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231226135243.1393780-1-masahiroy@kernel.org> References: <20231226135243.1393780-1-masahiroy@kernel.org> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Commit 36862e14e316 ("kbuild: deb-pkg: use dh_listpackages to know enabled packages") started to require the debhelper tool suite. Use more dh_* commands in create_package(): - dh_installdocs to install copyright - dh_installchangelogs to install changelog - dh_compress to compress changelog - dh_fixperms to replace the raw chmod command - dh_gencontrol to replace the raw dpkg-gencontrol command - dh_md5sums to record the md5sum of included files - dh_builddeb to replace the raw dpkg-deb command Set DEB_RULES_REQUIRES_ROOT to 'no' in case debian/rules is executed directly. Signed-off-by: Masahiro Yamada Reviewed-by: Nicolas Schier --- scripts/package/builddeb | 23 ++++++++--------------- scripts/package/debian/rules | 2 ++ scripts/package/mkdebian | 2 +- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/scripts/package/builddeb b/scripts/package/builddeb index 2eb4910f0ef3..436d55a83ab0 100755 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -26,23 +26,16 @@ if_enabled_echo() { create_package() { local pname="$1" pdir="$2" - local dpkg_deb_opts - mkdir -m 755 -p "$pdir/DEBIAN" - mkdir -p "$pdir/usr/share/doc/$pname" - cp debian/copyright "$pdir/usr/share/doc/$pname/" - cp debian/changelog "$pdir/usr/share/doc/$pname/changelog.Debian" - gzip -n -9 "$pdir/usr/share/doc/$pname/changelog.Debian" - sh -c "cd '$pdir'; find . -type f ! -path './DEBIAN/*' -printf '%P\0' \ - | xargs -r0 md5sum > DEBIAN/md5sums" + export DH_OPTIONS="-p${pname} -P${pdir}" - # a+rX in case we are in a restrictive umask environment like 0077 - # ug-s in case we build in a setuid/setgid directory - chmod -R go-w,a+rX,ug-s "$pdir" - - # Create the package - dpkg-gencontrol -p$pname -P"$pdir" - dpkg-deb --root-owner-group ${KDEB_COMPRESS:+-Z$KDEB_COMPRESS} --build "$pdir" .. + dh_installdocs + dh_installchangelogs + dh_compress + dh_fixperms + dh_gencontrol + dh_md5sums + dh_builddeb -- ${KDEB_COMPRESS:+-Z$KDEB_COMPRESS} } install_linux_image () { diff --git a/scripts/package/debian/rules b/scripts/package/debian/rules index 36d51f60f98d..1f56938ea5d4 100755 --- a/scripts/package/debian/rules +++ b/scripts/package/debian/rules @@ -1,6 +1,8 @@ #!/usr/bin/make -f # SPDX-License-Identifier: GPL-2.0-only +export DEB_RULES_REQUIRES_ROOT := no + include debian/rules.vars ifneq (,$(filter-out parallel=1,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))) diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian index 93a24712b9a1..070149c985fe 100755 --- a/scripts/package/mkdebian +++ b/scripts/package/mkdebian @@ -193,7 +193,7 @@ Section: kernel Priority: optional Maintainer: $maintainer Rules-Requires-Root: no -Build-Depends: debhelper +Build-Depends: debhelper-compat (= 12) Build-Depends-Arch: bc, bison, cpio, flex, kmod, libelf-dev:native, libssl-dev:native, rsync Homepage: https://www.kernel.org/