linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/1] kbuild: deb-pkg: Build parallely with current dpkg-buildpackage
@ 2023-03-15 16:29 Bastian Germann
  2023-03-15 16:29 ` [PATCH v2 1/1] " Bastian Germann
  0 siblings, 1 reply; 4+ messages in thread
From: Bastian Germann @ 2023-03-15 16:29 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Bastian Germann, Nathan Chancellor, Nick Desaulniers,
	linux-kbuild, linux-kernel

Make use of DEB_BUILD_OPTIONS' parallel option because that is the only
parallel build option that is set by default in current dpkg-buildpackage
versions.

v2:
 * Clarify that this is for current dpkg-buildpackage versions
 * Evaluate DEB_BUILD_OPTIONS in debian/rules.

Bastian Germann (1):
  kbuild: deb-pkg: Build parallely with current dpkg-buildpackage

 scripts/package/mkdebian | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

-- 
2.39.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 1/1] kbuild: deb-pkg: Build parallely with current dpkg-buildpackage
  2023-03-15 16:29 [PATCH v2 0/1] kbuild: deb-pkg: Build parallely with current dpkg-buildpackage Bastian Germann
@ 2023-03-15 16:29 ` Bastian Germann
  2023-03-15 16:51   ` Masahiro Yamada
  2023-03-15 16:52   ` Sedat Dilek
  0 siblings, 2 replies; 4+ messages in thread
From: Bastian Germann @ 2023-03-15 16:29 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Bastian Germann, Nathan Chancellor, Nick Desaulniers,
	linux-kbuild, linux-kernel

With dpkg-buildpackage v1.21.10 or later, the only way to build the
deb-pkg generated package parallely is adding -j<N> to the MAKEFLAGS
environment variable or using the --jobs-force option. The package ignores
the usual parallel build option that is described in Debian Policy §4.9.1.

Derive make's -j parameter from the DEB_BUILD_OPTIONS environment variable
that ends up being set by dpkg-buildpackage -j<N>.

Link: https://www.debian.org/doc/debian-policy/ch-source.html
Signed-off-by: Bastian Germann <bage@linutronix.de>
---
 scripts/package/mkdebian | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
index f74380036bb5..0217790e7a26 100755
--- a/scripts/package/mkdebian
+++ b/scripts/package/mkdebian
@@ -238,11 +238,15 @@ fi
 cat <<EOF > debian/rules
 #!$(command -v $MAKE) -f
 
+ifneq (,\$(filter parallel=%,\$(DEB_BUILD_OPTIONS)))
+	JOBS = -j\$(subst parallel=,,\$(filter parallel=%,\$(DEB_BUILD_OPTIONS)))
+endif
+
 srctree ?= .
 
 build-indep:
 build-arch:
-	\$(MAKE) -f \$(srctree)/Makefile ARCH=${ARCH} \
+	\$(MAKE) -f \$(srctree)/Makefile ARCH=${ARCH} \$(JOBS) \
 	\$(shell \$(srctree)/scripts/package/deb-build-option) \
 	olddefconfig all
 
@@ -250,10 +254,10 @@ build: build-arch
 
 binary-indep:
 binary-arch: build-arch
-	\$(MAKE) -f \$(srctree)/Makefile ARCH=${ARCH} intdeb-pkg
+	\$(MAKE) -f \$(srctree)/Makefile ARCH=${ARCH} \$(JOBS) intdeb-pkg
 clean:
 	rm -rf debian/files debian/linux-*
