Skip to contentSkip to conversation

Enable building of the devel RPM package from Kbuild

PATCH In review Pratham Patel 3 participants 8 messages Apr 17, 2024 – Apr 20, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Enable building of the devel RPM package from Kbuild

This addresses a minor nit where I want a -devel RPM package to be built when I build a binary RPM package with either binrpm-pkg or rpm-pkg target(s).

Pratham Patel (2):
kbuild: allow toggling the with_devel RPM macro
docs: kbuild: document KBUILD_RPM_WITH_DEVEL

 Documentation/kbuild/kbuild.rst | 6 ++++++
 scripts/Makefile.package        | 5 ++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

--
2.42.0

#1 lore raw

PATCH 1/2 kbuild: allow toggling the `with_devel` RPM macro

As it stands, there is no way to toggle the with_devel RPM macro that is defined in the scripts/package/kernel.spec file, without manually building the RPM.

Introduce the Kbuild variable KBUILD_RPM_WITH_DEVEL to toggle the with_devel macro when building the binary PRM package.

The prior default of not building the -devel RPM package is preserved.

---
 scripts/Makefile.package | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
scripts/Makefile.package +4 -1
index 38653f3e8108..715e068eae60 100644
@@ -47,6 +47,8 @@ $(linux-tarballs): .tmp_HEAD FORCE
 # rpm-pkg srcrpm-pkg binrpm-pkg
 # ---------------------------------------------------------------------------
 
+export KBUILD_RPM_WITH_DEVEL ?= 0
+
 quiet_cmd_mkspec = GEN     $@
       cmd_mkspec = $(srctree)/scripts/package/mkspec $@
 
@@ -71,7 +73,8 @@ rpm-pkg srcrpm-pkg binrpm-pkg: rpmbuild/SPECS/kernel.spec
 	+$(strip rpmbuild -b$(build-type) rpmbuild/SPECS/kernel.spec \
 	--define='_topdir $(abspath rpmbuild)' \
 	$(if $(filter a b, $(build-type)), \
-		--target $(UTS_MACHINE)-linux --build-in-place --noprep --define='_smp_mflags %{nil}' \
+		--target $(UTS_MACHINE)-linux --build-in-place --noprep \
+		--define='_smp_mflags %{nil}' --define='with_devel $(KBUILD_RPM_WITH_DEVEL)' \
 		$$(rpm -q rpm >/dev/null 2>&1 || echo --nodeps)) \
 	$(RPMOPTS))
 
Signature · 1 line
2.42.0
#2 lore raw

PATCH 2/2 docs: kbuild: document KBUILD_RPM_WITH_DEVEL

In reply to Pratham Patel

KBUILD_RPM_WITH_DEVEL was added to toggle the with_devel RPM macro. Add brief documentation on its usage.

---
 Documentation/kbuild/kbuild.rst | 6 ++++++
 1 file changed, 6 insertions(+)
Documentation/kbuild/kbuild.rst +6 -0
index 9c8d1d046ea5..0b7ae268ac67 100644
@@ -310,6 +310,12 @@ These two variables allow to override the user@host string displayed during
 boot and in /proc/version. The default value is the output of the commands
 whoami and host, respectively.
 
+KBUILD_RPM_WITH_DEVEL
+---------------------
+This variable dictates weather creating an RPM package also builds a `-devel`
+package or not. Set to 1 if you want a `-devel` package. The default value
+is 0.
+
 LLVM
 ----
 If this variable is set to 1, Kbuild will use Clang and LLVM utilities instead
Signature · 1 line
2.42.0
#3 lore raw
In reply to Pratham Patel
Quoted 8 lines · Pratham Patel

This addresses a minor nit where I want a -devel RPM package to be built when I build a binary RPM package with either binrpm-pkg or rpm-pkg target(s).

Pratham Patel (2):
kbuild: allow toggling the with_devel RPM macro
docs: kbuild: document KBUILD_RPM_WITH_DEVEL

Quoted 7 lines
 Documentation/kbuild/kbuild.rst | 6 ++++++
 scripts/Makefile.package        | 5 ++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

--
2.42.0

Hmmm, when I execute

  $ make -skj"$(nproc)" ARCH=x86_64 O=build mrproper defconfig binrpm-pkg

I end up with

  $ ls -1 build/rpmbuild/RPMS/x86_64
  kernel-6.9.0_rc4_00031_g96fca68c4fbf-1.x86_64.rpm
  kernel-devel-6.9.0_rc4_00031_g96fca68c4fbf-1.x86_64.rpm
  kernel-headers-6.9.0_rc4_00031_g96fca68c4fbf-1.x86_64.rpm

