From patchwork Tue Dec 19 18:19:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13498837 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 E23EF37D22; Tue, 19 Dec 2023 18:20:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qYF1DQSO" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 177D0C433C8; Tue, 19 Dec 2023 18:20:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703010003; bh=aInprk0ngpVeNnqzMh3MIxqFI0iItoCxCcQKP9eY+0g=; h=From:To:Cc:Subject:Date:From; b=qYF1DQSOUwWbonEZuQnUedchL1AA/rl6qHM2alJs8EwfCOZZWCbd89Y/ZY94Bp+fF UFk0cuWkuNhE6dXiikjazDtGwu7SV+flwC63uGVnlX25OI9qRt2D62SSgqo71dILjx vby74RHSBwqsvMItLWyOZwvI9e0Pw23mG8W8hnGGYv4YvPtYh4cqycU9y/kLazRQZe KFzYAnIiO9sHI1Zht7+kBno+E9F4QNfGe12UW8RD6yvV4wKkcGTnZto9mqkM9Cc2YS XoDb2rPX0ZAC9+CoKmPcOvnFhiJmDEgSdR8dVen6l5iS6kIpNpwWDHORbXuPbecXt7 L32q1BN8wU5WA== 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/3] kbuild: deb-pkg: do not query DEB_HOST_MULTIARCH Date: Wed, 20 Dec 2023 03:19:55 +0900 Message-Id: <20231219181957.1449958-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 Since commit 491b146d4c13 ("kbuild: builddeb: Eliminate debian/arch use"), the direct execution of debian/rules fails with: dpkg-architecture: error: unknown option 'DEB_HOST_MULTIARCH' I am not sure how important to support such a use case, but at least the current code: dpkg-architecture -a$DEB_HOST_ARCH -qDEB_HOST_MULTIARCH ... looks weird because: - For this code to work correctly, DEB_HOST_ARCH must be defined. In this case, DEB_HOST_MULTIARCH is likely defined, so there is no need to query DEB_HOST_MULTIARCH in the first place. This is likely the case where the package build was initiated by dpkg-buildpackage. - If DEB_HOST_MULTIARCH is undefined, DEB_HOST_ARCH is likely undefined. So, you cannot query DEB_HOST_MULTIARCH in this way. This is mostly the case where debian/rules is directly executed. If we want to run debian/rules directly, we can revert 491b146d4c13 or add code to remember DEB_HOST_MULTIARCH, but I chose to remove the useless code for now. Signed-off-by: Masahiro Yamada Reviewed-by: Nicolas Schier --- scripts/package/builddeb | 5 ++--- 1 file changed, 2 insertions(+), 3 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 From patchwork Tue Dec 19 18:19:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13498838 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 5170337D11; Tue, 19 Dec 2023 18:20:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Cbjnk3Od" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE844C433C9; Tue, 19 Dec 2023 18:20:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703010004; bh=AaFL2QfFHAQnWIfLNvEB+DuhYCBztejbdLjDhGWXvY8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cbjnk3Od9pe0nhW2pQ5anOAp0pBEoTzfI6g55UqQsO2aS2U70MCYydnkIk1Rwv8rD fypHHP3Stmizb7qeEn2IF7y2Vr6MIT77+ILqW1Em29qfgMqvwoKwTbBjehzVbgK9up pLEg+b4xGwiir+nDHVeRXwdQXP25H1p/A0U9suwZpO7Vb+1x9/GRvgiWJ1Mya2rn9H cN5BEF9Q6Bmfj3VM8qYxbyTFIjYI+ZOGb7NOfVUm8DdDw/CZ6Cy11Sn17kE4W8Jbos XRuthpHzn150f9gxEBnhJKLobHfMgBUdlj6gHyPX7sCmJhUvSN38nx6XInZJ85Ih+M uLWtezgbQvuvw== 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/3] kbuild: deb-pkg: hard-code Build-Depends Date: Wed, 20 Dec 2023 03:19:56 +0900 Message-Id: <20231219181957.1449958-2-masahiroy@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231219181957.1449958-1-masahiroy@kernel.org> References: <20231219181957.1449958-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 condition to require libelf-dev:native is stale because objtool is now enabled by CONFIG_OBJTOOL instead of CONFIG_UNWINDER_ORC. Not only objtool but also resolve_btfids requires libelf-dev:native; therefore, CONFIG_DEBUG_INFO_BTF should be checked as well. Similarly, CONFIG_SYSTEM_TRUSTED_KEYRING is not the only case that requires libssl-dev:native. Perhaps, the following code would provide better coverage, but it is hard to maintain (and may still be imperfect). if is_enabled CONFIG_OBJTOOL || is_enabled CONFIG_DEBUG_INFO_BTF; then build_depends="${build_depends}, libelf-dev:native" fi if is_enabled CONFIG_SYSTEM_TRUSTED_KEYRING || is_enabled CONFIG_SYSTEM_REVOCATION_LIST || is_enabled CONFIG_MODULE_SIG_FORMAT; then build_depends="${build_depends}, libssl-dev:native" fi Let's hard-code the build dependency. Signed-off-by: Masahiro Yamada Reviewed-by: Nicolas Schier --- scripts/package/mkdebian | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian index 91f0e09600b1..93a24712b9a1 100755 --- a/scripts/package/mkdebian +++ b/scripts/package/mkdebian @@ -176,8 +176,6 @@ else fi echo $debarch > debian/arch -extra_build_depends=", $(if_enabled_echo CONFIG_UNWINDER_ORC libelf-dev:native)" -extra_build_depends="$extra_build_depends, $(if_enabled_echo CONFIG_SYSTEM_TRUSTED_KEYRING libssl-dev:native)" # Generate a simple changelog template cat < debian/changelog @@ -195,7 +193,8 @@ Section: kernel Priority: optional Maintainer: $maintainer Rules-Requires-Root: no -Build-Depends: bc, debhelper, rsync, kmod, cpio, bison, flex $extra_build_depends +Build-Depends: debhelper +Build-Depends-Arch: bc, bison, cpio, flex, kmod, libelf-dev:native, libssl-dev:native, rsync Homepage: https://www.kernel.org/ Package: $packagename-$version From patchwork Tue Dec 19 18:19:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13498839 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 07A5738F82; Tue, 19 Dec 2023 18:20:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="kZXKGT46" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4AD71C433CA; Tue, 19 Dec 2023 18:20:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703010006; bh=u2yNd+lyopnSLnXJeDa3LJGhWEvy/TMKtwvC5M0a7Ws=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kZXKGT46jQErrazVLLjVnqEPJRKZcTtFbw06T5JzLr6QTPz651LM0LFD2RuLvMNuB iLtS4hqQq6fueB5NQUI7mXOKTZnw3WONPrXHc2mhX2IrntrWRSUPCnKTZ3HiqjcgdD jJDHLrYJTAdm0GuvwW028e2bGowwSPWyi7rDdYC0NFcrBbQ5yVsa5HOMqMNqrz6k/e 9NAThsH1cXK2aiB729StJvWq9ywCXw+oUVTXaygvGhG5yQPOoaKvbbqgVt8tHRCwJo xOB3QtjaTKtktcxl2BE5/KEZARoEi0LGPKSndHKxQVR72/jYBylMqqjFJxddP+J2ZN TsChWO3GKq+Jw== 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/3] kbuild: deb-pkg: use more debhelper commands Date: Wed, 20 Dec 2023 03:19:57 +0900 Message-Id: <20231219181957.1449958-3-masahiroy@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231219181957.1449958-1-masahiroy@kernel.org> References: <20231219181957.1449958-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 Signed-off-by: Masahiro Yamada Reviewed-by: Nicolas Schier --- scripts/package/builddeb | 23 ++++++++--------------- scripts/package/mkdebian | 2 +- 2 files changed, 9 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/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/