diff mbox series

[2/2] nativesdk: don't map packaging variables if the recipe inherits nativesdk

Message ID 20251106181457.3214940-2-ross.burton@arm.com
State New
Headers show
Series [1/2] dummy-sdk-package: inhibit build dependencies | expand

Commit Message

Ross Burton Nov. 6, 2025, 6:14 p.m. UTC
The nativesdk class uses a ClassExtender to remap variables and
references, for example turning foo to nativesdk-foo.  We need to do this
always because when the nativesdk class is inherited in a recipe these
need to update automatically: DEPENDS=bar should be DEPENDS=nativesdk-bar.

This mapping extends to the packaging variables (RDEPENDS, etc) as it is
usual for nativesdk to be used via BBCLASSEXTEND, so the recipe would be
written using RDEPENDS:${PN}=bar and the class would turn that into
nativesdk-bar automatically.

Some recipes don't use BBCLASSEXTEND and instead inherit nativesdk
directly. These recipes typically use "nativesdk-bar" explicitly and the
remapping isn't needed.  However, the remapping still runs: it normally
has no effect but it will still run.

This is a problem for the recipes that use sdk-provides-dummy.inc to
provide names that we don't want to be in the SDK. Notably,
nativesdk-target-provides-dummy provides "pkgconfig" because packages
can have that literal dependency injected into them by rpmdeps, and
the remapping was changing this to nativesdk-pkgconfig: the intended
provides wasn't present and it became impossible to install pkgconfig
into the nativesdk sysroot.

Note that this broke when the class extension switched to use the new
bitbake filtering API[1], as this meant the remapping happens when the
variables are _read_ instead of at parse time.

[1] oe-core 24a9858a892 ("classes/lib: Switch classextend to use new filter API")

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/classes-recipe/nativesdk.bbclass | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/meta/classes-recipe/nativesdk.bbclass b/meta/classes-recipe/nativesdk.bbclass
index 9838d5a54b7..c2e53c8450a 100644
--- a/meta/classes-recipe/nativesdk.bbclass
+++ b/meta/classes-recipe/nativesdk.bbclass
@@ -104,9 +104,11 @@  python () {
 
     clsextend.set_filter("DEPENDS", deps=True)
     clsextend.set_filter("PACKAGE_WRITE_DEPS", deps=False)
-    clsextend.map_packagevars()
     clsextend.set_filter("PROVIDES", deps=False)
 
+    if "nativesdk" in (d.getVar("BBCLASSEXTEND") or ""):
+        clsextend.map_packagevars()
+
     d.setVar("LIBCEXTENSION", "")
     d.setVar("ABIEXTENSION", "")
 }