public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH] crossvars.bbclass: use d.appendVar instead of d.setVar for SDK_TOOLCHAIN variable
@ 2023-05-22  4:41 Srinuvasan Arjunan
  2023-05-22  5:16 ` Jan Kiszka
  0 siblings, 1 reply; 11+ messages in thread
From: Srinuvasan Arjunan @ 2023-05-22  4:41 UTC (permalink / raw)
  To: isar-users; +Cc: jan.kiszka, amikan, Srinuvasan A

From: Srinuvasan A <srinuvasan.a@siemens.com>

In downstream layer we may override the sdk_toolchain, but this not works as
expected in latest ISAR, the reason behind this as they moved toolchain
selection into python Anonymous function.

Anonymous Python functions always run at the end of parsing, regardless of where they are defined
even when we do override in our recipe, always wins the Anonymous Python
functions variable settings, hence change to d.appendVar instead of
d.setVar in sdk toolchain selection, so downstream layer they can modify the
SDK_TOOLCHAIN list if needed (append/remove).

Signed-off-by: Srinuvasan A <srinuvasan.a@siemens.com>
---
 meta/classes/crossvars.bbclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/meta/classes/crossvars.bbclass b/meta/classes/crossvars.bbclass
index 201d460..5a3edc4 100644
--- a/meta/classes/crossvars.bbclass
+++ b/meta/classes/crossvars.bbclass
@@ -17,7 +17,7 @@ python __anonymous() {
         sbuild_dep = "sbuild-chroot-target:do_build"
         buildchroot_dir = d.getVar('BUILDCHROOT_TARGET_DIR', False)
         buildchroot_dep = "buildchroot-target:do_build"
-        sdk_toolchain = "build-essential"
+        sdk_toolchain = " build-essential"
     else:
         d.setVar('BUILD_HOST_ARCH', d.getVar('HOST_ARCH'))
         schroot_dir = d.getVar('SCHROOT_HOST_DIR', False)
@@ -31,5 +31,5 @@ python __anonymous() {
     d.setVar('BUILDCHROOT_DEP', buildchroot_dep)
     if isar_can_build_compat(d):
         sdk_toolchain += " crossbuild-essential-" + d.getVar('COMPAT_DISTRO_ARCH')
-    d.setVar('SDK_TOOLCHAIN', sdk_toolchain)
+    d.appendVar('SDK_TOOLCHAIN', sdk_toolchain)
 }
-- 
2.34.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] crossvars.bbclass: use d.appendVar instead of d.setVar for SDK_TOOLCHAIN variable
  2023-05-22  4:41 [PATCH] crossvars.bbclass: use d.appendVar instead of d.setVar for SDK_TOOLCHAIN variable Srinuvasan Arjunan
@ 2023-05-22  5:16 ` Jan Kiszka
  2023-05-22  5:54   ` Jan Kiszka
  0 siblings, 1 reply; 11+ messages in thread
From: Jan Kiszka @ 2023-05-22  5:16 UTC (permalink / raw)
  To: Srinuvasan Arjunan, isar-users; +Cc: amikan, Srinuvasan A

On 22.05.23 06:41, Srinuvasan Arjunan wrote:
> From: Srinuvasan A <srinuvasan.a@siemens.com>
> 
> In downstream layer we may override the sdk_toolchain, but this not works as
> expected in latest ISAR, the reason behind this as they moved toolchain
> selection into python Anonymous function.

Dod you want to append or do you want to replac SDK_TOOLCHAIN in
downstream? In the latter case, we likely rather want to make our
assignment in isar weak, no?

if not d.getVar('SDK_TOOLCHAIN'):
    ...

Jan

> 
> Anonymous Python functions always run at the end of parsing, regardless of where they are defined
> even when we do override in our recipe, always wins the Anonymous Python
> functions variable settings, hence change to d.appendVar instead of
> d.setVar in sdk toolchain selection, so downstream layer they can modify the
> SDK_TOOLCHAIN list if needed (append/remove).
> 
> Signed-off-by: Srinuvasan A <srinuvasan.a@siemens.com>
> ---
>  meta/classes/crossvars.bbclass | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/meta/classes/crossvars.bbclass b/meta/classes/crossvars.bbclass
> index 201d460..5a3edc4 100644
> --- a/meta/classes/crossvars.bbclass
> +++ b/meta/classes/crossvars.bbclass
> @@ -17,7 +17,7 @@ python __anonymous() {
>          sbuild_dep = "sbuild-chroot-target:do_build"
>          buildchroot_dir = d.getVar('BUILDCHROOT_TARGET_DIR', False)
>          buildchroot_dep = "buildchroot-target:do_build"
> -        sdk_toolchain = "build-essential"
> +        sdk_toolchain = " build-essential"
>      else:
>          d.setVar('BUILD_HOST_ARCH', d.getVar('HOST_ARCH'))
>          schroot_dir = d.getVar('SCHROOT_HOST_DIR', False)
> @@ -31,5 +31,5 @@ python __anonymous() {
>      d.setVar('BUILDCHROOT_DEP', buildchroot_dep)
>      if isar_can_build_compat(d):
>          sdk_toolchain += " crossbuild-essential-" + d.getVar('COMPAT_DISTRO_ARCH')
> -    d.setVar('SDK_TOOLCHAIN', sdk_toolchain)
> +    d.appendVar('SDK_TOOLCHAIN', sdk_toolchain)
>  }

-- 
Siemens AG, Technology
Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] crossvars.bbclass: use d.appendVar instead of d.setVar for SDK_TOOLCHAIN variable
  2023-05-22  5:16 ` Jan Kiszka
@ 2023-05-22  5:54   ` Jan Kiszka
  2023-05-25  4:53     ` Srinuvasan Arjunan
  2023-06-04  9:32     ` [PATCH] meta/classes/crossvars: move sdk toolchain selection from python block Srinuvasan Arjunan
  0 siblings, 2 replies; 11+ messages in thread
From: Jan Kiszka @ 2023-05-22  5:54 UTC (permalink / raw)
  To: Srinuvasan Arjunan, isar-users; +Cc: amikan, Srinuvasan A

On 22.05.23 07:16, 'Jan Kiszka' via isar-users wrote:
> On 22.05.23 06:41, Srinuvasan Arjunan wrote:
>> From: Srinuvasan A <srinuvasan.a@siemens.com>
>>
>> In downstream layer we may override the sdk_toolchain, but this not works as
>> expected in latest ISAR, the reason behind this as they moved toolchain
>> selection into python Anonymous function.
> 
> Dod you want to append or do you want to replac SDK_TOOLCHAIN in
> downstream? In the latter case, we likely rather want to make our
> assignment in isar weak, no?
> 
> if not d.getVar('SDK_TOOLCHAIN'):
>     ...
> 

Also to answer: Why is SDK_PREINSTALL insufficient for your customization?

Jan

-- 
Siemens AG, Technology
Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] crossvars.bbclass: use d.appendVar instead of d.setVar for SDK_TOOLCHAIN variable
  2023-05-22  5:54   ` Jan Kiszka
@ 2023-05-25  4:53     ` Srinuvasan Arjunan
  2023-05-25 10:20       ` Jan Kiszka
  2023-06-04  9:32     ` [PATCH] meta/classes/crossvars: move sdk toolchain selection from python block Srinuvasan Arjunan
  1 sibling, 1 reply; 11+ messages in thread
From: Srinuvasan Arjunan @ 2023-05-25  4:53 UTC (permalink / raw)
  To: isar-users


[-- Attachment #1.1: Type: text/plain, Size: 1687 bytes --]



On Monday, May 22, 2023 at 11:24:53 AM UTC+5:30 Jan Kiszka wrote:

On 22.05.23 07:16, 'Jan Kiszka' via isar-users wrote: 
> On 22.05.23 06:41, Srinuvasan Arjunan wrote: 
>> From: Srinuvasan A <srinuv...@siemens.com> 
>> 
>> In downstream layer we may override the sdk_toolchain, but this not 
works as 
>> expected in latest ISAR, the reason behind this as they moved toolchain 
>> selection into python Anonymous function. 
> 
> Dod you want to append or do you want to replac SDK_TOOLCHAIN in 
> downstream? In the latter case, we likely rather want to make our 
> assignment in isar weak, no? 
> 
> if not d.getVar('SDK_TOOLCHAIN'): 
> ... 
> 

Also to answer: Why is SDK_PREINSTALL insufficient for your customization? 

Jan 

-- 
Siemens AG, Technology 
Competence Center Embedded Linux

 

    yes we can append our toolchain via SDK_PREINSTALL, but i need to 
replace with the "crossbuild-essential-${COMPAT_DISTRO_ARCH}" , this one 
comes via SDK_TOOLCHAIN variable, if i append " gcc-multilib g++-multilib" 
without removing the crossbuild-essential am facing broken package problem.
Logs:

 Broken gcc-multilib:amd64 Conflicts on gcc-10-i686-linux-gnu:amd64 < none 
-> 10.2.1-6cross1 @un puN Ib >
 |   Considering gcc-10-i686-linux-gnu:amd64 1 as a solution to 
gcc-multilib:amd64 10001
 | Investigating (0) gcc-10-i686-linux-gnu:amd64 < none -> 10.2.1-6cross1 
@un puN Ib >

Eventually I need to remove crossbuild-essential, but this one will do via 
SDK_TOOLCHAIN remove override , but this does not work in the downstream 
layer, because always ISAR's python anonymous function wins and set its 
value.

Thanks,
Srinu 

[-- Attachment #1.2: Type: text/html, Size: 3002 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] crossvars.bbclass: use d.appendVar instead of d.setVar for SDK_TOOLCHAIN variable
  2023-05-25  4:53     ` Srinuvasan Arjunan
@ 2023-05-25 10:20       ` Jan Kiszka
  2023-05-26  9:03         ` Srinuvasan Arjunan
  0 siblings, 1 reply; 11+ messages in thread
From: Jan Kiszka @ 2023-05-25 10:20 UTC (permalink / raw)
  To: Srinuvasan Arjunan, isar-users