so it seems like this is already happening?

Cheers,
Nathan

#4 lore raw
Quoted 28 lines · Nathan Chancellor
Quoted 8 lines · Pratham Patel

This addresses a minor nit where I want a -devel RPM package to be built when I build a binary RPM package with either binrpm-pkg or rpm-pkg target(s).

Pratham Patel (2):
kbuild: allow toggling the with_devel RPM macro
docs: kbuild: document KBUILD_RPM_WITH_DEVEL

Quoted 7 lines
 Documentation/kbuild/kbuild.rst | 6 ++++++
 scripts/Makefile.package        | 5 ++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

--
2.42.0

Hmmm, when I execute

  $ make -skj"$(nproc)" ARCH=x86_64 O=build mrproper defconfig binrpm-pkg

I end up with

  $ ls -1 build/rpmbuild/RPMS/x86_64
  kernel-6.9.0_rc4_00031_g96fca68c4fbf-1.x86_64.rpm
  kernel-devel-6.9.0_rc4_00031_g96fca68c4fbf-1.x86_64.rpm
  kernel-headers-6.9.0_rc4_00031_g96fca68c4fbf-1.x86_64.rpm
Quoted 4 lines

so it seems like this is already happening?

Cheers,
Nathan

Ah sorry, that was a typo. I meant to say the following:
"This addresses a minor nit where I **don't** want a -devel RPM package to be built when I build a binary RPM package with either binrpm-pkg or rpm-pkg target(s)."

That is because on ARM systems where I just need to quickly test the upstream defconfig, I don't really need the -devel package.

Also, I see that in a hurry, I did the opposite of what I wanted in the patches. This went unnoticed since I had KBUILD_RPM_WITH_DEVEL=0 for me during testing. Sorry about that!

I'll send a v2 fixing this stupid mistake.

-- Pratham Patel

#5 lore raw
Quoted 39 lines · Pratham Patel
Quoted 28 lines · Nathan Chancellor
Quoted 8 lines · Pratham Patel

This addresses a minor nit where I want a -devel RPM package to be built when I build a binary RPM package with either binrpm-pkg or rpm-pkg target(s).

Pratham Patel (2):
kbuild: allow toggling the with_devel RPM macro
docs: kbuild: document KBUILD_RPM_WITH_DEVEL

Quoted 7 lines
 Documentation/kbuild/kbuild.rst | 6 ++++++
 scripts/Makefile.package        | 5 ++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

--
2.42.0

Hmmm, when I execute

  $ make -skj"$(nproc)" ARCH=x86_64 O=build mrproper defconfig binrpm-pkg

I end up with

  $ ls -1 build/rpmbuild/RPMS/x86_64
  kernel-6.9.0_rc4_00031_g96fca68c4fbf-1.x86_64.rpm
  kernel-devel-6.9.0_rc4_00031_g96fca68c4fbf-1.x86_64.rpm
  kernel-headers-6.9.0_rc4_00031_g96fca68c4fbf-1.x86_64.rpm
Quoted 4 lines

so it seems like this is already happening?

Cheers,
Nathan

Ah sorry, that was a typo. I meant to say the following:
"This addresses a minor nit where I **don't** want a -devel RPM package to be built when I build a binary RPM package with either binrpm-pkg or rpm-pkg target(s)."

Quoted 8 lines

That is because on ARM systems where I just need to quickly test the upstream defconfig, I don't really need the -devel package.

Also, I see that in a hurry, I did the opposite of what I wanted in the patches. This went unnoticed since I had KBUILD_RPM_WITH_DEVEL=0 for me during testing. Sorry about that!

I'll send a v2 fixing this stupid mistake.

Ah, understood! I am not sure you actually need a v2 though because I think you can already accomplish what you are looking for by adding

RPMOPTS='--without devel'

to your make command, at least that works for me. Commit 2a291fc315b6 ("kbuild: rpm-pkg: introduce %{with_devel} switch to select devel package") introduced this.

Cheers,
Nathan

#6 lore raw
Quoted 52 lines · Nathan Chancellor
Quoted 39 lines · Pratham Patel
Quoted 28 lines · Nathan Chancellor
Quoted 8 lines · Pratham Patel

This addresses a minor nit where I want a -devel RPM package to be built when I build a binary RPM package with either binrpm-pkg or rpm-pkg target(s).

