> -----Original Message-----
> From: [email protected] 
> <[email protected]> On Behalf Of Adrian Freihofer via 
> lists.openembedded.org
> Sent: den 21 september 2026 23:51
> To: [email protected]
> Cc: Adrian Freihofer <[email protected]>
> Subject: [OE-core] [PATCH 1/2] package: introduce PACKAGE_BASENAME for 
> consistent kernel -src naming
> 
> From: Adrian Freihofer <[email protected]>
> 
> populate_packages() always names the auto-generated -src package after
> PN. kernel.bbclass instead names all its other sub-packages
> (kernel-dbg, kernel-dev, kernel-modules, ...) after KERNEL_PACKAGE_NAME,
> so the kernel recipe ended up with a lone -src package (linux-yocto-src)
> that did not match the rest of the kernel-* family (e.g. kernel-dbg).
> 
> The complementary package install logic (oe-pkgdata-util) cannot find
> packages that are not named after PN (${PN}-src, ${PN}-dbg, etc). For
> the kernel recipe this meant linux-yocto-src was picked up, but
> kernel-dbg, kernel-dev, etc. were not, which was inconsistent.
> 
> This commit introduces a generic PACKAGE_BASENAME variable
> (default "${PN}") that a recipe/bbclass can override to declare the base
> name its sub-packages should share. populate_packages() now uses it for
> -src naming, and kernel.bbclass sets it to "${KERNEL_PACKAGE_NAME}". As
> a result the kernel packages are now named kernel-dbg, kernel-src and so on.
> Changing the kernel's -src package to kernel-src also means this package
> is longer found either by the complementary package installation and not
> installed anymore.
> 
> If kernel packages should be installed via complementary package install
> logic is left for a follow up commit. This commit only aligns the
> package naming also for the -src package.
> 
> Signed-off-by: Adrian Freihofer <[email protected]>
> ---
>  meta/classes-recipe/kernel.bbclass | 3 +++
>  meta/conf/bitbake.conf             | 6 ++++++
>  meta/lib/oe/package.py             | 4 +++-
>  3 files changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/classes-recipe/kernel.bbclass b/meta/classes-
> recipe/kernel.bbclass
> index 0a6d754108..16745557f7 100644
> --- a/meta/classes-recipe/kernel.bbclass
> +++ b/meta/classes-recipe/kernel.bbclass
> @@ -679,6 +679,9 @@ EXPORT_FUNCTIONS do_compile do_transform_kernel
> do_transform_bundled_initramfs d
>  # kernel-base becomes kernel-${KERNEL_VERSION}
>  # kernel-image becomes kernel-image-${KERNEL_VERSION}
>  PACKAGES = "${KERNEL_PACKAGE_NAME} ${KERNEL_PACKAGE_NAME}-base 
> ${KERNEL_PACKAGE_NAME}-vmlinux ${KERNEL_PACKAGE_NAME}-image 
> ${KERNEL_PACKAGE_NAME}-dev ${KERNEL_PACKAGE_NAME}-modules 
> ${KERNEL_PACKAGE_NAME}-dbg"
> +# Keep the auto-generated -src package (see populate_packages() in 
> oe/package.py) named,
> +# and resolvable by tools like oe-pkgdata-util, consistently with the rest 
> of the kernel-* family.
> +PACKAGE_BASENAME = "${KERNEL_PACKAGE_NAME}"
>  FILES:${PN} = ""
>  FILES:${KERNEL_PACKAGE_NAME}-base = 
> "${KERNEL_MODULE_INSTALL_PREFIX}/modules.order 
> ${KERNEL_MODULE_INSTALL_PREFIX}/modules.builtin 
> ${KERNEL_MODULE_INSTALL_PREFIX}/modules.builtin.modinfo"
>  FILES:${KERNEL_PACKAGE_NAME}-image = ""
> diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
> index d353a7cd2c..f82ee0f039 100644
> --- a/meta/conf/bitbake.conf
> +++ b/meta/conf/bitbake.conf
> @@ -334,6 +334,12 @@ SOLIBSDEV:mingw32 = ".dll"
> 
>  PACKAGE_DEBUG_SPLIT_STYLE ?= "debug-with-srcpkg"
> 
> +# The base name recipe sub-packages (-dbg, -dev, -src etc.) are derived from.

But that isn't really true, is it? E.g., PACKAGES below is defined 
based on ${PN} rather than ${PACKAGE_BASENAME}, and so are all the 
FILES variables. This seems more like a band-aid than a complete 
solution. (And no, I am not suggesting to change ${PN} to 
${PACKAGE_BASENAME} throughout the code because that would be 
madness.)

> +# Recipes/bbclasses that name their packages after something other than PN
> +# (e.g. kernel.bbclass and KERNEL_PACKAGE_NAME) should override this so that
> +# tooling (e.g. oe-pkgdata-util) can still map generic package globs to them.
> +PACKAGE_BASENAME ??= "${PN}"
> +
>  PACKAGE_BEFORE_PN ?= ""
>  PACKAGES = "${PN}-src ${PN}-dbg ${PN}-staticdev ${PN}-dev ${PN}-doc 
> ${PN}-locale ${PACKAGE_BEFORE_PN} ${PN}"
>  PACKAGES_DYNAMIC = "^${PN}-locale-.*"
> diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py
> index b7030643d2..4afd047905 100644
> --- a/meta/lib/oe/package.py
> +++ b/meta/lib/oe/package.py
> @@ -1391,7 +1391,9 @@ def populate_packages(d):
>      # If debug-with-srcpkg mode is enabled then add the source package if it
>      # doesn't exist and add the source file contents to the source package.
>      if split_source_package:
> -        src_package_name = ('%s-src' % d.getVar('PN'))
> +        # PACKAGE_BASENAME lets bbclasses (e.g. kernel.bbclass via 
> KERNEL_PACKAGE_NAME)
> +        # that name their other sub-packages differently from PN keep -src 
> consistent with them.
> +        src_package_name = ('%s-src' % (d.getVar('PACKAGE_BASENAME') or pn))
>          if not src_package_name in packages:
>              packages.append(src_package_name)
>          d.setVar('FILES:%s' % src_package_name, '/usr/src/debug')
> --
> 2.55.0

//Peter

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#246427): 
https://lists.openembedded.org/g/openembedded-core/message/246427
Mute This Topic: https://lists.openembedded.org/mt/121365623/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to