diff mbox series

[1/2] kernelsrc.bbclass/perf: make package version consistent with kernel source

Message ID 20250630121708.4010323-1-hongxu.jia@windriver.com
State New
Headers show
Series [1/2] kernelsrc.bbclass/perf: make package version consistent with kernel source | expand

Commit Message

Hongxu Jia June 30, 2025, 12:17 p.m. UTC
If recipe inherits bbclass kernelsrc to use kernel sources,
the recipe should explicitly set ${KERNEL_VERSION} to ${PKGV}
in task do_package, otherwise package version (${PV} is usually
default 1.0) is not consistent with kernel source.

For example, there are 5 recipes in meta-openembedded to inherit
kernelsrc, but 4 recipes explicitly set PKGV.

meta-openembedded$ grep -e "setVar(.*PKGV.*KERNEL_VERSION" -e kernelsrc -rn *
meta-oe/recipes-kernel/intel-speed-select/intel-speed-select.bb:9:inherit kernelsrc
meta-oe/recipes-kernel/bpftool/bpftool.bb:8:inherit bash-completion kernelsrc kernel-arch
meta-oe/recipes-kernel/bpftool/bpftool.bb:44:    d.setVar('PKGV', d.getVar("KERNEL_VERSION").split("-")[0])
meta-oe/recipes-kernel/cpupower/cpupower.bb:8:inherit kernelsrc kernel-arch bash-completion
meta-oe/recipes-kernel/cpupower/cpupower.bb:32:    d.setVar('PKGV', d.getVar("KERNEL_VERSION").split("-")[0])
meta-oe/recipes-kernel/turbostat/turbostat.bb:98:    d.setVar('PKGV', d.getVar("KERNEL_VERSION").split("-")[0])
meta-oe/recipes-kernel/usbip-tools/usbip-tools.bb:25:inherit kernelsrc autotools-brokensep
meta-oe/recipes-kernel/usbip-tools/usbip-tools.bb:68:    d.setVar('PKGV', d.getVar("KERNEL_VERSION").split("-")[0])
meta-oe/recipes-kernel/spidev-test/spidev-test.bb:7:inherit bash-completion kernelsrc kernel-arch
meta-oe/recipes-kernel/spidev-test/spidev-test.bb:26:    d.setVar('PKGV', d.getVar("KERNEL_VERSION").split("-")[0])

This commit moves the setting of PKGV to kernelsrc.bbclass for
common use, the recipe (such as intel-speed-select) will not be
required to set it explicitly

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 meta/classes-recipe/kernelsrc.bbclass | 4 ++++
 meta/recipes-kernel/perf/perf.bb      | 4 ----
 2 files changed, 4 insertions(+), 4 deletions(-)

Comments

Bruce Ashfield July 2, 2025, 1:40 a.m. UTC | #1
In message: [OE-core] [PATCH 1/2] kernelsrc.bbclass/perf: make package version consistent with kernel source
on 30/06/2025 hongxu via lists.openembedded.org wrote:

> If recipe inherits bbclass kernelsrc to use kernel sources,
> the recipe should explicitly set ${KERNEL_VERSION} to ${PKGV}
> in task do_package, otherwise package version (${PV} is usually
> default 1.0) is not consistent with kernel source.
> 
> For example, there are 5 recipes in meta-openembedded to inherit
> kernelsrc, but 4 recipes explicitly set PKGV.
> 
> meta-openembedded$ grep -e "setVar(.*PKGV.*KERNEL_VERSION" -e kernelsrc -rn *
> meta-oe/recipes-kernel/intel-speed-select/intel-speed-select.bb:9:inherit kernelsrc
> meta-oe/recipes-kernel/bpftool/bpftool.bb:8:inherit bash-completion kernelsrc kernel-arch
> meta-oe/recipes-kernel/bpftool/bpftool.bb:44:    d.setVar('PKGV', d.getVar("KERNEL_VERSION").split("-")[0])
> meta-oe/recipes-kernel/cpupower/cpupower.bb:8:inherit kernelsrc kernel-arch bash-completion
> meta-oe/recipes-kernel/cpupower/cpupower.bb:32:    d.setVar('PKGV', d.getVar("KERNEL_VERSION").split("-")[0])
> meta-oe/recipes-kernel/turbostat/turbostat.bb:98:    d.setVar('PKGV', d.getVar("KERNEL_VERSION").split("-")[0])
> meta-oe/recipes-kernel/usbip-tools/usbip-tools.bb:25:inherit kernelsrc autotools-brokensep
> meta-oe/recipes-kernel/usbip-tools/usbip-tools.bb:68:    d.setVar('PKGV', d.getVar("KERNEL_VERSION").split("-")[0])
> meta-oe/recipes-kernel/spidev-test/spidev-test.bb:7:inherit bash-completion kernelsrc kernel-arch
> meta-oe/recipes-kernel/spidev-test/spidev-test.bb:26:    d.setVar('PKGV', d.getVar("KERNEL_VERSION").split("-")[0])
> 
> This commit moves the setting of PKGV to kernelsrc.bbclass for
> common use, the recipe (such as intel-speed-select) will not be
> required to set it explicitly

Technically all of these packages don't have to be versioned
exactly the same as the kernel. Although they are in the kernel
source tree, they aren't always used that way.

That being said, I don't have an objection to the patch, but the
commit message should clearly state if a patch is fixing an issue
or is just a cleanup.

Which is this ? A cleanup or has there been some issue with the
versioning ?

Bruce

> 
> Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
> ---
>  meta/classes-recipe/kernelsrc.bbclass | 4 ++++
>  meta/recipes-kernel/perf/perf.bb      | 4 ----
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/meta/classes-recipe/kernelsrc.bbclass b/meta/classes-recipe/kernelsrc.bbclass
> index ecb02dc9edc..93361842989 100644
> --- a/meta/classes-recipe/kernelsrc.bbclass
> +++ b/meta/classes-recipe/kernelsrc.bbclass
> @@ -15,3 +15,7 @@ LOCAL_VERSION = "${@get_kernellocalversion_file("${STAGING_KERNEL_BUILDDIR}")}"
>  
>  inherit linux-kernel-base
>  
> +# The final packages get the kernel version instead of the default 1.0
> +python do_package:prepend() {
> +    d.setVar('PKGV', d.getVar("KERNEL_VERSION").split("-")[0])
> +}
> diff --git a/meta/recipes-kernel/perf/perf.bb b/meta/recipes-kernel/perf/perf.bb
> index 157aca4d791..4f29bd5bbc3 100644
> --- a/meta/recipes-kernel/perf/perf.bb
> +++ b/meta/recipes-kernel/perf/perf.bb
> @@ -385,10 +385,6 @@ do_configure:prepend () {
>      done
>  }
>  
> -python do_package:prepend() {
> -    d.setVar('PKGV', d.getVar("KERNEL_VERSION").split("-")[0])
> -}
> -
>  PACKAGE_ARCH = "${MACHINE_ARCH}"
>  
>  PACKAGES =+ "${PN}-archive ${PN}-tests ${PN}-perl ${PN}-python"
> -- 
> 2.34.1
> 

> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#219515): https://lists.openembedded.org/g/openembedded-core/message/219515
> Mute This Topic: https://lists.openembedded.org/mt/113906486/1050810
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [bruce.ashfield@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

diff --git a/meta/classes-recipe/kernelsrc.bbclass b/meta/classes-recipe/kernelsrc.bbclass
index ecb02dc9edc..93361842989 100644
--- a/meta/classes-recipe/kernelsrc.bbclass
+++ b/meta/classes-recipe/kernelsrc.bbclass
@@ -15,3 +15,7 @@  LOCAL_VERSION = "${@get_kernellocalversion_file("${STAGING_KERNEL_BUILDDIR}")}"
 
 inherit linux-kernel-base
 
+# The final packages get the kernel version instead of the default 1.0
+python do_package:prepend() {
+    d.setVar('PKGV', d.getVar("KERNEL_VERSION").split("-")[0])
+}
diff --git a/meta/recipes-kernel/perf/perf.bb b/meta/recipes-kernel/perf/perf.bb
index 157aca4d791..4f29bd5bbc3 100644
--- a/meta/recipes-kernel/perf/perf.bb
+++ b/meta/recipes-kernel/perf/perf.bb
@@ -385,10 +385,6 @@  do_configure:prepend () {
     done
 }
 
-python do_package:prepend() {
-    d.setVar('PKGV', d.getVar("KERNEL_VERSION").split("-")[0])
-}
-
 PACKAGE_ARCH = "${MACHINE_ARCH}"
 
 PACKAGES =+ "${PN}-archive ${PN}-tests ${PN}-perl ${PN}-python"