Skip to contentSkip to conversation

kbuild: deb-pkg: allow to set package name version

PATCH In review Guido Günther 3 participants 6 messages Oct 25 – Nov 5 Kbuild

lore
Share & tools
lore
#0 lore raw

v2 cover kbuild: deb-pkg: allow to set package name version

Instead of hardcoding ${KERNELRELEASE} in the package name allow the user to override this.

This can be useful if one doesn't want to accumulate different packages for every commit or micro version bump by setting KDEB_PKGNAMEVERSION=7.3 or even KDEB_PKGNAMEVERSION=stable.

---
Changes in v2:
- Let "scripts/package/builddeb" use ${KERNELRELEASE} when referring to the kernel release rather than using $version. Split into a separate commit as this can be useful on its own.
- Link to v1: https://patch.msgid.link/[email protected]

To: Nathan Chancellor <[email protected]>
To: Nicolas Schier <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
Guido Günther (2):
kbuild: builddeb: Use ${KERNELRELEASE} consistently
kbuild: deb-pkg: allow to set package name version

 scripts/package/builddeb |  4 ++--
 scripts/package/mkdebian | 12 +++++++++---
 2 files changed, 11 insertions(+), 5 deletions(-)

---
base-commit: c03c1a14507dfaf8b856c2608f9ac216021fc222
change-id: 20261019-deb-pkg-a6ef2837687e

Best regards,

Signature · 1 line
Guido Günther <[email protected]>
#1 lore raw

PATCH v2 1/2 kbuild: builddeb: Use ${KERNELRELEASE} consistently

Only use $version when it affects the package name, other places should use ${KERNELRELEASE}.

---
 scripts/package/builddeb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/package/builddeb +2 -2
