Re: [PATCH v2] scripts/package/builddeb: split generating packaging and build
Hi Riku,
2017-09-23 18:39 GMT+09:00 Riku Voipio <riku.voipio@linaro.org>:
> Move debian/ directory generation out of builddeb to a new script,
> mkdebian. The package build commands are kept in builddeb, which
> is now and internal command called from debian/rules.
>
> With these changes in place, we can now use dpkg-buildpackage from
> deb-pkg and bindeb-pkg removing need for handrolled source/changes
> generation.
>
> This patch is based on the criticism of the current state of builddeb
> discussed on:
>
> https://patchwork.kernel.org/patch/9656403/
>
> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
Sorry for delay.
When I was testing this patch, I was hit by a problem
when building the package with a parallel option.
Did you see the problem as below?
Please try this:
make defconfig
make -j8 bindeb-pkg
This stalled on my build machine due to too many jobs.
As far as I tested,
the build command in debian/rules
is invoked with -j without any argument.
"man make" says
If the -j option is given without an argument, make will not limit
the number of jobs that can run simultaneously.
>
> bindeb-pkg: FORCE
> - $(MAKE) KBUILD_SRC=
> - +$(call cmd,builddeb)
> + $(CONFIG_SHELL) $(srctree)/scripts/package/mkdebian
> + dpkg-buildpackage -r$(KBUILD_PKG_ROOTCMD) -a$$(cat debian/arch) -b -nc -us -uc
I think -us option is not necessary for bindeb-pkg.
> -}
> +# Set up variables in case we not called from kernel toplevel Makefile
> +objtree="${objtree:-.}"
> +srctree="${srctree:-.}"
> +MAKE="${MAKE:-make}"
> +OBJCOPY="${OBJCOPY:-objcopy}"
> +KCONFIG_CONFIG="${KCONFIG_CONFIG:-.config}"
Hmm, I do not like these.
Now I understood your intention.
I prefer "make intdeb-pkg" in v1.
Sorry, my suggesting was misleading.
> +cat <<EOF > debian/rules
> +#!/usr/bin/make -f
> +
> +ifneq (,\$(filter parallel=%,\$(DEB_BUILD_OPTIONS)))
> + NUMJOBS = \$(patsubst parallel=%,%,\$(filter parallel=%,\$(DEB_BUILD_OPTIONS)))
> + MAKEFLAGS += -j\$(NUMJOBS)
> +endif
> +
> +build:
> + \$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} KBUILD_SRC=
The problem is here.
If I invoked "make -j<N> bindeb-pkg",
I see -j in MAKEFLAGS. (<N> is missing)
I am not sure if this is a bug of dpkg-buildpackage or not.
I found a workaround for this.
In scripts/package/mkdebian:
NUMJOBS := \$(patsubst parallel=%,%,\$(filter parallel=%,\$(DEB_BUILD_OPTIONS)))
build:
\$(MAKE) \$(if \$(NUMJOBS),-j\$(NUMJOBS))
KERNELRELEASE=${version} ARCH=${ARCH} KBUILD_SRC=
In scripts/package/Makefile:
bindeb-pkg: FORCE
$(CONFIG_SHELL) $(srctree)/scripts/package/mkdebian
dpkg-buildpackage $(filter -j%,$(MAKEFLAGS)) \
-r$(KBUILD_PKG_ROOTCMD) -a$$(cat debian/arch) -b -nc -us -uc
This worked for me.
If you have a better solution, please override it.
--
Best Regards
Masahiro Yamada
Reply to: