Re: [PATCH 3/3] kbuild: do not create intermediate *.tar for tar packages

From: Nathan Chancellor
Date: Fri Apr 07 2023 - 14:12:31 EST


On Fri, Apr 07, 2023 at 07:16:29PM +0900, Masahiro Yamada wrote:
> Commit 05e96e96a315 ("kbuild: use git-archive for source package
> creation") split the compression as a separate step to factor out
> the common build rules.
>
> With the previous commit, we got back to the situation where
> compressed source tarballs are created by a single rule.
> There is no reason to keep the separate compression rules.
>
> Generate the comressed tar packages directly.
>
> Signed-off-by: Masahiro Yamada <masahiroy@xxxxxxxxxx>

Reviewed-by: Nathan Chancellor <nathan@xxxxxxxxxx>

> ---
>
> scripts/Makefile.package | 27 +++++++++------------------
> 1 file changed, 9 insertions(+), 18 deletions(-)
>
> diff --git a/scripts/Makefile.package b/scripts/Makefile.package
> index 7707975f729b..e0e18d7dfbd5 100644
> --- a/scripts/Makefile.package
> +++ b/scripts/Makefile.package
> @@ -2,7 +2,6 @@
> # Makefile for the different targets used to generate full packages of a kernel
>
> include $(srctree)/scripts/Kbuild.include
> -include $(srctree)/scripts/Makefile.lib
>
> KERNELPATH := kernel-$(subst -,_,$(KERNELRELEASE))
> KBUILD_PKG_ROOTCMD ?="fakeroot -u"
> @@ -27,21 +26,6 @@ fi ; \
> tar -I $(KGZIP) -c $(RCS_TAR_IGNORE) -f $(2).tar.gz \
> --transform 's:^:$(2)/:S' $(TAR_CONTENT) $(3)
>
> -# tarball compression
> -# ---------------------------------------------------------------------------
> -
> -%.tar.gz: %.tar
> - $(call cmd,gzip)
> -
> -%.tar.bz2: %.tar
> - $(call cmd,bzip2)
> -
> -%.tar.xz: %.tar
> - $(call cmd,xzmisc)
> -
> -%.tar.zst: %.tar
> - $(call cmd,zstd)
> -
> # Git
> # ---------------------------------------------------------------------------
>
> @@ -153,10 +137,17 @@ tar-install: FORCE
> $(Q)$(MAKE) -f $(srctree)/Makefile
> +$(Q)$(srctree)/scripts/package/buildtar $@
>
> +compress-tar.gz = -I "$(KGZIP)"
> +compress-tar.bz2 = -I "$(KBZIP2)"
> +compress-tar.xz = -I "$(XZ)"
> +compress-tar.zst = -I "$(ZSTD)"
> +
> quiet_cmd_tar = TAR $@
> - cmd_tar = cd $<; tar cf ../$@ --owner=root --group=root --sort=name *
> + cmd_tar = cd $<; tar cf ../$@ $(compress-tar$(suffix $@)) --owner=root --group=root --sort=name *
> +
> +dir-tarballs := $(addprefix linux-$(KERNELRELEASE)-$(ARCH), .tar .tar.gz .tar.bz2 .tar.xz .tar.zst)
>
> -linux-$(KERNELRELEASE)-$(ARCH).tar: tar-install
> +$(dir-tarballs): tar-install
> $(call cmd,tar)
>
> PHONY += dir-pkg
> --
> 2.37.2
>