On 25.05.23 06:53, Srinuvasan Arjunan wrote:
> 
> 
> On Monday, May 22, 2023 at 11:24:53 AM UTC+5:30 Jan Kiszka wrote:
> 
>     On 22.05.23 07:16, 'Jan Kiszka' via isar-users wrote:
>     > On 22.05.23 06:41, Srinuvasan Arjunan wrote:
>     >> From: Srinuvasan A <srinuv...@siemens.com>
>     >>
>     >> In downstream layer we may override the sdk_toolchain, but this
>     not works as
>     >> expected in latest ISAR, the reason behind this as they moved
>     toolchain
>     >> selection into python Anonymous function.
>     >
>     > Dod you want to append or do you want to replac SDK_TOOLCHAIN in
>     > downstream? In the latter case, we likely rather want to make our
>     > assignment in isar weak, no?
>     >
>     > if not d.getVar('SDK_TOOLCHAIN'):
>     > ...
>     >
> 
>     Also to answer: Why is SDK_PREINSTALL insufficient for your
>     customization?
> 
>     Jan
> 
>     -- 
>     Siemens AG, Technology
>     Competence Center Embedded Linux
> 
>  
> 
>     yes we can append our toolchain via SDK_PREINSTALL, but i need to
> replace with the "crossbuild-essential-${COMPAT_DISTRO_ARCH}" , this one
> comes via SDK_TOOLCHAIN variable, if i append " gcc-multilib
> g++-multilib" without removing the crossbuild-essential am facing broken
> package problem.
> Logs:
> 
>  Broken gcc-multilib:amd64 Conflicts on gcc-10-i686-linux-gnu:amd64 <
> none -> 10.2.1-6cross1 @un puN Ib >
>  |   Considering gcc-10-i686-linux-gnu:amd64 1 as a solution to
> gcc-multilib:amd64 10001
>  | Investigating (0) gcc-10-i686-linux-gnu:amd64 < none ->
> 10.2.1-6cross1 @un puN Ib >
> 
> Eventually I need to remove crossbuild-essential, but this one will do
> via SDK_TOOLCHAIN remove override , but this does not work in the
> downstream layer, because always ISAR's python anonymous function wins
> and set its value.

Ok, then we should actually implement a weak (?=) assignment in the
Python block, so that you can define your own SDK_TOOLCHAIN in such
scenarios.

Jan

-- 
Siemens AG, Technology
Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] crossvars.bbclass: use d.appendVar instead of d.setVar for SDK_TOOLCHAIN variable
  2023-05-25 10:20       ` Jan Kiszka
@ 2023-05-26  9:03         ` Srinuvasan Arjunan
  0 siblings, 0 replies; 11+ messages in thread
From: Srinuvasan Arjunan @ 2023-05-26  9:03 UTC (permalink / raw)
  To: isar-users


