public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nicolas Schier <n.schier@avm.de>
To: Masahiro Yamada <masahiroy@kernel.org>
Cc: linux-kbuild@vger.kernel.org, Ben Hutchings <ben@decadent.org.uk>,
	Nathan Chancellor <nathan@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Nicolas Schier <nicolas@fjasle.eu>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] kbuild: deb-pkg: use more debhelper commands
Date: Fri, 22 Dec 2023 15:27:37 +0100	[thread overview]
Message-ID: <ZYWc2dBxEIx5N0JE@buildd.core.avm.de> (raw)
In-Reply-To: <20231219181957.1449958-3-masahiroy@kernel.org>

On Wed, Dec 20, 2023 at 03:19:57AM +0900, Masahiro Yamada wrote:
> 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 <masahiroy@kernel.org>
> ---
> 
>  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}
>  }

That looks much cleaner, thanks!

Reviewed-by: Nicolas Schier <n.schier@avm.de>

  reply	other threads:[~2023-12-22 14:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-19 18:19 [PATCH 1/3] kbuild: deb-pkg: do not query DEB_HOST_MULTIARCH Masahiro Yamada
2023-12-19 18:19 ` [PATCH 2/3] kbuild: deb-pkg: hard-code Build-Depends Masahiro Yamada
2023-12-22 14:26   ` Nicolas Schier
2023-12-19 18:19 ` [PATCH 3/3] kbuild: deb-pkg: use more debhelper commands Masahiro Yamada
2023-12-22 14:27   ` Nicolas Schier [this message]
2023-12-22 14:30 ` [PATCH 1/3] kbuild: deb-pkg: do not query DEB_HOST_MULTIARCH Nicolas Schier
2023-12-26  5:34   ` Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZYWc2dBxEIx5N0JE@buildd.core.avm.de \
    --to=n.schier@avm.de \
    --cc=ben@decadent.org.uk \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=nicolas@fjasle.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox