Skip to content

Commit 5e73758

Browse files
committed
kbuild: deb-pkg: use more debhelper commands in builddeb
Commit 36862e1 ("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 <[email protected]> Reviewed-by: Nicolas Schier <[email protected]>
1 parent 68e262f commit 5e73758

File tree

3 files changed

+14
-18
lines changed

3 files changed

+14
-18
lines changed

scripts/package/builddeb

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,16 @@ if_enabled_echo() {
2626

2727
create_package() {
2828
local pname="$1" pdir="$2"
29-
local dpkg_deb_opts
30-
31-
mkdir -m 755 -p "$pdir/DEBIAN"
32-
mkdir -p "$pdir/usr/share/doc/$pname"
33-
cp debian/copyright "$pdir/usr/share/doc/$pname/"
34-
cp debian/changelog "$pdir/usr/share/doc/$pname/changelog.Debian"
35-
gzip -n -9 "$pdir/usr/share/doc/$pname/changelog.Debian"
36-
sh -c "cd '$pdir'; find . -type f ! -path './DEBIAN/*' -printf '%P\0' \
37-
| xargs -r0 md5sum > DEBIAN/md5sums"
38-
39-
# a+rX in case we are in a restrictive umask environment like 0077
40-
# ug-s in case we build in a setuid/setgid directory
41-
chmod -R go-w,a+rX,ug-s "$pdir"
42-
43-
# Create the package
44-
dpkg-gencontrol -p$pname -P"$pdir"
45-
dpkg-deb --root-owner-group ${KDEB_COMPRESS:+-Z$KDEB_COMPRESS} --build "$pdir" ..
29+
30+
export DH_OPTIONS="-p${pname} -P${pdir}"
31+
32+
dh_installdocs
33+
dh_installchangelogs
34+
dh_compress
35+
dh_fixperms
36+
dh_gencontrol
37+
dh_md5sums
38+
dh_builddeb -- ${KDEB_COMPRESS:+-Z$KDEB_COMPRESS}
4639
}
4740

4841
install_linux_image () {

scripts/package/debian/rules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#!/usr/bin/make -f
22
# SPDX-License-Identifier: GPL-2.0-only
33

4+
# in case debian/rules is executed directly
5+
export DEB_RULES_REQUIRES_ROOT := no
6+
47
include debian/rules.vars
58

69
ifneq (,$(filter-out parallel=1,$(filter parallel=%,$(DEB_BUILD_OPTIONS))))

scripts/package/mkdebian

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ Section: kernel
193193
Priority: optional
194194
Maintainer: $maintainer
195195
Rules-Requires-Root: no
196-
Build-Depends: debhelper
196+
Build-Depends: debhelper-compat (= 12)
197197
Build-Depends-Arch: bc, bison, cpio, flex, kmod, libelf-dev:native, libssl-dev:native, rsync
198198
Homepage: https://www.kernel.org/
199199

0 commit comments

Comments
 (0)