]> git.itanic.dy.fi Git - linux-stable/commitdiff
kbuild: deb-pkg: use more debhelper commands in builddeb
authorMasahiro Yamada <masahiroy@kernel.org>
Tue, 26 Dec 2023 13:52:43 +0000 (22:52 +0900)
committerMasahiro Yamada <masahiroy@kernel.org>
Fri, 5 Jan 2024 10:35:38 +0000 (19:35 +0900)
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 <masahiroy@kernel.org>
Reviewed-by: Nicolas Schier <n.schier@avm.de>
scripts/package/builddeb
scripts/package/debian/rules
scripts/package/mkdebian

index 2eb4910f0ef3425eed6af208b297c572b526713d..436d55a83ab070cd888ad20092c386319aac7be7 100755 (executable)
@@ -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"
-
-       # 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" ..
+
+       export DH_OPTIONS="-p${pname} -P${pdir}"
+
+       dh_installdocs
+       dh_installchangelogs
+       dh_compress
+       dh_fixperms
+       dh_gencontrol
+       dh_md5sums
+       dh_builddeb -- ${KDEB_COMPRESS:+-Z$KDEB_COMPRESS}
 }
 
 install_linux_image () {
index 0ffa806bbd7896db99056856822cbcc7e84cf112..7ab31419579f0480635f601bb560b58f72a4590f 100755 (executable)
@@ -1,6 +1,9 @@
 #!/usr/bin/make -f
 # SPDX-License-Identifier: GPL-2.0-only
 
+# in case debian/rules is executed directly
+export DEB_RULES_REQUIRES_ROOT := no
+
 include debian/rules.vars
 
 ifneq (,$(filter-out parallel=1,$(filter parallel=%,$(DEB_BUILD_OPTIONS))))
index 93a24712b9a1de98b940d8cbb443c736d6d0981e..070149c985fea4e33126650fad3e7769605c216a 100755 (executable)
@@ -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/