Re: [PATCH v6 12/12] kbuild: add srcdeb-pkg target

From: Masahiro Yamada
Date: Sat Feb 25 2023 - 05:17:22 EST


On Sat, Feb 25, 2023 at 7:48 AM Nicolas Schier <nicolas@xxxxxxxxx> wrote:
>
> On Wed, Feb 15, 2023 at 10:20:34AM +0900 Masahiro Yamada wrote:
> > This new target builds only the debian source package.
> >
> > Factor similar code out to the 'build-deb-pkg' variable.
> >
> > Signed-off-by: Masahiro Yamada <masahiroy@xxxxxxxxxx>
> > ---
> >
> > Changes in v6:
> > - New patch
> >
> > scripts/Makefile.package | 23 ++++++++++++++++++++---
> > 1 file changed, 20 insertions(+), 3 deletions(-)
> >
> > diff --git a/scripts/Makefile.package b/scripts/Makefile.package
> > index b941e6341b36..8650d9432c26 100644
> > --- a/scripts/Makefile.package
> > +++ b/scripts/Makefile.package
> > @@ -100,6 +100,9 @@ binrpm-pkg:
> > +rpmbuild $(RPMOPTS) --define "_builddir $(objtree)" --target \
> > $(UTS_MACHINE)-linux -bb $(objtree)/binkernel.spec
> >
> > +# deb-pkg srcdeb-pkg bindeb-pkg
> > +# ---------------------------------------------------------------------------
> > +
> > quiet_cmd_debianize = GEN $@
> > cmd_debianize = $(srctree)/scripts/package/mkdebian
> >
> > @@ -117,14 +120,27 @@ debian-orig: linux.tar.gz debian
> > cp $< ../$(orig-name); \
> > fi
> >
> > +build-deb-pkg = \
> > + dpkg-buildpackage \
> > + --build=$(build-type) --no-pre-clean --unsigned-changes \
> > + $(if $(findstring source, $(build-type)), --unsigned-source) \
> > + $(if $(findstring binary, $(build-type)), -r$(KBUILD_PKG_ROOTCMD) -a$$(cat debian/arch)) \
> > + $(DPKG_FLAGS)
> > +
> > PHONY += deb-pkg
> > +deb-pkg: private build-type := source,binary
> > deb-pkg: debian-orig
> > - +dpkg-buildpackage -r$(KBUILD_PKG_ROOTCMD) -a$$(cat debian/arch) $(DPKG_FLAGS) \
> > - --build=source,binary -nc -us -uc
> > + +$(build-deb-pkg)
> > +
> > +PHONY += srcdeb-pkg
> > +srcdeb-pkg: private build-type := source
> > +srcdeb-pkg: debian-orig
> > + +$(build-deb-pkg)
> >
> > PHONY += bindeb-pkg
> > +bindeb-pkg: private build-type := binary
> > bindeb-pkg: debian
> > - +dpkg-buildpackage -r$(KBUILD_PKG_ROOTCMD) -a$$(cat debian/arch) $(DPKG_FLAGS) -b -nc -uc
> > + +$(build-deb-pkg)
> >
> > PHONY += intdeb-pkg
> > intdeb-pkg:
> > @@ -225,6 +241,7 @@ help:
> > @echo ' srcrpm-pkg - Build only the source kernel RPM package'
> > @echo ' binrpm-pkg - Build only the binary kernel RPM package'
> > @echo ' deb-pkg - Build both source and binary deb kernel packages'
> > + @echo ' binsrc-pkg - Build only the source kernel deb package'
>
> typo: srcdeb-dpkg

I will fix. Thanks.


>
> With this typo fixed:
> Reviewed-by: Nicolas Schier <nicolas@xxxxxxxxx>
>
> > @echo ' bindeb-pkg - Build only the binary kernel deb package'
> > @echo ' snap-pkg - Build only the binary kernel snap package'
> > @echo ' (will connect to external hosts)'
> > --
> > 2.34.1
>
> Thanks for the patch (and the whole patch set), I appreciate it!
>
> While testing, I stumbled over one thing, not really related to this patch:
>
> As tar complains about any kind of tree changes while it creates an archive,
> 'olddefconfig' and 'srcdeb-pkg' must not be build at the same time. Is it
> sensible to add another 'mixed-build' check in top-level Makefile against all
> target depending on linux.tar.gz?
>
> $ make olddefconfig srcdeb-pkg -j8

This is already done.

The mixture of config targets and non-config targets
are treated as mixed-build. [1]
So, Kbuild internally divides it into 'make olddefconfig -j8'
followed by 'make srcdeb-pkg -j8'.


[1] https://github.com/torvalds/linux/blob/v6.2/Makefile#L335





> #
> # No change to .config
> #
> GEN debian
> UPD .tmp_filelist
> TAR linux.tar.gz
> tar: .: file changed as we read it
> make[2]: *** [scripts/Makefile.package:58: linux.tar.gz] Error 1
> make[2]: *** Deleting file 'linux.tar.gz'
> make[1]: *** [Makefile:1654: srcdeb-pkg] Error 2
> make: *** [Makefile:358: __build_one_by_one] Error 2


I ran the same command, but I could not reproduce this.





>
> Kind regards,
> Nicolas



--
Best Regards
Masahiro Yamada