[-- Attachment #1.1: Type: text/plain, Size: 2913 bytes --]



On Thursday, May 25, 2023 at 3:50:49 PM UTC+5:30 Jan Kiszka wrote:

On 25.05.23 06:53, Srinuvasan Arjunan wrote: 
> 
> 
> On Monday, May 22, 2023 at 11:24:53 AM UTC+5:30 Jan Kiszka wrote: 
> 
> On 22.05.23 07:16, 'Jan Kiszka' via isar-users wrote: 
> > On 22.05.23 06:41, Srinuvasan Arjunan wrote: 
> >> From: Srinuvasan A <srinuv...@siemens.com> 
> >> 
> >> In downstream layer we may override the sdk_toolchain, but this 
> not works as 
> >> expected in latest ISAR, the reason behind this as they moved 
> toolchain 
> >> selection into python Anonymous function. 
> > 
> > Dod you want to append or do you want to replac SDK_TOOLCHAIN in 
> > downstream? In the latter case, we likely rather want to make our 
> > assignment in isar weak, no? 
> > 
> > if not d.getVar('SDK_TOOLCHAIN'): 
> > ... 
> > 
> 
> Also to answer: Why is SDK_PREINSTALL insufficient for your 
> customization? 
> 
> Jan 
> 
> -- 
> Siemens AG, Technology 
> Competence Center Embedded Linux 
> 
>   
> 
>     yes we can append our toolchain via SDK_PREINSTALL, but i need to 
> replace with the "crossbuild-essential-${COMPAT_DISTRO_ARCH}" , this one 
> comes via SDK_TOOLCHAIN variable, if i append " gcc-multilib 
> g++-multilib" without removing the crossbuild-essential am facing broken 
> package problem. 
> Logs: 
> 
>  Broken gcc-multilib:amd64 Conflicts on gcc-10-i686-linux-gnu:amd64 < 
> none -> 10.2.1-6cross1 @un puN Ib > 
>  |   Considering gcc-10-i686-linux-gnu:amd64 1 as a solution to 
> gcc-multilib:amd64 10001 
>  | Investigating (0) gcc-10-i686-linux-gnu:amd64 < none -> 
> 10.2.1-6cross1 @un puN Ib > 
> 
> Eventually I need to remove crossbuild-essential, but this one will do 
> via SDK_TOOLCHAIN remove override , but this does not work in the 
> downstream layer, because always ISAR's python anonymous function wins 
> and set its value. 

Ok, then we should actually implement a weak (?=) assignment in the 
Python block, so that you can define your own SDK_TOOLCHAIN in such 
scenarios. 

Jan 

-- 
Siemens AG, Technology 
Competence Center Embedded Linux



 we can't do soft assignment inside pyhton anonymous function, it throws 
syntax error.

Suppose if we want any parameter to override that should not be in python 
anonymous function, upstream layer should follow this one.
we could write an python anonymous function in downstream layer to set the 
proper one, but in this case no use to inherit that functionality
from upstream (duplication)
In ISAR, this commit c8371018 moves the cross selection part into one 
place, here obviously we are not overriding the chroot 
(builchroot/sbuildchroot) part,
but we may do override for toolchain selection, I hope we can pull out this 
toolchain selection from python function and keep it outside,
hence this can be override from other layer.

Thanks,
Srinu. 

[-- Attachment #1.2: Type: text/html, Size: 3853 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH] meta/classes/crossvars: move sdk toolchain selection from python block
  2023-05-22  5:54   ` Jan Kiszka
  2023-05-25  4:53     ` Srinuvasan Arjunan
@ 2023-06-04  9:32     ` Srinuvasan Arjunan
  2023-06-05  7:00       ` Jan Kiszka
  1 sibling, 1 reply; 11+ messages in thread
From: Srinuvasan Arjunan @ 2023-06-04  9:32 UTC (permalink / raw)
  To: isar-users; +Cc: jan.kiszka, amikan, Srinuvasan A

From: Srinuvasan A <srinuvasan.a@siemens.com>

In the present implementation we are not able to override the SDK
toolchain from downstream layer, this is due to the SDK toolchain
selection part in anonymous python function.

Anonymous python functions always run at the end of parsing, regardless of where they are defined
even when we do override in our recipe, always wins the Anonymous Python
functions variable settings, hence we are not able to override our
downstream toolchain.

Move the SDK toolchian selection from python block, now we can able to
override from downstream layer.

Signed-off-by: Srinuvasan A <srinuvasan.a@siemens.com>
---
 meta/classes/crossvars.bbclass | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/meta/classes/crossvars.bbclass b/meta/classes/crossvars.bbclass
index 201d460..120e6d1 100644
--- a/meta/classes/crossvars.bbclass
+++ b/meta/classes/crossvars.bbclass
@@ -5,6 +5,10 @@ ISAR_CROSS_COMPILE ??= "0"
 
 inherit compat
 
+SDK_TOOLCHAIN = "${@'build-essential' if d.getVar('ISAR_CROSS_COMPILE') == '0' or d.getVar('HOST_ARCH') == d.getVar('DISTRO_ARCH') or d.getVar('DISTRO_ARCH') == None else 'crossbuild-essential-${DISTRO_ARCH}'}"
+
+SDK_TOOLCHAIN:append = "${@' crossbuild-essential-${COMPAT_DISTRO_ARCH}' if isar_can_build_compat(d) else ''}"
+
 python __anonymous() {
     import pwd
     d.setVar('SCHROOT_USER', pwd.getpwuid(os.geteuid()).pw_name)
@@ -17,19 +21,14 @@ python __anonymous() {
         sbuild_dep = "sbuild-chroot-target:do_build"
         buildchroot_dir = d.getVar('BUILDCHROOT_TARGET_DIR', False)
         buildchroot_dep = "buildchroot-target:do_build"
-        sdk_toolchain = "build-essential"
     else:
         d.setVar('BUILD_HOST_ARCH', d.getVar('HOST_ARCH'))
         schroot_dir = d.getVar('SCHROOT_HOST_DIR', False)
         sbuild_dep = "sbuild-chroot-host:do_build"
         buildchroot_dir = d.getVar('BUILDCHROOT_HOST_DIR', False)
         buildchroot_dep = "buildchroot-host:do_build"
-        sdk_toolchain = "crossbuild-essential-" + distro_arch
     d.setVar('SCHROOT_DIR', schroot_dir)
     d.setVar('SCHROOT_DEP', sbuild_dep)
     d.setVar('BUILDCHROOT_DIR', buildchroot_dir)
     d.setVar('BUILDCHROOT_DEP', buildchroot_dep)
-    if isar_can_build_compat(d):
-        sdk_toolchain += " crossbuild-essential-" + d.getVar('COMPAT_DISTRO_ARCH')
-    d.setVar('SDK_TOOLCHAIN', sdk_toolchain)
 }
-- 
2.34.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] meta/classes/crossvars: move sdk toolchain selection from python block
  2023-06-04  9:32     ` [PATCH] meta/classes/crossvars: move sdk toolchain selection from python block Srinuvasan Arjunan
@ 2023-06-05  7:00       ` Jan Kiszka
  2023-06-05  7:07         ` Srinuvasan Arjunan
  0 siblings, 1 reply; 11+ messages in thread
From: Jan Kiszka @ 2023-06-05  7:00 UTC (permalink / raw)
  To: Srinuvasan Arjunan, isar-users; +Cc: amikan, Srinuvasan A

On 04.06.23 11:32, Srinuvasan Arjunan wrote:
> From: Srinuvasan A <srinuvasan.a@siemens.com>
> 
> In the present implementation we are not able to override the SDK
> toolchain from downstream layer, this is due to the SDK toolchain
> selection part in anonymous python function.
> 
> Anonymous python functions always run at the end of parsing, regardless of where they are defined
> even when we do override in our recipe, always wins the Anonymous Python
> functions variable settings, hence we are not able to override our
> downstream toolchain.
> 
> Move the SDK toolchian selection from python block, now we can able to
> override from downstream layer.
> 
> Signed-off-by: Srinuvasan A <srinuvasan.a@siemens.com>
> ---
>  meta/classes/crossvars.bbclass | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/meta/classes/crossvars.bbclass b/meta/classes/crossvars.bbclass
> index 201d460..120e6d1 100644
> --- a/meta/classes/crossvars.bbclass
> +++ b/meta/classes/crossvars.bbclass
> @@ -5,6 +5,10 @@ ISAR_CROSS_COMPILE ??= "0"
>  
>  inherit compat
>  
> +SDK_TOOLCHAIN = "${@'build-essential' if d.getVar('ISAR_CROSS_COMPILE') == '0' or d.getVar('HOST_ARCH') == d.getVar('DISTRO_ARCH') or d.getVar('DISTRO_ARCH') == None else 'crossbuild-essential-${DISTRO_ARCH}'}"
> +
> +SDK_TOOLCHAIN:append = "${@' crossbuild-essential-${COMPAT_DISTRO_ARCH}' if isar_can_build_compat(d) else ''}"
> +

This is still no weak assignment which you will need for overrides. Did
you actually test this? And, again, can't we implement the weak
assignment in python below?

Jan

>  python __anonymous() {
>      import pwd
>      d.setVar('SCHROOT_USER', pwd.getpwuid(os.geteuid()).pw_name)
> @@ -17,19 +21,14 @@ python __anonymous() {
>          sbuild_dep = "sbuild-chroot-target:do_build"
>          buildchroot_dir = d.getVar('BUILDCHROOT_TARGET_DIR', False)
>          buildchroot_dep = "buildchroot-target:do_build"
> -        sdk_toolchain = "build-essential"
>      else:
>          d.setVar('BUILD_HOST_ARCH', d.getVar('HOST_ARCH'))
>          schroot_dir = d.getVar('SCHROOT_HOST_DIR', False)
>          sbuild_dep = "sbuild-chroot-host:do_build"
>          buildchroot_dir = d.getVar('BUILDCHROOT_HOST_DIR', False)
>          buildchroot_dep = "buildchroot-host:do_build"
> -        sdk_toolchain = "crossbuild-essential-" + distro_arch
>      d.setVar('SCHROOT_DIR', schroot_dir)
>      d.setVar('SCHROOT_DEP', sbuild_dep)
>      d.setVar('BUILDCHROOT_DIR', buildchroot_dir)
>      d.setVar('BUILDCHROOT_DEP', buildchroot_dep)
> -    if isar_can_build_compat(d):
> -        sdk_toolchain += " crossbuild-essential-" + d.getVar('COMPAT_DISTRO_ARCH')
> -    d.setVar('SDK_TOOLCHAIN', sdk_toolchain)
>  }

-- 
Siemens AG, Technology
Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] meta/classes/crossvars: move sdk toolchain selection from python block
  2023-06-05  7:00       ` Jan Kiszka
@ 2023-06-05  7:07         ` Srinuvasan Arjunan
  2023-06-05  7:18           ` Jan Kiszka
  0 siblings, 1 reply; 11+ messages in thread
From: Srinuvasan Arjunan @ 2023-06-05  7:07 UTC (permalink / raw)
  To: isar-users


[-- Attachment #1.1: Type: text/plain, Size: 3347 bytes --]

Yes tested working fine, here i do the append overrides in downstream 
layer, like how the previous implementation before things move into the 
python block.

https://github.com/ilbers/isar/commit/43f402f4862c3779a492c50a26475ea1221a2b01

Now in present implementation comapt-arch override was removed and this 
selection of compat will be handled by  ISAR_ENABLE_COMPAT_ARCH 

Thanks,
Srinu

On Monday, June 5, 2023 at 12:31:01 PM UTC+5:30 Jan Kiszka wrote:

> On 04.06.23 11:32, Srinuvasan Arjunan wrote:
> > From: Srinuvasan A <srinuv...@siemens.com>
> > 
> > In the present implementation we are not able to override the SDK
> > toolchain from downstream layer, this is due to the SDK toolchain
> > selection part in anonymous python function.
> > 
> > Anonymous python functions always run at the end of parsing, regardless 
> of where they are defined
> > even when we do override in our recipe, always wins the Anonymous Python
> > functions variable settings, hence we are not able to override our
> > downstream toolchain.
> > 
> > Move the SDK toolchian selection from python block, now we can able to
> > override from downstream layer.
> > 
> > Signed-off-by: Srinuvasan A <srinuv...@siemens.com>
> > ---
> > meta/classes/crossvars.bbclass | 9 ++++-----
> > 1 file changed, 4 insertions(+), 5 deletions(-)
> > 
> > diff --git a/meta/classes/crossvars.bbclass 
> b/meta/classes/crossvars.bbclass
> > index 201d460..120e6d1 100644
> > --- a/meta/classes/crossvars.bbclass
> > +++ b/meta/classes/crossvars.bbclass
> > @@ -5,6 +5,10 @@ ISAR_CROSS_COMPILE ??= "0"
> > 
> > inherit compat
> > 
> > +SDK_TOOLCHAIN = "${@'build-essential' if d.getVar('ISAR_CROSS_COMPILE') 
> == '0' or d.getVar('HOST_ARCH') == d.getVar('DISTRO_ARCH') or 
> d.getVar('DISTRO_ARCH') == None else 'crossbuild-essential-${DISTRO_ARCH}'}"
> > +
> > +SDK_TOOLCHAIN:append = "${@' 
> crossbuild-essential-${COMPAT_DISTRO_ARCH}' if isar_can_build_compat(d) 
> else ''}"
> > +
>
> This is still no weak assignment which you will need for overrides. Did
> you actually test this? And, again, can't we implement the weak
> assignment in python below?
>
> Jan
>
> > python __anonymous() {
> > import pwd
> > d.setVar('SCHROOT_USER', pwd.getpwuid(os.geteuid()).pw_name)
> > @@ -17,19 +21,14 @@ python __anonymous() {
> > sbuild_dep = "sbuild-chroot-target:do_build"
> > buildchroot_dir = d.getVar('BUILDCHROOT_TARGET_DIR', False)
> > buildchroot_dep = "buildchroot-target:do_build"
> > - sdk_toolchain = "build-essential"
> > else:
> > d.setVar('BUILD_HOST_ARCH', d.getVar('HOST_ARCH'))
> > schroot_dir = d.getVar('SCHROOT_HOST_DIR', False)
> > sbuild_dep = "sbuild-chroot-host:do_build"
> > buildchroot_dir = d.getVar('BUILDCHROOT_HOST_DIR', False)
> > buildchroot_dep = "buildchroot-host:do_build"
> > - sdk_toolchain = "crossbuild-essential-" + distro_arch
> > d.setVar('SCHROOT_DIR', schroot_dir)
> > d.setVar('SCHROOT_DEP', sbuild_dep)
> > d.setVar('BUILDCHROOT_DIR', buildchroot_dir)
> > d.setVar('BUILDCHROOT_DEP', buildchroot_dep)
> > - if isar_can_build_compat(d):
> > - sdk_toolchain += " crossbuild-essential-" + 
> d.getVar('COMPAT_DISTRO_ARCH')
> > - d.setVar('SDK_TOOLCHAIN', sdk_toolchain)
> > }
>
> -- 
> Siemens AG, Technology
> Competence Center Embedded Linux
>
>

[-- Attachment #1.2: Type: text/html, Size: 5404 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] meta/classes/crossvars: move sdk toolchain selection from python block
  2023-06-05  7:07         ` Srinuvasan Arjunan
@ 2023-06-05  7:18           ` Jan Kiszka
  2023-06-05  7:43             ` Srinuvasan Arjunan
  0 siblings, 1 reply; 11+ messages in thread
From: Jan Kiszka @ 2023-06-05  7:18 UTC (permalink / raw)
  To: Srinuvasan Arjunan, isar-users

On 05.06.23 09:07, Srinuvasan Arjunan wrote:
> Yes tested working fine, here i do the append overrides in downstream
> layer, like how the previous implementation before things move into the
> python block.
> 
> https://github.com/ilbers/isar/commit/43f402f4862c3779a492c50a26475ea1221a2b01
> 
> Now in present implementation comapt-arch override was removed and this
> selection of compat will be handled by  ISAR_ENABLE_COMPAT_ARCH

So, d.setVar blocks :append and :remove, right? You don't want to set it
downstream completely?

But I dislike this long inline python, specifically as we already have
the logic more readable. How about using an intermediate variable then
which is defined in the anonymous python block while SDK_TOOLCHAIN gets
that value by default outside the block?

Or - to come back to your original issue - we make that use case of
multilib officially an SDK toolchain option so that you just need to
flip a switch, not fiddle with the internals of SDK_TOOLCHAIN.

Jan

> 
> Thanks,
> Srinu
> 
> On Monday, June 5, 2023 at 12:31:01 PM UTC+5:30 Jan Kiszka wrote:
> 
>     On 04.06.23 11:32, Srinuvasan Arjunan wrote:
>     > From: Srinuvasan A <srinuv...@siemens.com>
>     >
>     > In the present implementation we are not able to override the SDK
>     > toolchain from downstream layer, this is due to the SDK toolchain
>     > selection part in anonymous python function.
>     >
>     > Anonymous python functions always run at the end of parsing,
>     regardless of where they are defined
>     > even when we do override in our recipe, always wins the Anonymous
>     Python
>     > functions variable settings, hence we are not able to override our
>     > downstream toolchain.
>     >
>     > Move the SDK toolchian selection from python block, now we can
>     able to
>     > override from downstream layer.
>     >
>     > Signed-off-by: Srinuvasan A <srinuv...@siemens.com>
>     > ---
>     > meta/classes/crossvars.bbclass | 9 ++++-----
>     > 1 file changed, 4 insertions(+), 5 deletions(-)
>     >
>     > diff --git a/meta/classes/crossvars.bbclass
>     b/meta/classes/crossvars.bbclass
>     > index 201d460..120e6d1 100644
>     > --- a/meta/classes/crossvars.bbclass
>     > +++ b/meta/classes/crossvars.bbclass
>     > @@ -5,6 +5,10 @@ ISAR_CROSS_COMPILE ??= "0"
>     >
>     > inherit compat
>     >
>     > +SDK_TOOLCHAIN = "${@'build-essential' if
>     d.getVar('ISAR_CROSS_COMPILE') == '0' or d.getVar('HOST_ARCH') ==
>     d.getVar('DISTRO_ARCH') or d.getVar('DISTRO_ARCH') == None else
>     'crossbuild-essential-${DISTRO_ARCH}'}"
>     > +
>     > +SDK_TOOLCHAIN:append = "${@'
>     crossbuild-essential-${COMPAT_DISTRO_ARCH}' if
>     isar_can_build_compat(d) else ''}"
>     > +
> 
>     This is still no weak assignment which you will need for overrides. Did
>     you actually test this? And, again, can't we implement the weak
>     assignment in python below?
> 
>     Jan
> 
>     > python __anonymous() {
>     > import pwd
>     > d.setVar('SCHROOT_USER', pwd.getpwuid(os.geteuid()).pw_name)
>     > @@ -17,19 +21,14 @@ python __anonymous() {
>     > sbuild_dep = "sbuild-chroot-target:do_build"
>     > buildchroot_dir = d.getVar('BUILDCHROOT_TARGET_DIR', False)
>     > buildchroot_dep = "buildchroot-target:do_build"
>     > - sdk_toolchain = "build-essential"
>     > else:
>     > d.setVar('BUILD_HOST_ARCH', d.getVar('HOST_ARCH'))
>     > schroot_dir = d.getVar('SCHROOT_HOST_DIR', False)
>     > sbuild_dep = "sbuild-chroot-host:do_build"
>     > buildchroot_dir = d.getVar('BUILDCHROOT_HOST_DIR', False)
>     > buildchroot_dep = "buildchroot-host:do_build"
>     > - sdk_toolchain = "crossbuild-essential-" + distro_arch
>     > d.setVar('SCHROOT_DIR', schroot_dir)
>     > d.setVar('SCHROOT_DEP', sbuild_dep)
>     > d.setVar('BUILDCHROOT_DIR', buildchroot_dir)
>     > d.setVar('BUILDCHROOT_DEP', buildchroot_dep)
>     > - if isar_can_build_compat(d):
>     > - sdk_toolchain += " crossbuild-essential-" +
>     d.getVar('COMPAT_DISTRO_ARCH')
>     > - d.setVar('SDK_TOOLCHAIN', sdk_toolchain)
>     > }
> 
>     -- 
>     Siemens AG, Technology
>     Competence Center Embedded Linux
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "isar-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to isar-users+unsubscribe@googlegroups.com
> <mailto:isar-users+unsubscribe@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/isar-users/3f742bff-1ccd-4a88-8c96-8cab068b8eb4n%40googlegroups.com <https://groups.google.com/d/msgid/isar-users/3f742bff-1ccd-4a88-8c96-8cab068b8eb4n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
Siemens AG, Technology
Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] meta/classes/crossvars: move sdk toolchain selection from python block
  2023-06-05  7:18           ` Jan Kiszka
@ 2023-06-05  7:43             ` Srinuvasan Arjunan
  0 siblings, 0 replies; 11+ messages in thread
From: Srinuvasan Arjunan @ 2023-06-05  7:43 UTC (permalink / raw)
  To: isar-users


[-- Attachment #1.1: Type: text/plain, Size: 4941 bytes --]



On Monday, June 5, 2023 at 12:48:34 PM UTC+5:30 Jan Kiszka wrote:

On 05.06.23 09:07, Srinuvasan Arjunan wrote: 
> Yes tested working fine, here i do the append overrides in downstream 
> layer, like how the previous implementation before things move into the 
> python block. 
> 
> 
https://github.com/ilbers/isar/commit/43f402f4862c3779a492c50a26475ea1221a2b01 
> 
> Now in present implementation comapt-arch override was removed and this 
> selection of compat will be handled by  ISAR_ENABLE_COMPAT_ARCH 

So, d.setVar blocks :append and :remove, right?


         yes, correct. 

You don't want to set it 
downstream completely? 

But I dislike this long inline python, specifically as we already have 
the logic more readable. How about using an intermediate variable then 
which is defined in the anonymous python block while SDK_TOOLCHAIN gets 
that value by default outside the block?


  We could do this way. 



Or - to come back to your original issue - we make that use case of 
multilib officially an SDK toolchain option so that you just need to 
flip a switch, not fiddle with the internals of SDK_TOOLCHAIN.


  Yes , this also works , i will come back with more details. 



Jan 

> 
> Thanks, 
> Srinu 
> 
> On Monday, June 5, 2023 at 12:31:01 PM UTC+5:30 Jan Kiszka wrote: 
> 
> On 04.06.23 11:32, Srinuvasan Arjunan wrote: 
> > From: Srinuvasan A <srinuv...@siemens.com> 
> > 
> > In the present implementation we are not able to override the SDK 
> > toolchain from downstream layer, this is due to the SDK toolchain 
> > selection part in anonymous python function. 
> > 
> > Anonymous python functions always run at the end of parsing, 
> regardless of where they are defined 
> > even when we do override in our recipe, always wins the Anonymous 
> Python 
> > functions variable settings, hence we are not able to override our 
> > downstream toolchain. 
> > 
> > Move the SDK toolchian selection from python block, now we can 
> able to 
> > override from downstream layer. 
> > 
> > Signed-off-by: Srinuvasan A <srinuv...@siemens.com> 
> > --- 
> > meta/classes/crossvars.bbclass | 9 ++++----- 
> > 1 file changed, 4 insertions(+), 5 deletions(-) 
> > 
> > diff --git a/meta/classes/crossvars.bbclass 
> b/meta/classes/crossvars.bbclass 
> > index 201d460..120e6d1 100644 
> > --- a/meta/classes/crossvars.bbclass 
> > +++ b/meta/classes/crossvars.bbclass 
> > @@ -5,6 +5,10 @@ ISAR_CROSS_COMPILE ??= "0" 
> > 
> > inherit compat 
> > 
> > +SDK_TOOLCHAIN = "${@'build-essential' if 
> d.getVar('ISAR_CROSS_COMPILE') == '0' or d.getVar('HOST_ARCH') == 
> d.getVar('DISTRO_ARCH') or d.getVar('DISTRO_ARCH') == None else 
> 'crossbuild-essential-${DISTRO_ARCH}'}" 
> > + 
> > +SDK_TOOLCHAIN:append = "${@' 
> crossbuild-essential-${COMPAT_DISTRO_ARCH}' if 
> isar_can_build_compat(d) else ''}" 
> > + 
> 
> This is still no weak assignment which you will need for overrides. Did 
> you actually test this? And, again, can't we implement the weak 
> assignment in python below? 
> 
> Jan 
> 
> > python __anonymous() { 
> > import pwd 
> > d.setVar('SCHROOT_USER', pwd.getpwuid(os.geteuid()).pw_name) 
> > @@ -17,19 +21,14 @@ python __anonymous() { 
> > sbuild_dep = "sbuild-chroot-target:do_build" 
> > buildchroot_dir = d.getVar('BUILDCHROOT_TARGET_DIR', False) 
> > buildchroot_dep = "buildchroot-target:do_build" 
> > - sdk_toolchain = "build-essential" 
> > else: 
> > d.setVar('BUILD_HOST_ARCH', d.getVar('HOST_ARCH')) 
> > schroot_dir = d.getVar('SCHROOT_HOST_DIR', False) 
> > sbuild_dep = "sbuild-chroot-host:do_build" 
> > buildchroot_dir = d.getVar('BUILDCHROOT_HOST_DIR', False) 
> > buildchroot_dep = "buildchroot-host:do_build" 
> > - sdk_toolchain = "crossbuild-essential-" + distro_arch 
> > d.setVar('SCHROOT_DIR', schroot_dir) 
> > d.setVar('SCHROOT_DEP', sbuild_dep) 
> > d.setVar('BUILDCHROOT_DIR', buildchroot_dir) 
> > d.setVar('BUILDCHROOT_DEP', buildchroot_dep) 
> > - if isar_can_build_compat(d): 
> > - sdk_toolchain += " crossbuild-essential-" + 
> d.getVar('COMPAT_DISTRO_ARCH') 
> > - d.setVar('SDK_TOOLCHAIN', sdk_toolchain) 
> > } 
> 
> -- 
> Siemens AG, Technology 
> Competence Center Embedded Linux 
> 
> -- 
> You received this message because you are subscribed to the Google 
> Groups "isar-users" group. 
> To unsubscribe from this group and stop receiving emails from it, send 
> an email to isar-users+...@googlegroups.com 
> <mailto:isar-users+...@googlegroups.com>. 
> To view this discussion on the web visit 
> 
https://groups.google.com/d/msgid/isar-users/3f742bff-1ccd-4a88-8c96-8cab068b8eb4n%40googlegroups.com 
<
https://groups.google.com/d/msgid/isar-users/3f742bff-1ccd-4a88-8c96-8cab068b8eb4n%40googlegroups.com?utm_medium=email&utm_source=footer>. 


-- 
Siemens AG, Technology 
Competence Center Embedded Linux 


[-- Attachment #1.2: Type: text/html, Size: 7502 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-06-05  7:43 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-22  4:41 [PATCH] crossvars.bbclass: use d.appendVar instead of d.setVar for SDK_TOOLCHAIN variable Srinuvasan Arjunan
2023-05-22  5:16 ` Jan Kiszka
2023-05-22  5:54   ` Jan Kiszka
2023-05-25  4:53     ` Srinuvasan Arjunan
2023-05-25 10:20       ` Jan Kiszka
2023-05-26  9:03         ` Srinuvasan Arjunan
2023-06-04  9:32     ` [PATCH] meta/classes/crossvars: move sdk toolchain selection from python block Srinuvasan Arjunan
2023-06-05  7:00       ` Jan Kiszka
2023-06-05  7:07         ` Srinuvasan Arjunan
2023-06-05  7:18           ` Jan Kiszka
2023-06-05  7:43             ` Srinuvasan Arjunan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox