diff mbox series

classes/flit-core: fix dependency loop

Message ID GV1PR07MB91206A63390D43C3F32D7118A8A12@GV1PR07MB9120.eurprd07.prod.outlook.com
State New
Headers show
Series classes/flit-core: fix dependency loop | expand

Commit Message

Konrad Weihmann July 15, 2024, 12:18 p.m. UTC
when using python_flit_core on a native recipe
it was creating a dependency loop, as tasks for
python3 requires tasks for python3-native,
which is essential for building any native python recipes.

Signed-off-by: Konrad Weihmann <kweihmann@outlook.com>
---
 meta/classes-recipe/python_flit_core.bbclass | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Ross Burton July 16, 2024, 10:12 a.m. UTC | #1
On 15 Jul 2024, at 13:18, Konrad Weihmann via lists.openembedded.org <kweihmann=outlook.com@lists.openembedded.org> wrote:
> 
> when using python_flit_core on a native recipe
> it was creating a dependency loop, as tasks for
> python3 requires tasks for python3-native,
> which is essential for building any native python recipes.

We build native recipes in oe-core with flit, can you give an example of how this breaks?

Ross
Konrad Weihmann July 16, 2024, 10:54 a.m. UTC | #2
It isn't that obvious, for the loop to show up you would need a global 
class that DEPENDS on a native only python-flit-core built recipe.

Test to reproduce

python3-test-native.bb

LICENSE = "CLOSED"

inherit pypi
inherit python_flit_core
inherit_defer native

PYPI_PACKAGE = "test"

test.bbclass

DEPENDS:append:class-target = " python3-test-native"

local.conf

INHERIT += "test"

now run

bitbake busybox

e voila a dependency loop.
With the applied patch it's gone.

Fun fact if the python3-test-native.bb recipe would use BBCLASSEXTEND = 
"native" everything works well, it just affects recipes that use 
inherit[_defer] native/nativesdk explicitly.

Nonetheless the target python3 dependency should be fixed regardless.


Konrad



On 16.07.24 12:12, Ross Burton wrote:
> On 15 Jul 2024, at 13:18, Konrad Weihmann via lists.openembedded.org <kweihmann=outlook.com@lists.openembedded.org> wrote:
>>
>> when using python_flit_core on a native recipe
>> it was creating a dependency loop, as tasks for
>> python3 requires tasks for python3-native,
>> which is essential for building any native python recipes.
> 
> We build native recipes in oe-core with flit, can you give an example of how this breaks?
> 
> Ross
Konrad Weihmann July 21, 2024, 5:51 a.m. UTC | #3
Anything preventing this patch from being picked?

There wasn't any feedback after the last reply.

An alternative would be to drop the python3 depends, as it is set by 
setuptools-base class correctly already

On 16.07.24 12:54, Konrad Weihmann wrote:
> It isn't that obvious, for the loop to show up you would need a global 
> class that DEPENDS on a native only python-flit-core built recipe.
> 
> Test to reproduce
> 
> python3-test-native.bb
> 
> LICENSE = "CLOSED"
> 
> inherit pypi
> inherit python_flit_core
> inherit_defer native
> 
> PYPI_PACKAGE = "test"
> 
> test.bbclass
> 
> DEPENDS:append:class-target = " python3-test-native"
> 
> local.conf
> 
> INHERIT += "test"
> 
> now run
> 
> bitbake busybox
> 
> e voila a dependency loop.
> With the applied patch it's gone.
> 
> Fun fact if the python3-test-native.bb recipe would use BBCLASSEXTEND = 
> "native" everything works well, it just affects recipes that use 
> inherit[_defer] native/nativesdk explicitly.
> 
> Nonetheless the target python3 dependency should be fixed regardless.
> 
> 
> Konrad
> 
> 
> 
> On 16.07.24 12:12, Ross Burton wrote:
>> On 15 Jul 2024, at 13:18, Konrad Weihmann via lists.openembedded.org 
>> <kweihmann=outlook.com@lists.openembedded.org> wrote:
>>>
>>> when using python_flit_core on a native recipe
>>> it was creating a dependency loop, as tasks for
>>> python3 requires tasks for python3-native,
>>> which is essential for building any native python recipes.
>>
>> We build native recipes in oe-core with flit, can you give an example 
>> of how this breaks?
>>
>> Ross
Ross Burton Aug. 6, 2024, 1:43 p.m. UTC | #4
On 16 Jul 2024, at 11:54, Konrad Weihmann <kweihmann@outlook.com> wrote:
> It isn't that obvious, for the loop to show up you would need a global class that DEPENDS on a native only python-flit-core built recipe.

A global class adding to DEPENDS sounds like a bad idea… 

> An alternative would be to drop the python3 depends, as it is set by setuptools-base class correctly already

That sounds like a better fix, please sent a v2.

Ross
diff mbox series

Patch

diff --git a/meta/classes-recipe/python_flit_core.bbclass b/meta/classes-recipe/python_flit_core.bbclass
index a0b1feb70a..3da9da3e6f 100644
--- a/meta/classes-recipe/python_flit_core.bbclass
+++ b/meta/classes-recipe/python_flit_core.bbclass
@@ -6,7 +6,10 @@ 
 
 inherit python_pep517 python3native python3-dir setuptools3-base
 
-DEPENDS += "python3 python3-flit-core-native"
+DEPENDS += "python3-flit-core-native"
+DEPENDS:append:class-native = " python3-native"
+DEPENDS:append:class-nativesdk = " nativesdk-python3"
+DEPENDS:append:class-target = " python3"
 
 python_flit_core_do_manual_build () {
     cd ${PEP517_SOURCE_PATH}