Bug 15692 - BBCLASSEXTEND doesn't handle overrides with suffixed ${PN} for native class
Summary: BBCLASSEXTEND doesn't handle overrides with suffixed ${PN} for native class
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Medium+ normal
Target Milestone: 5.2 M3
Assignee: Christos Gavros
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2024-12-13 20:02 UTC by Denys Dmytriyenko
Modified: 2025-03-11 16:32 UTC (History)
4 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: Don't know


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Denys Dmytriyenko 2024-12-13 20:02:08 UTC
BBCLASSEXTEND doesn't handle overrides with suffixed ${PN} for
native class

More details in the discussion on the list:
https://lists.openembedded.org/g/openembedded-core/topic/109930389#msg208471
Comment 1 Christos Gavros 2025-01-06 09:57:07 UTC
Hi

I ran some tests and my conclusions are:

- I applied the proposed patch but didnt work. The vim native related package that is generated is called ‘vim-native’ in the location /build/tmp/work/x86_64-linux. I couldn't find any packages called 'vim-native-xxd' or 'vim-xxd-native'

- I tried the following solution and worked without errors. It is not a proper solution, just to understand how the mechanism works.
In vim recipe i added the line  RPROVIDES:${PN} ="xxd-native"
In another recipe i added the line RDEPENDS:${PN} += "xxd-native"

- I tried to add code in native.bbclass to set a value to RPROVIDES:vim-native = “xxd-native” in order to avoid any changes in the recipes (and then find a general solution later). I got the same error.

- I tested the same case with other recipes like 'atk-native' and 'kbd-native'. Both failed as vim.

- The error is generated at the end of the build procedure when the task “do_rootfs” is running for the             image at all of the above occasions.

Is it supposed that recipes can use RDEPENDS (e.g. RDEPENDS:${PN} += "packageName-native") to native packages of other recipes ? 

Has this been tested in the past?

Br
Christos
Comment 2 Richard Purdie 2025-01-06 14:31:34 UTC
I replied to the list with a different patch which changes the native.bbclass extension code to better handle this corner case. It does create new issues though.
Comment 3 Richard Purdie 2025-01-06 14:34:15 UTC
(In reply to Christos Gavros from comment #1)
> I ran some tests and my conclusions are:
> 
> - I applied the proposed patch but didnt work. The vim native related
> package that is generated is called ‘vim-native’ in the location
> /build/tmp/work/x86_64-linux. I couldn't find any packages called
> 'vim-native-xxd' or 'vim-xxd-native'
> 
> - I tried the following solution and worked without errors. It is not a
> proper solution, just to understand how the mechanism works.
> In vim recipe i added the line  RPROVIDES:${PN} ="xxd-native"
> In another recipe i added the line RDEPENDS:${PN} += "xxd-native"
> 
> - I tried to add code in native.bbclass to set a value to
> RPROVIDES:vim-native = “xxd-native” in order to avoid any changes in the
> recipes (and then find a general solution later). I got the same error.
> 
> - I tested the same case with other recipes like 'atk-native' and
> 'kbd-native'. Both failed as vim.
> 
> - The error is generated at the end of the build procedure when the task
> “do_rootfs” is running for the             image at all of the above
> occasions.
> 
> Is it supposed that recipes can use RDEPENDS (e.g. RDEPENDS:${PN} +=
> "packageName-native") to native packages of other recipes ? 
> 
> Has this been tested in the past?

It is intended that if a recipe has:

RDEPENDS:${PN}-xxx = "yyy"

then a native version of the recipe would have a dependency on yyy-native added.

As you say, native recipes don't have packages but they do have dependencies for their populate_sysroot task (which is where a native would get run).
Comment 4 Christos Gavros 2025-01-06 19:51:11 UTC
So, we can not have in a recipe the following statement, right ?

RDEPENDS:${PN}-xxx = “yyy-native” 

We can not use RDEPENDS between a runtime package of recipe ‘A’ and the native package of recipe ‘B’, is that right? 
If we use RDEPENDS for the runtime packages then the dependency for equivalent native recipes shall be implied
Comment 5 Denys Dmytriyenko 2025-01-06 20:04:11 UTC
(In reply to Christos Gavros from comment #4)
> So, we can not have in a recipe the following statement, right ?
> 
> RDEPENDS:${PN}-xxx = “yyy-native” 
> 
> We can not use RDEPENDS between a runtime package of recipe ‘A’ and the
> native package of recipe ‘B’, is that right? 
> If we use RDEPENDS for the runtime packages then the dependency for
> equivalent native recipes shall be implied

https://docs.yoctoproject.org/ref-manual/variables.html#term-BBCLASSEXTEND

BBCLASSEXTEND is supposed to handle all this automatically, hence the issue...
Comment 6 Richard Purdie 2025-01-07 13:06:34 UTC
(In reply to Christos Gavros from comment #4)
> So, we can not have in a recipe the following statement, right ?
> 
> RDEPENDS:${PN}-xxx = “yyy-native” 
> 
> We can not use RDEPENDS between a runtime package of recipe ‘A’ and the
> native package of recipe ‘B’, is that right? 
> If we use RDEPENDS for the runtime packages then the dependency for
> equivalent native recipes shall be implied

Such a requirement doesn't make sense, no.
Comment 7 Christos Gavros 2025-03-11 16:32:11 UTC
the patch is merged in master:

https://git.openembedded.org/openembedded-core/commit/?id=e2fd81e221c25fc21d532e020ddd8aaac0c22ede