[PATCH v1] kbuild: rpm-pkg: provide kernel{-devel}-uname-r

Avi Kivity posted 1 patch 2 months ago
scripts/package/kernel.spec | 2 ++
1 file changed, 2 insertions(+)
[PATCH v1] kbuild: rpm-pkg: provide kernel{-devel}-uname-r
Posted by Avi Kivity 2 months ago
From: Avi Kivity <avi@scylladb.com>

Fedora kernels provide, and the akmods external module build tools
expect, kernel-devel-uname-r virtual packages. To improve the life
of those who depend on akmods, do the same with the kernel's RPM
packages.

Assisted-by: OpenCode:claude-opus-4.6
Signed-off-by: Avi Kivity <avi@scylladb.com>
---
 scripts/package/kernel.spec | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/scripts/package/kernel.spec b/scripts/package/kernel.spec
index b3c956205af00..dcb04c1e7e8ef 100644
--- a/scripts/package/kernel.spec
+++ b/scripts/package/kernel.spec
@@ -13,10 +13,11 @@ Vendor: The Linux Community
 URL: https://www.kernel.org
 Source0: linux.tar.gz
 Source1: config
 Source2: diff.patch
 Provides: kernel-%{KERNELRELEASE}
+Provides: kernel-uname-r = %{KERNELRELEASE}
 BuildRequires: bc binutils bison dwarves
 BuildRequires: (elfutils-devel or libdw-devel)
 BuildRequires: (elfutils-libelf-devel or libelf-devel) flex
 BuildRequires: gcc make openssl openssl-devel perl python3 rsync
 
@@ -38,10 +39,11 @@ glibc package.
 %if %{with_devel}
 %package devel
 Summary: Development package for building kernel modules to match the %{version} kernel
 Group: System Environment/Kernel
 AutoReqProv: no
+Provides: kernel-devel-uname-r = %{KERNELRELEASE}
 %description -n kernel-devel
 This package provides kernel headers and makefiles sufficient to build modules
 against the %{version} kernel package.
 %endif
 
-- 
2.53.0
Re: [PATCH v1] kbuild: rpm-pkg: provide kernel{-devel}-uname-r
Posted by Nathan Chancellor 1 month, 2 weeks ago
On Wed, 15 Apr 2026 00:04:57 +0300, Avi Kivity <avi@lists.scylladb.com> wrote:
> diff --git a/scripts/package/kernel.spec b/scripts/package/kernel.spec
> index b3c956205af0..dcb04c1e7e8e 100644
> --- a/scripts/package/kernel.spec
> +++ b/scripts/package/kernel.spec
> @@ -15,6 +15,7 @@ Source0: linux.tar.gz
>  Source1: config
>  Source2: diff.patch
>  Provides: kernel-%{KERNELRELEASE}
> +Provides: kernel-uname-r = %{KERNELRELEASE}

Sashiko notes that this will cause the build to fail when there are two
or more hyphens in KERNELRELEASE:

  https://sashiko.dev/#/message/20260414210457.41675-1-avi@lists.scylladb.com

I can confirm this easily reproduces when CONFIG_LOCALVERSION_AUTO is
enabled:

  | $ make -skj"$(nproc)" ARCH=arm64 CROSS_COMPILE=aarch64-linux- mrproper defconfig binrpm-pkg
  | Building target platforms: aarch64-linux
  | Building for target aarch64-linux
  | error: line 24: Invalid version (double separator '-'): 7.0.0-08202-g663bd6ce5b7f: Provides: kernel-uname-r = 7.0.0-08202-g663bd6ce5b7f
  | ...

This should probably be %{version}? Please test and verify that change
still works for your use case then send a v2.

-- 
Cheers,
Nathan