Pratham Patel (2):
kbuild: allow toggling the with_devel RPM macro
docs: kbuild: document KBUILD_RPM_WITH_DEVEL

Quoted 7 lines
 Documentation/kbuild/kbuild.rst | 6 ++++++
 scripts/Makefile.package        | 5 ++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

--
2.42.0

Hmmm, when I execute

  $ make -skj"$(nproc)" ARCH=x86_64 O=build mrproper defconfig binrpm-pkg

I end up with

  $ ls -1 build/rpmbuild/RPMS/x86_64
  kernel-6.9.0_rc4_00031_g96fca68c4fbf-1.x86_64.rpm
  kernel-devel-6.9.0_rc4_00031_g96fca68c4fbf-1.x86_64.rpm
  kernel-headers-6.9.0_rc4_00031_g96fca68c4fbf-1.x86_64.rpm
Quoted 4 lines

so it seems like this is already happening?

Cheers,
Nathan

Ah sorry, that was a typo. I meant to say the following:
"This addresses a minor nit where I **don't** want a -devel RPM package to be built when I build a binary RPM package with either binrpm-pkg or rpm-pkg target(s)."

Quoted 8 lines

That is because on ARM systems where I just need to quickly test the upstream defconfig, I don't really need the -devel package.

Also, I see that in a hurry, I did the opposite of what I wanted in the patches. This went unnoticed since I had KBUILD_RPM_WITH_DEVEL=0 for me during testing. Sorry about that!

I'll send a v2 fixing this stupid mistake.

Ah, understood! I am not sure you actually need a v2 though because I think you can already accomplish what you are looking for by adding

Quoted 8 lines

RPMOPTS='--without devel'

to your make command, at least that works for me. Commit 2a291fc315b6 ("kbuild: rpm-pkg: introduce %{with_devel} switch to select devel package") introduced this.

Cheers,
Nathan

Oh, didn't know that, thank you. :)

-- Pratham Patel

#7 lore raw
Quoted 60 lines · Pratham Patel
Quoted 58 lines · Nathan Chancellor
Quoted 39 lines · Pratham Patel
Quoted 28 lines · Nathan Chancellor
Quoted 8 lines · Pratham Patel

This addresses a minor nit where I want a -devel RPM package to be built when I build a binary RPM package with either binrpm-pkg or rpm-pkg target(s).

Pratham Patel (2):
kbuild: allow toggling the with_devel RPM macro
docs: kbuild: document KBUILD_RPM_WITH_DEVEL

Quoted 7 lines
 Documentation/kbuild/kbuild.rst | 6 ++++++
 scripts/Makefile.package        | 5 ++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

--
2.42.0

Hmmm, when I execute

  $ make -skj"$(nproc)" ARCH=x86_64 O=build mrproper defconfig binrpm-pkg

I end up with

  $ ls -1 build/rpmbuild/RPMS/x86_64
  kernel-6.9.0_rc4_00031_g96fca68c4fbf-1.x86_64.rpm
  kernel-devel-6.9.0_rc4_00031_g96fca68c4fbf-1.x86_64.rpm
  kernel-headers-6.9.0_rc4_00031_g96fca68c4fbf-1.x86_64.rpm
Quoted 4 lines

so it seems like this is already happening?

Cheers,
Nathan

Ah sorry, that was a typo. I meant to say the following:
"This addresses a minor nit where I **don't** want a -devel RPM package to be built when I build a binary RPM package with either binrpm-pkg or rpm-pkg target(s)."

Quoted 8 lines

That is because on ARM systems where I just need to quickly test the upstream defconfig, I don't really need the -devel package.

Also, I see that in a hurry, I did the opposite of what I wanted in the patches. This went unnoticed since I had KBUILD_RPM_WITH_DEVEL=0 for me during testing. Sorry about that!

I'll send a v2 fixing this stupid mistake.

Ah, understood! I am not sure you actually need a v2 though because I think you can already accomplish what you are looking for by adding

RPMOPTS='--without devel'

to your make command, at least that works for me. Commit 2a291fc315b6 ("kbuild: rpm-pkg: introduce %{with_devel} switch to select devel package") introduced this.

Quoted 7 lines
Quoted 2 lines

Cheers,
Nathan

Oh, didn't know that, thank you. :)

-- Pratham Patel

As explained in the commit description of
a55d4aee76ca72e198a657cb471d2a3b37983072

Signature · 2 lines
Best Regards
Masahiro Yamada