2023-04-17 14:29:56

by Masahiro Yamada

[permalink] [raw]
Subject: [PATCH 2/2] kbuild: deb-pkg: add KDEB_SOURCE_COMPRESS to specify compression type

Add KDEB_SOURCE_COMPRESS to specify the compression for the orig and
debian tarballs. (The existing KDEB_COMPRESS is used to specify the
compression for binary packages.)

Supported algorithms are gzip, bzip2, lzma, and xz, all of which are
supported by dpkg-source.

Signed-off-by: Masahiro Yamada <[email protected]>
---

scripts/Makefile.package | 31 +++++++++++++++++++++++--------
1 file changed, 23 insertions(+), 8 deletions(-)

diff --git a/scripts/Makefile.package b/scripts/Makefile.package
index d8a36304b26e..ce3d8b4e9cb0 100644
--- a/scripts/Makefile.package
+++ b/scripts/Makefile.package
@@ -41,19 +41,25 @@ check-git:
false; \
fi

-git-config-tar.gz = -c tar.tar.gz.command="$(KGZIP)"
-git-config-tar.bz2 = -c tar.tar.bz2.command="$(KBZIP2)"
-git-config-tar.xz = -c tar.tar.xz.command="$(XZ)"
-git-config-tar.zst = -c tar.tar.zst.command="$(ZSTD)"
+git-config-tar.gz = -c tar.tar.gz.command="$(KGZIP)"
+git-config-tar.bz2 = -c tar.tar.bz2.command="$(KBZIP2)"
+git-config-tar.lzma = -c tar.tar.lzma.command="$(LZMA)"
+git-config-tar.xz = -c tar.tar.xz.command="$(XZ)"
+git-config-tar.zst = -c tar.tar.zst.command="$(ZSTD)"

quiet_cmd_archive = ARCHIVE $@
cmd_archive = git -C $(srctree) $(git-config-tar$(suffix $@)) archive \
--output=$$(realpath $@) --prefix=$(basename $@)/ $(archive-args)

+suffix-gzip := .gz
+suffix-bzip2 := .bz2
+suffix-lzma := .lzma
+suffix-xz := .xz
+
# Linux source tarball
# ---------------------------------------------------------------------------

-linux-tarballs := $(addprefix linux, .tar.gz)
+linux-tarballs := $(addprefix linux, .tar.gz .tar.bz2 .tar.lzma .tar.xz)

targets += $(linux-tarballs)
$(linux-tarballs): archive-args = $$(cat $<)
@@ -88,6 +94,15 @@ binrpm-pkg:
# deb-pkg srcdeb-pkg bindeb-pkg
# ---------------------------------------------------------------------------

+KDEB_SOURCE_COMPRESS ?= gzip
+
+PHONY += linux.tar.unsupported_deb_compress
+linux.tar.unsupported_deb_compress:
+ @echo "error: $(KDEB_SOURCE_COMPRESS): unsupported debian source compression" >&2
+ @false
+
+debian-orig-suffix := $(if $(filter gzip bzip2 lzma xz, $(KDEB_SOURCE_COMPRESS)),$(suffix-$(KDEB_SOURCE_COMPRESS)),.unsupported_deb_compress)
+
quiet_cmd_debianize = GEN $@
cmd_debianize = $(srctree)/scripts/package/mkdebian $(mkdebian-opts)

@@ -97,9 +112,9 @@ debian: FORCE
PHONY += debian-orig
debian-orig: private source = $(shell dpkg-parsechangelog -S Source)
debian-orig: private version = $(shell dpkg-parsechangelog -S Version | sed 's/-[^-]*$$//')
-debian-orig: private orig-name = $(source)_$(version).orig.tar.gz
+debian-orig: private orig-name = $(source)_$(version).orig.tar$(debian-orig-suffix)
debian-orig: mkdebian-opts = --need-source
-debian-orig: linux.tar.gz debian
+debian-orig: linux.tar$(debian-orig-suffix) debian
$(Q)if [ "$(df --output=target .. 2>/dev/null)" = "$(df --output=target $< 2>/dev/null)" ]; then \
ln -f $< ../$(orig-name); \
else \
@@ -120,7 +135,7 @@ deb-pkg srcdeb-pkg bindeb-pkg:
+$(strip dpkg-buildpackage \
--build=$(build-type) --no-pre-clean --unsigned-changes \
$(if $(findstring source, $(build-type)), \
- --unsigned-source) \
+ --unsigned-source --compression=$(KDEB_SOURCE_COMPRESS)) \
$(if $(findstring binary, $(build-type)), \
-r$(KBUILD_PKG_ROOTCMD) -a$$(cat debian/arch), \
--no-check-builddeps) \
--
2.37.2


2023-04-19 20:43:00

by Nicolas Schier

[permalink] [raw]
Subject: Re: [PATCH 2/2] kbuild: deb-pkg: add KDEB_SOURCE_COMPRESS to specify compression type