-	\$(MAKE) -f \$(srctree)/Makefile ARCH=${ARCH} clean
+	\$(MAKE) -f \$(srctree)/Makefile ARCH=${ARCH} \$(JOBS) clean
 
 binary: binary-arch
 EOF
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/1] kbuild: deb-pkg: Build parallely with current dpkg-buildpackage
  2023-03-15 16:29 ` [PATCH v2 1/1] " Bastian Germann
@ 2023-03-15 16:51   ` Masahiro Yamada
  2023-03-15 16:52   ` Sedat Dilek
  1 sibling, 0 replies; 4+ messages in thread
From: Masahiro Yamada @ 2023-03-15 16:51 UTC (permalink / raw)
  To: Bastian Germann
  Cc: Nathan Chancellor, Nick Desaulniers, linux-kbuild, linux-kernel

On Thu, Mar 16, 2023 at 1:29 AM Bastian Germann <bage@linutronix.de> wrote:
>
> With dpkg-buildpackage v1.21.10 or later, the only way to build the


Please include the commit hash.

I guess

Commit 1d0ea9b2ba3f ("dpkg-buildpackage: Change -j, --jobs semantics
to non-force mode")

is the one.


> deb-pkg generated package parallely is adding -j<N> to the MAKEFLAGS
> environment variable or using the --jobs-force option. The package ignores
> the usual parallel build option that is described in Debian Policy §4.9.1.

If a new section is inserted before, the section number '4.9.1'
may not be true in the future.

I think you can drop the section number
if you add the Link: tag close to the relevant section.


>
> Derive make's -j parameter from the DEB_BUILD_OPTIONS environment variable
> that ends up being set by dpkg-buildpackage -j<N>.
>
> Link: https://www.debian.org/doc/debian-policy/ch-source.html



Link: https://www.debian.org/doc/debian-policy/ch-source.html#debian-rules-and-deb-build-options

  might be better - it points to the relevant section.





>
>  build-indep:
>  build-arch:
> -       \$(MAKE) -f \$(srctree)/Makefile ARCH=${ARCH} \
> +       \$(MAKE) -f \$(srctree)/Makefile ARCH=${ARCH} \$(JOBS) \
>         \$(shell \$(srctree)/scripts/package/deb-build-option) \
>         olddefconfig all
>
> @@ -250,10 +254,10 @@ build: build-arch
>
>  binary-indep:
>  binary-arch: build-arch
> -       \$(MAKE) -f \$(srctree)/Makefile ARCH=${ARCH} intdeb-pkg
> +       \$(MAKE) -f \$(srctree)/Makefile ARCH=${ARCH} \$(JOBS) intdeb-pkg
>  clean:
>         rm -rf debian/files debian/linux-*
> -       \$(MAKE) -f \$(srctree)/Makefile ARCH=${ARCH} clean
> +       \$(MAKE) -f \$(srctree)/Makefile ARCH=${ARCH} \$(JOBS) clean
>
>  binary: binary-arch
>  EOF
> --
> 2.39.2
>

I prefer appending it to MAKEFLAGS instead of touching every target.
(or is there any reason why MAKEFLAGS does not work here?)

The reference code exists in the link you mentioned.

ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
    NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
    MAKEFLAGS += -j$(NUMJOBS)
endif



-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/1] kbuild: deb-pkg: Build parallely with current dpkg-buildpackage
  2023-03-15 16:29 ` [PATCH v2 1/1] " Bastian Germann
  2023-03-15 16:51   ` Masahiro Yamada
@ 2023-03-15 16:52   ` Sedat Dilek
  1 sibling, 0 replies; 4+ messages in thread
From: Sedat Dilek @ 2023-03-15 16:52 UTC (permalink / raw)
  To: Bastian Germann
  Cc: Masahiro Yamada, Nathan Chancellor, Nick Desaulniers,
	linux-kbuild, linux-kernel

On Wed, Mar 15, 2023 at 5:38 PM Bastian Germann <bage@linutronix.de> wrote:
>
> With dpkg-buildpackage v1.21.10 or later, the only way to build the
> deb-pkg generated package parallely is adding -j<N> to the MAKEFLAGS
> environment variable or using the --jobs-force option. The package ignores
> the usual parallel build option that is described in Debian Policy §4.9.1.
>
> Derive make's -j parameter from the DEB_BUILD_OPTIONS environment variable
> that ends up being set by dpkg-buildpackage -j<N>.
>
> Link: https://www.debian.org/doc/debian-policy/ch-source.html

Thanks for the patch v2 and clarifications.

Substitute above link? Or add as a 2nd link?

Link: https://www.debian.org/doc/debian-policy/ch-source.html#s-debianrules-options

-Sedat-

> Signed-off-by: Bastian Germann <bage@linutronix.de>
> ---
>  scripts/package/mkdebian | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
> index f74380036bb5..0217790e7a26 100755
> --- a/scripts/package/mkdebian
> +++ b/scripts/package/mkdebian
> @@ -238,11 +238,15 @@ fi
>  cat <<EOF > debian/rules
>  #!$(command -v $MAKE) -f
>
> +ifneq (,\$(filter parallel=%,\$(DEB_BUILD_OPTIONS)))
> +       JOBS = -j\$(subst parallel=,,\$(filter parallel=%,\$(DEB_BUILD_OPTIONS)))
> +endif
> +
>  srctree ?= .
>
>  build-indep:
>  build-arch:
> -       \$(MAKE) -f \$(srctree)/Makefile ARCH=${ARCH} \
> +       \$(MAKE) -f \$(srctree)/Makefile ARCH=${ARCH} \$(JOBS) \
>         \$(shell \$(srctree)/scripts/package/deb-build-option) \
>         olddefconfig all
>
> @@ -250,10 +254,10 @@ build: build-arch
>
>  binary-indep:
>  binary-arch: build-arch
> -       \$(MAKE) -f \$(srctree)/Makefile ARCH=${ARCH} intdeb-pkg
> +       \$(MAKE) -f \$(srctree)/Makefile ARCH=${ARCH} \$(JOBS) intdeb-pkg
>  clean:
>         rm -rf debian/files debian/linux-*
> -       \$(MAKE) -f \$(srctree)/Makefile ARCH=${ARCH} clean
> +       \$(MAKE) -f \$(srctree)/Makefile ARCH=${ARCH} \$(JOBS) clean
>
>  binary: binary-arch
>  EOF
> --
> 2.39.2
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-03-15 16:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-15 16:29 [PATCH v2 0/1] kbuild: deb-pkg: Build parallely with current dpkg-buildpackage Bastian Germann
2023-03-15 16:29 ` [PATCH v2 1/1] " Bastian Germann
2023-03-15 16:51   ` Masahiro Yamada
2023-03-15 16:52   ` Sedat Dilek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).