public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: Jasper Orschulko <Jasper.Orschulko@iris-sensing.com>
To: "openembedded-core@lists.openembedded.org"
	<openembedded-core@lists.openembedded.org>
Cc: Erik Schumacher <Erik.Schumacher@iris-sensing.com>
Subject: Unexpected behavior with class-native and class-target in combination with inherit(_defer)
Date: Wed, 28 Aug 2024 09:40:42 +0000	[thread overview]
Message-ID: <097dd158f1582ee370ec6ef0e5d0e7b0dda949bf.camel@iris-sensing.com> (raw)

Hi,

we are on the latest scarthgap and trying to use class-target to do
target specific overrides, as described in
https://docs.yoctoproject.org/4.0.20/singleindex.html#native.

We tried removing python from PACKAGECONFIG:class-target. However, this
breaks the native build of libxml2.

This is due to the following inherit_defer statement not being called
on native:
https://github.com/yoctoproject/poky/blob/cf9d8807f80c5715daed11b5bcbb4378dcbcbd54/meta/recipes-core/libxml/libxml2_2.12.8.bb#L39

We were able to reproduce this with a minimal example consisting of a
.bb file and a .bbclass file:


test.bb:
```
SUMMARY = "Test"
LICENSE = "CLOSED"
LIC_FILES_CHKSUM = ""

SOMEVAR = "foo bar"
SOMEVAR:remove:class-target = "bar"

inherit_defer ${@bb.utils.contains('SOMEVAR', 'bar', 'testclass', '',
d)}

do_install() {
    install -d ${D}/test/
    echo "Value SOMEVAR: ${SOMEVAR}" >> ${D}/test/output
    echo "Value TESTCLASSVAR: ${TESTCLASSVAR}" >> ${D}/test/output
    echo "SOMEVAR contains 'foo'? ${@bb.utils.contains('SOMEVAR',
'foo', 'true', 'false', d)}" >> ${D}/test/output
    echo "SOMEVAR contains 'bar'? ${@bb.utils.contains('SOMEVAR',
'bar', 'true', 'false', d)}" >> ${D}/test/output
}

FILES:${PN} += "/test/output"

BBCLASSEXTEND = "native"
```

and testclass.bbclass:
```
TESTCLASSVAR = "foobar"
```

We would expect that the inherit is executed for native, but not for
target, thus the variable TESTCLASSVAR to be set in native. However,
inherit is not called for either of them, as seen in the test output:

Target:
```
Value SOMEVAR: foo 
Value TESTCLASSVAR: 
SOMEVAR contains 'foo'? true
SOMEVAR contains 'bar'? false
```

Native:
```
Value SOMEVAR: foo bar
Value TESTCLASSVAR:
SOMEVAR contains 'foo'? true
SOMEVAR contains 'bar'? true
```

Vice versa, when removing from class-native the inherit statement is
always called, not only on the target as we would expect.

Is this a known limitation or a bug?

Best,
Jasper

             reply	other threads:[~2024-08-28  9:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-28  9:40 Jasper Orschulko [this message]
2024-08-28 11:01 ` [OE-core] Unexpected behavior with class-native and class-target in combination with inherit(_defer) Richard Purdie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=097dd158f1582ee370ec6ef0e5d0e7b0dda949bf.camel@iris-sensing.com \
    --to=jasper.orschulko@iris-sensing.com \
    --cc=Erik.Schumacher@iris-sensing.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox