From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7235862407233404928 Date: Mon, 5 Jun 2023 00:43:14 -0700 (PDT) From: Srinuvasan Arjunan To: isar-users Message-Id: In-Reply-To: References: <46a03938-0343-4221-a57c-efba80b27c83@siemens.com> <20230604093216.1094289-1-srinuvasan_a@mentor.com> <78f99600-592a-b3c3-7fee-791e2116abdf@siemens.com> <3f742bff-1ccd-4a88-8c96-8cab068b8eb4n@googlegroups.com> Subject: Re: [PATCH] meta/classes/crossvars: move sdk toolchain selection from python block MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_19228_45010774.1685950994278" X-TUID: ZN7NePtErrMU ------=_Part_19228_45010774.1685950994278 Content-Type: multipart/alternative; boundary="----=_Part_19229_392813781.1685950994279" ------=_Part_19229_392813781.1685950994279 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Monday, June 5, 2023 at 12:48:34=E2=80=AFPM UTC+5:30 Jan Kiszka wrote: On 05.06.23 09:07, Srinuvasan Arjunan wrote:=20 > Yes tested working fine, here i do the append overrides in downstream=20 > layer, like how the previous implementation before things move into the= =20 > python block.=20 >=20 >=20 https://github.com/ilbers/isar/commit/43f402f4862c3779a492c50a26475ea1221a2= b01=20 >=20 > Now in present implementation comapt-arch override was removed and this= =20 > selection of compat will be handled by ISAR_ENABLE_COMPAT_ARCH=20 So, d.setVar blocks :append and :remove, right? yes, correct.=20 You don't want to set it=20 downstream completely?=20 But I dislike this long inline python, specifically as we already have=20 the logic more readable. How about using an intermediate variable then=20 which is defined in the anonymous python block while SDK_TOOLCHAIN gets=20 that value by default outside the block? We could do this way.=20 Or - to come back to your original issue - we make that use case of=20 multilib officially an SDK toolchain option so that you just need to=20 flip a switch, not fiddle with the internals of SDK_TOOLCHAIN. Yes , this also works , i will come back with more details.=20 Jan=20 >=20 > Thanks,=20 > Srinu=20 >=20 > On Monday, June 5, 2023 at 12:31:01=E2=80=AFPM UTC+5:30 Jan Kiszka wrote:= =20 >=20 > On 04.06.23 11:32, Srinuvasan Arjunan wrote:=20 > > From: Srinuvasan A =20 > >=20 > > In the present implementation we are not able to override the SDK=20 > > toolchain from downstream layer, this is due to the SDK toolchain=20 > > selection part in anonymous python function.=20 > >=20 > > Anonymous python functions always run at the end of parsing,=20 > regardless of where they are defined=20 > > even when we do override in our recipe, always wins the Anonymous=20 > Python=20 > > functions variable settings, hence we are not able to override our=20 > > downstream toolchain.=20 > >=20 > > Move the SDK toolchian selection from python block, now we can=20 > able to=20 > > override from downstream layer.=20 > >=20 > > Signed-off-by: Srinuvasan A =20 > > ---=20 > > meta/classes/crossvars.bbclass | 9 ++++-----=20 > > 1 file changed, 4 insertions(+), 5 deletions(-)=20 > >=20 > > diff --git a/meta/classes/crossvars.bbclass=20 > b/meta/classes/crossvars.bbclass=20 > > index 201d460..120e6d1 100644=20 > > --- a/meta/classes/crossvars.bbclass=20 > > +++ b/meta/classes/crossvars.bbclass=20 > > @@ -5,6 +5,10 @@ ISAR_CROSS_COMPILE ??=3D "0"=20 > >=20 > > inherit compat=20 > >=20 > > +SDK_TOOLCHAIN =3D "${@'build-essential' if=20 > d.getVar('ISAR_CROSS_COMPILE') =3D=3D '0' or d.getVar('HOST_ARCH') =3D=3D= =20 > d.getVar('DISTRO_ARCH') or d.getVar('DISTRO_ARCH') =3D=3D None else=20 > 'crossbuild-essential-${DISTRO_ARCH}'}"=20 > > +=20 > > +SDK_TOOLCHAIN:append =3D "${@'=20 > crossbuild-essential-${COMPAT_DISTRO_ARCH}' if=20 > isar_can_build_compat(d) else ''}"=20 > > +=20 >=20 > This is still no weak assignment which you will need for overrides. Did= =20 > you actually test this? And, again, can't we implement the weak=20 > assignment in python below?=20 >=20 > Jan=20 >=20 > > python __anonymous() {=20 > > import pwd=20 > > d.setVar('SCHROOT_USER', pwd.getpwuid(os.geteuid()).pw_name)=20 > > @@ -17,19 +21,14 @@ python __anonymous() {=20 > > sbuild_dep =3D "sbuild-chroot-target:do_build"=20 > > buildchroot_dir =3D d.getVar('BUILDCHROOT_TARGET_DIR', False)=20 > > buildchroot_dep =3D "buildchroot-target:do_build"=20 > > - sdk_toolchain =3D "build-essential"=20 > > else:=20 > > d.setVar('BUILD_HOST_ARCH', d.getVar('HOST_ARCH'))=20 > > schroot_dir =3D d.getVar('SCHROOT_HOST_DIR', False)=20 > > sbuild_dep =3D "sbuild-chroot-host:do_build"=20 > > buildchroot_dir =3D d.getVar('BUILDCHROOT_HOST_DIR', False)=20 > > buildchroot_dep =3D "buildchroot-host:do_build"=20 > > - sdk_toolchain =3D "crossbuild-essential-" + distro_arch=20 > > d.setVar('SCHROOT_DIR', schroot_dir)=20 > > d.setVar('SCHROOT_DEP', sbuild_dep)=20 > > d.setVar('BUILDCHROOT_DIR', buildchroot_dir)=20 > > d.setVar('BUILDCHROOT_DEP', buildchroot_dep)=20 > > - if isar_can_build_compat(d):=20 > > - sdk_toolchain +=3D " crossbuild-essential-" +=20 > d.getVar('COMPAT_DISTRO_ARCH')=20 > > - d.setVar('SDK_TOOLCHAIN', sdk_toolchain)=20 > > }=20 >=20 > --=20 > Siemens AG, Technology=20 > Competence Center Embedded Linux=20 >=20 > --=20 > You received this message because you are subscribed to the Google=20 > Groups "isar-users" group.=20 > To unsubscribe from this group and stop receiving emails from it, send=20 > an email to isar-users+...@googlegroups.com=20 > .=20 > To view this discussion on the web visit=20 >=20 https://groups.google.com/d/msgid/isar-users/3f742bff-1ccd-4a88-8c96-8cab06= 8b8eb4n%40googlegroups.com=20 < https://groups.google.com/d/msgid/isar-users/3f742bff-1ccd-4a88-8c96-8cab06= 8b8eb4n%40googlegroups.com?utm_medium=3Demail&utm_source=3Dfooter>.=20 --=20 Siemens AG, Technology=20 Competence Center Embedded Linux=20 ------=_Part_19229_392813781.1685950994279 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable

On Monday, June 5, 2023 at 12:48:34=E2= =80=AFPM 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 downs= tream
> layer, like how the previous implementation before things move i= nto the
> python block.
>=20
> https://githu= b.com/ilbers/isar/commit/43f402f4862c3779a492c50a26475ea1221a2b01
>=20
> Now in present implementation comapt-arch override was removed a= nd this
> selection of compat will be handled by=C2=A0 ISAR_ENABLE_COMPAT_= ARCH

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

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0yes, correct.=C2=A0
You don't want to set it
downstream completely?

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

=C2=A0 We could do this way.=C2=A0


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.

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


Jan

>=20
> Thanks,
> Srinu
>=20
> On Monday, June 5, 2023 at 12:31:01=E2=80=AFPM UTC+5:30 Jan Kisz= ka wrote:
>=20
> On 04.06.23 11:32, Srinuvasan Arjunan wrote:
> > From: Srinuvasan A <sr= inuv...@siemens.com>
> >
> > In the present implementation we are not able to overri= de 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 par= sing,
> 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 o= verride 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 ??=3D "0"
> >
> > inherit compat
> >
> > +SDK_TOOLCHAIN =3D "${@'build-essential' if
> d.getVar('ISAR_CROSS_COMPILE') =3D=3D '0' or d.getVar('HOST_= ARCH') =3D=3D
> d.getVar('DISTRO_ARCH') or d.getVar('DISTRO_ARCH') =3D=3D No= ne else
> 'crossbuild-essential-${DISTRO_ARCH}'}"
> > +
> > +SDK_TOOLCHAIN:append =3D "${@'
> crossbuild-essential-${COMPAT_DISTRO_ARCH}' if
> isar_can_build_compat(d) else ''}"
> > +
>=20
> This is still no weak assignment which you will need for ove= rrides. Did
> you actually test this? And, again, can't we implement the w= eak
> assignment in python below?
>=20
> Jan
>=20
> > python __anonymous() {
> > import pwd
> > d.setVar('SCHROOT_USER', pwd.getpwuid(os.geteuid()).pw_= name)
> > @@ -17,19 +21,14 @@ python __anonymous() {
> > sbuild_dep =3D "sbuild-chroot-target:do_build"
> > buildchroot_dir =3D d.getVar('BUILDCHROOT_TARGET_DIR', = False)
> > buildchroot_dep =3D "buildchroot-target:do_build"
> > - sdk_toolchain =3D "build-essential"
> > else:
> > d.setVar('BUILD_HOST_ARCH', d.getVar('HOST_ARCH'))
> > schroot_dir =3D d.getVar('SCHROOT_HOST_DIR', False)
> > sbuild_dep =3D "sbuild-chroot-host:do_build"
> > buildchroot_dir =3D d.getVar('BUILDCHROOT_HOST_DIR', Fa= lse)
> > buildchroot_dep =3D "buildchroot-host:do_build"
> > - sdk_toolchain =3D "crossbuild-essential-" + distro_ar= ch
> > 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 +=3D " crossbuild-essential-" +
> d.getVar('COMPAT_DISTRO_ARCH')
> > - d.setVar('SDK_TOOLCHAIN', sdk_toolchain)
> > }
>=20
> --=20
> Siemens AG, Technology
> Competence Center Embedded Linux
>=20
> --=20
> You received this message because you are subscribed to the Goog= le
> Groups "isar-users" group.
> To unsubscribe from this group and stop receiving emails from it= , send
> an email to isar-users+...@googleg= roups.com
> <mailto:isar-users+...@googlegr= oups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/isar-users/3f742bff-1ccd-4a88-8= c96-8cab068b8eb4n%40googlegroups.com <https://groups.google.com/d/msgid/isar-users/3f742bff-1ccd-4a= 88-8c96-8cab068b8eb4n%40googlegroups.com?utm_medium=3Demail&utm_source= =3Dfooter>.

--=20
Siemens AG, Technology
Competence Center Embedded Linux

------=_Part_19229_392813781.1685950994279-- ------=_Part_19228_45010774.1685950994278--