index ba1defc616524..5fdc9ea0dcca4 100755
@@ -147,8 +147,8 @@ install_kernel_headers () {
 		"${srctree}/scripts/package/install-extmod-build" "${pdir}/usr/src/linux-headers-${version}"
 	fi
 
-	mkdir -p $pdir/lib/modules/$version/
-	ln -s /usr/src/linux-headers-$version $pdir/lib/modules/$version/build
+	mkdir -p $pdir/lib/modules/${KERNELRELEASE}/
+	ln -s /usr/src/linux-headers-$version $pdir/lib/modules/${KERNELRELEASE}/build
 }
 
 install_libc_headers () {
Signature · 1 line
2.53.0
maintainer
#2 lore raw

Re: [PATCH v2 1/2] kbuild: builddeb: Use ${KERNELRELEASE} consistently

Quoted 10 lines

Only use $version when it affects the package name, other places should use ${KERNELRELEASE}.

scripts/package/builddeb +0 -0
index ba1defc61652..5fdc9ea0dcca 100755

scripts/package/builddeb install_kernel_headers () { · line 151

Quoted 7 lines
scripts/package/builddeb +2 -2
@@ -147,8 +147,8 @@ install_kernel_headers () {
 		"${srctree}/scripts/package/install-extmod-build" "${pdir}/usr/src/linux-headers-${version}"
 	fi
 
-	mkdir -p $pdir/lib/modules/$version/
-	ln -s /usr/src/linux-headers-$version $pdir/lib/modules/$version/build
+	mkdir -p $pdir/lib/modules/${KERNELRELEASE}/
+	ln -s /usr/src/linux-headers-$version $pdir/lib/modules/${KERNELRELEASE}/build

yeah, well. I am afraid, that this may lead to non-obvious conflicts between packages, if KDEB_PKGNAMEVERSION is used with badly chosen values. But as KDEB_PKGNAMEVERSION is not (yet) advertised in the documentation, I think it's ok for now.

Signature · 1 line
Nicolas
#3 lore raw

PATCH v2 2/2 kbuild: deb-pkg: allow to set package name version

In reply to Guido Günther

Instead of hardcoding ${KERNELRELEASE} in the package name allow the user to override this.

This can be useful if one doesn't want to accumulate different packages for every commit or micro version bump by setting KDEB_PKGNAMEVERSION=7.3 or even KDEB_PKGNAMEVERSION=stable.

---
 scripts/package/mkdebian | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
scripts/package/mkdebian +9 -3
index d4b007b38a475..44ca9991fd6f4 100755
@@ -172,6 +172,12 @@ else
 	packagename=linux-image
 fi
 
+if [ "${KDEB_PKGNAMEVERSION:+set}" ]; then
+	packagenameversion=$KDEB_PKGNAMEVERSION
+else
+	packagenameversion=$KERNELRELEASE
+fi
+
 debarch=
 set_debarch
 
@@ -215,7 +221,7 @@ Build-Depends-Arch: bc, bison, flex,
  python3:native, rsync
 Homepage: https://www.kernel.org/
 
-Package: $packagename-${KERNELRELEASE}
+Package: $packagename-${packagenameversion}
 Architecture: $debarch
 Description: Linux kernel, version ${KERNELRELEASE}
  This package contains the Linux kernel, modules and corresponding other
@@ -238,7 +244,7 @@ EOF
 if is_enabled CONFIG_MODULES; then
 cat <<EOF >> debian/control
 
-Package: linux-headers-${KERNELRELEASE}
+Package: linux-headers-${packagenameversion}
 Architecture: $debarch
 Build-Profiles: <!pkg.${sourcename}.nokernelheaders>
 Description: Linux kernel headers for ${KERNELRELEASE} on $debarch
@@ -252,7 +258,7 @@ fi
 if is_enabled CONFIG_DEBUG_INFO; then
 cat <<EOF >> debian/control
 
-Package: linux-image-${KERNELRELEASE}-dbg
+Package: linux-image-${packagenameversion}-dbg
 Section: debug
 Architecture: $debarch
 Build-Profiles: <!pkg.${sourcename}.nokerneldbg>
Signature · 1 line
2.53.0
maintainer
#4 lore raw
Quoted 27 lines

Instead of hardcoding ${KERNELRELEASE} in the package name allow the user to override this.

This can be useful if one doesn't want to accumulate different packages for every commit or micro version bump by setting KDEB_PKGNAMEVERSION=7.3 or even KDEB_PKGNAMEVERSION=stable.

scripts/package/mkdebian +6 -0
index d4b007b38a47..44ca9991fd6f 100755
@@ -172,6 +172,12 @@ else
 	packagename=linux-image
 fi
 
+if [ "${KDEB_PKGNAMEVERSION:+set}" ]; then
+	packagenameversion=$KDEB_PKGNAMEVERSION
+else
+	packagenameversion=$KERNELRELEASE
+fi
+
 debarch=
 set_debarch
 

scripts/package/mkdebian Build-Depends-Arch: bc, bison, flex, · line 227

Quoted 8 lines
scripts/package/mkdebian +1 -1
@@ -215,7 +221,7 @@ Build-Depends-Arch: bc, bison, flex,
  python3:native, rsync
 Homepage: https://www.kernel.org/
 
-Package: $packagename-${KERNELRELEASE}
+Package: $packagename-${packagenameversion}
 Architecture: $debarch
 Description: Linux kernel, version ${KERNELRELEASE}
  This package contains the Linux kernel, modules and corresponding other

For completeness, I'd like to have something like

    Conflicts: linux-image-${KERNELRELEASE}
    Replaces: linux-image-${KERNELRELEASE}

here (and similar below), if ${KERNELRELEASE} != ${packagenameversion}; but probably it's not worth the effort.

I'll queue this patch set for 7.5, thanks!

Signature · 1 line
Nicolas
maintainer Reviewed-by on the v2 series
#5 lore raw
In reply to Guido Günther
Quoted 6 lines

Instead of hardcoding ${KERNELRELEASE} in the package name allow the user to override this.

This can be useful if one doesn't want to accumulate different packages for every commit or micro version bump by setting KDEB_PKGNAMEVERSION=7.3 or even KDEB_PKGNAMEVERSION=stable.

...

Quoted 7 lines

Guido Günther (2):
kbuild: builddeb: Use ${KERNELRELEASE} consistently
kbuild: deb-pkg: allow to set package name version

 scripts/package/builddeb |  4 ++--
 scripts/package/mkdebian | 12 +++++++++---
 2 files changed, 11 insertions(+), 5 deletions(-)

Sure, this seems reasonable enough to support.

Signature · 2 lines
Cheers,
Nathan