From nobody Wed Dec 17 08:52:12 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9845AC07CA9 for ; Tue, 28 Nov 2023 15:39:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346881AbjK1PjW (ORCPT ); Tue, 28 Nov 2023 10:39:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346835AbjK1PjU (ORCPT ); Tue, 28 Nov 2023 10:39:20 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B7B8B0 for ; Tue, 28 Nov 2023 07:39:27 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A32AC433C7; Tue, 28 Nov 2023 15:39:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701185966; bh=Ul+5JsEr00hCpcNY6/TNQDzkKwuTkuFGMnHWCDK+NiQ=; h=From:To:Cc:Subject:Date:From; b=bxtKZl5cWQvfmShV2blhYD0rDSVuah4Ce0Eozowu4YOmpaYNRnSb6GLgpLG0AWcut Iwr6tTepl394varvsVmU920cR7OmdKvFrcGMfSOrDw46hVs4DQ7pb0ai+zk6vcqzEI je5wWmc/0iegGdNDotkuZ+LeVAASpcsvPazhoKMBOpYcEqEuQFqBWshfM820Qx3y2z HMya6KS6oNDZtscgJA+TbVOPEHr2A11XC49PQSWqJJ27xPhWEmulgKkMjFnb8sfDUi gPs7wsZsQv5AoXdP9Pvs8D93I7da5S3WRRM3tvWajQyOeFFUTWMR7MJPT0hd6d1ik6 wZL1U2qEboNwQ== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Guillem Jover , Ben Hutchings , Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier , linux-kernel@vger.kernel.org Subject: [PATCH v2] kbuild: deb-pkg: remove the fakeroot builds support Date: Wed, 29 Nov 2023 00:38:58 +0900 Message-Id: <20231128153858.84932-1-masahiroy@kernel.org> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" In 2017, the dpkg suite introduced the rootless builds support with the following commits: - 2436807c87b0 ("dpkg-deb: Add support for rootless builds") - fca1bfe84068 ("dpkg-buildpackage: Add support for rootless builds") This feature is available in the default dpkg on Debian 10 and Ubuntu 20.04. Remove the old method. Additionally, export DEB_RULES_REQUIRES_ROOT=3Dno in case debian/rules is invoked without dpkg-buildpackage. This change aligns with the Debian kernel commit 65206e29f378 ("Allow to run d/rules.real without root"). While the upstream kernel currently does not run dh_testroot, it may be useful in the future. Signed-off-by: Masahiro Yamada --- Changes in v2: - add DEB_RULES_REQUIRES_ROOT=3Dno to debian/rules scripts/Makefile.package | 4 +--- scripts/package/builddeb | 8 +------- scripts/package/debian/rules | 2 ++ 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/scripts/Makefile.package b/scripts/Makefile.package index 0c3adc48dfe8..a81dfb1f5181 100644 --- a/scripts/Makefile.package +++ b/scripts/Makefile.package @@ -109,8 +109,6 @@ debian-orig: linux.tar$(debian-orig-suffix) debian cp $< ../$(orig-name); \ fi =20 -KBUILD_PKG_ROOTCMD ?=3D 'fakeroot -u' - PHONY +=3D deb-pkg srcdeb-pkg bindeb-pkg =20 deb-pkg: private build-type :=3D source,binary @@ -125,7 +123,7 @@ deb-pkg srcdeb-pkg bindeb-pkg: $(if $(findstring source, $(build-type)), \ --unsigned-source --compression=3D$(KDEB_SOURCE_COMPRESS)) \ $(if $(findstring binary, $(build-type)), \ - -R'$(MAKE) -f debian/rules' -j1 -r$(KBUILD_PKG_ROOTCMD) -a$$(cat debian/= arch), \ + -R'$(MAKE) -f debian/rules' -j1 -a$$(cat debian/arch), \ --no-check-builddeps) \ $(DPKG_FLAGS)) =20 diff --git a/scripts/package/builddeb b/scripts/package/builddeb index d7dd0d04c70c..2fe51e6919da 100755 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -36,19 +36,13 @@ create_package() { sh -c "cd '$pdir'; find . -type f ! -path './DEBIAN/*' -printf '%P\0' \ | xargs -r0 md5sum > DEBIAN/md5sums" =20 - # Fix ownership and permissions - if [ "$DEB_RULES_REQUIRES_ROOT" =3D "no" ]; then - dpkg_deb_opts=3D"--root-owner-group" - else - chown -R root:root "$pdir" - fi # 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" =20 # Create the package dpkg-gencontrol -p$pname -P"$pdir" - dpkg-deb $dpkg_deb_opts ${KDEB_COMPRESS:+-Z$KDEB_COMPRESS} --build "$pdir= " .. + dpkg-deb --root-owner-group ${KDEB_COMPRESS:+-Z$KDEB_COMPRESS} --build "$= pdir" .. } =20 install_linux_image () { diff --git a/scripts/package/debian/rules b/scripts/package/debian/rules index 3dafa9496c63..f23d97087948 100755 --- a/scripts/package/debian/rules +++ b/scripts/package/debian/rules @@ -5,6 +5,8 @@ include debian/rules.vars =20 srctree ?=3D . =20 +export DEB_RULES_REQUIRES_ROOT :=3D no + ifneq (,$(filter-out parallel=3D1,$(filter parallel=3D%,$(DEB_BUILD_OPTION= S)))) NUMJOBS =3D $(patsubst parallel=3D%,%,$(filter parallel=3D%,$(DEB_BUIL= D_OPTIONS))) MAKEFLAGS +=3D -j$(NUMJOBS) --=20 2.40.1