On Mon 17 Apr 2023 23:25:48 GMT, Masahiro Yamada wrote:
> Add KDEB_SOURCE_COMPRESS to specify the compression for the orig and
> debian tarballs. (The existing KDEB_COMPRESS is used to specify the
> compression for binary packages.)

Sounds to me, that it would make sense to sum-up some documentation for
kbuild Debian package configuration.

> Supported algorithms are gzip, bzip2, lzma, and xz, all of which are
> supported by dpkg-source.
>
> Signed-off-by: Masahiro Yamada <[email protected]>
> ---
>
> scripts/Makefile.package | 31 +++++++++++++++++++++++--------
> 1 file changed, 23 insertions(+), 8 deletions(-)
>
> diff --git a/scripts/Makefile.package b/scripts/Makefile.package
> index d8a36304b26e..ce3d8b4e9cb0 100644
> --- a/scripts/Makefile.package
> +++ b/scripts/Makefile.package
> @@ -41,19 +41,25 @@ check-git:
> false; \
> fi
>
> -git-config-tar.gz = -c tar.tar.gz.command="$(KGZIP)"
> -git-config-tar.bz2 = -c tar.tar.bz2.command="$(KBZIP2)"
> -git-config-tar.xz = -c tar.tar.xz.command="$(XZ)"
> -git-config-tar.zst = -c tar.tar.zst.command="$(ZSTD)"
> +git-config-tar.gz = -c tar.tar.gz.command="$(KGZIP)"
> +git-config-tar.bz2 = -c tar.tar.bz2.command="$(KBZIP2)"
> +git-config-tar.lzma = -c tar.tar.lzma.command="$(LZMA)"
> +git-config-tar.xz = -c tar.tar.xz.command="$(XZ)"
> +git-config-tar.zst = -c tar.tar.zst.command="$(ZSTD)"
>
> quiet_cmd_archive = ARCHIVE $@
> cmd_archive = git -C $(srctree) $(git-config-tar$(suffix $@)) archive \
> --output=$$(realpath $@) --prefix=$(basename $@)/ $(archive-args)
>
> +suffix-gzip := .gz
> +suffix-bzip2 := .bz2
> +suffix-lzma := .lzma
> +suffix-xz := .xz
> +
> # Linux source tarball
> # ---------------------------------------------------------------------------
>
> -linux-tarballs := $(addprefix linux, .tar.gz)
> +linux-tarballs := $(addprefix linux, .tar.gz .tar.bz2 .tar.lzma .tar.xz)
>
> targets += $(linux-tarballs)
> $(linux-tarballs): archive-args = $$(cat $<)
> @@ -88,6 +94,15 @@ binrpm-pkg:
> # deb-pkg srcdeb-pkg bindeb-pkg
> # ---------------------------------------------------------------------------
>
> +KDEB_SOURCE_COMPRESS ?= gzip

According to dpkg-source(1), xz is the default compression for deb
source format >= 2. Shouldn't we use xz here by default as well?

Reviewed-by: Nicolas Schier <[email protected]>

Thanks and kind regards,
Nicolas


> +
> +PHONY += linux.tar.unsupported_deb_compress
> +linux.tar.unsupported_deb_compress:
> + @echo "error: $(KDEB_SOURCE_COMPRESS): unsupported debian source compression" >&2
> + @false
> +
> +debian-orig-suffix := $(if $(filter gzip bzip2 lzma xz, $(KDEB_SOURCE_COMPRESS)),$(suffix-$(KDEB_SOURCE_COMPRESS)),.unsupported_deb_compress)
> +
> quiet_cmd_debianize = GEN $@
> cmd_debianize = $(srctree)/scripts/package/mkdebian $(mkdebian-opts)
>
> @@ -97,9 +112,9 @@ debian: FORCE
> PHONY += debian-orig
> debian-orig: private source = $(shell dpkg-parsechangelog -S Source)
> debian-orig: private version = $(shell dpkg-parsechangelog -S Version | sed 's/-[^-]*$$//')
> -debian-orig: private orig-name = $(source)_$(version).orig.tar.gz
> +debian-orig: private orig-name = $(source)_$(version).orig.tar$(debian-orig-suffix)
> debian-orig: mkdebian-opts = --need-source
> -debian-orig: linux.tar.gz debian
> +debian-orig: linux.tar$(debian-orig-suffix) debian
> $(Q)if [ "$(df --output=target .. 2>/dev/null)" = "$(df --output=target $< 2>/dev/null)" ]; then \
> ln -f $< ../$(orig-name); \
> else \
> @@ -120,7 +135,7 @@ deb-pkg srcdeb-pkg bindeb-pkg:
> +$(strip dpkg-buildpackage \
> --build=$(build-type) --no-pre-clean --unsigned-changes \
> $(if $(findstring source, $(build-type)), \
> - --unsigned-source) \
> + --unsigned-source --compression=$(KDEB_SOURCE_COMPRESS)) \
> $(if $(findstring binary, $(build-type)), \
> -r$(KBUILD_PKG_ROOTCMD) -a$$(cat debian/arch), \
> --no-check-builddeps) \
> --
> 2.37.2


Attachments:
(No filename) (3.98 kB)
signature.asc (849.00 B)
Download all attachments

2023-04-20 07:26:15

by Masahiro Yamada

[permalink] [raw]
Subject: Re: [PATCH 2/2] kbuild: deb-pkg: add KDEB_SOURCE_COMPRESS to specify compression type

On Thu, Apr 20, 2023 at 5:34 AM Nicolas Schier <[email protected]> wrote:
>
> On Mon 17 Apr 2023 23:25:48 GMT, Masahiro Yamada wrote:
> > Add KDEB_SOURCE_COMPRESS to specify the compression for the orig and
> > debian tarballs. (The existing KDEB_COMPRESS is used to specify the
> > compression for binary packages.)
>
> Sounds to me, that it would make sense to sum-up some documentation for
> kbuild Debian package configuration.
>
> > Supported algorithms are gzip, bzip2, lzma, and xz, all of which are
> > supported by dpkg-source.
> >
> > Signed-off-by: Masahiro Yamada <[email protected]>
> > ---
> >
> > scripts/Makefile.package | 31 +++++++++++++++++++++++--------
> > 1 file changed, 23 insertions(+), 8 deletions(-)
> >
> > diff --git a/scripts/Makefile.package b/scripts/Makefile.package
> > index d8a36304b26e..ce3d8b4e9cb0 100644
> > --- a/scripts/Makefile.package
> > +++ b/scripts/Makefile.package
> > @@ -41,19 +41,25 @@ check-git:
> > false; \
> > fi
> >
> > -git-config-tar.gz = -c tar.tar.gz.command="$(KGZIP)"
> > -git-config-tar.bz2 = -c tar.tar.bz2.command="$(KBZIP2)"
> > -git-config-tar.xz = -c tar.tar.xz.command="$(XZ)"
> > -git-config-tar.zst = -c tar.tar.zst.command="$(ZSTD)"
> > +git-config-tar.gz = -c tar.tar.gz.command="$(KGZIP)"
> > +git-config-tar.bz2 = -c tar.tar.bz2.command="$(KBZIP2)"
> > +git-config-tar.lzma = -c tar.tar.lzma.command="$(LZMA)"
> > +git-config-tar.xz = -c tar.tar.xz.command="$(XZ)"
> > +git-config-tar.zst = -c tar.tar.zst.command="$(ZSTD)"
> >
> > quiet_cmd_archive = ARCHIVE $@
> > cmd_archive = git -C $(srctree) $(git-config-tar$(suffix $@)) archive \
> > --output=$$(realpath $@) --prefix=$(basename $@)/ $(archive-args)
> >
> > +suffix-gzip := .gz
> > +suffix-bzip2 := .bz2
> > +suffix-lzma := .lzma
> > +suffix-xz := .xz
> > +
> > # Linux source tarball
> > # ---------------------------------------------------------------------------
> >
> > -linux-tarballs := $(addprefix linux, .tar.gz)
> > +linux-tarballs := $(addprefix linux, .tar.gz .tar.bz2 .tar.lzma .tar.xz)
> >
> > targets += $(linux-tarballs)
> > $(linux-tarballs): archive-args = $$(cat $<)
> > @@ -88,6 +94,15 @@ binrpm-pkg:
> > # deb-pkg srcdeb-pkg bindeb-pkg
> > # ---------------------------------------------------------------------------
> >
> > +KDEB_SOURCE_COMPRESS ?= gzip
>
> According to dpkg-source(1), xz is the default compression for deb
> source format >= 2. Shouldn't we use xz here by default as well?


Yes.
xz is the default because we switched to format 3.0 (quilt).

But, we used gzip for a long time, so I did not change it
in this commit.


I do not have a strong opinion.

Ben (debian kernel maintainer) is in the CC list,
perhaps he has some preference.






--
Best Regards
Masahiro Yamada

2023-04-22 11:14:35

by Ben Hutchings

[permalink] [raw]
Subject: Re: [PATCH 2/2] kbuild: deb-pkg: add KDEB_SOURCE_COMPRESS to specify compression type

On Thu, 2023-04-20 at 16:17 +0900, Masahiro Yamada wrote:
> On Thu, Apr 20, 2023 at 5:34 AM Nicolas Schier <[email protected]> wrote:
[...]
> > > +KDEB_SOURCE_COMPRESS ?= gzip
> >
> > According to dpkg-source(1), xz is the default compression for deb
> > source format >= 2. Shouldn't we use xz here by default as well?
>
>
> Yes.
> xz is the default because we switched to format 3.0 (quilt).
>
> But, we used gzip for a long time, so I did not change it
> in this commit.
>
>
> I do not have a strong opinion.
>
> Ben (debian kernel maintainer) is in the CC list,
> perhaps he has some preference.

I think it makes sense to keep source compression unchanged in this
commit, but you could add another commit to change the default.

Ben.

--
Ben Hutchings
Theory and practice are closer in theory than in practice - John Levine


Attachments:
signature.asc (849.00 B)
This is a digitally signed message part