From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7235862407233404928 Date: Mon, 5 Jun 2023 00:07:54 -0700 (PDT) From: Srinuvasan Arjunan To: isar-users Message-Id: <3f742bff-1ccd-4a88-8c96-8cab068b8eb4n@googlegroups.com> In-Reply-To: <78f99600-592a-b3c3-7fee-791e2116abdf@siemens.com> References: <46a03938-0343-4221-a57c-efba80b27c83@siemens.com> <20230604093216.1094289-1-srinuvasan_a@mentor.com> <78f99600-592a-b3c3-7fee-791e2116abdf@siemens.com> Subject: Re: [PATCH] meta/classes/crossvars: move sdk toolchain selection from python block MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_12046_1719731813.1685948874859" X-TUID: 5QHQKbGgcEn8 ------=_Part_12046_1719731813.1685948874859 Content-Type: multipart/alternative; boundary="----=_Part_12047_1860008882.1685948874859" ------=_Part_12047_1860008882.1685948874859 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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. https://github.com/ilbers/isar/commit/43f402f4862c3779a492c50a26475ea1221a2= b01 Now in present implementation comapt-arch override was removed and this=20 selection of compat will be handled by ISAR_ENABLE_COMPAT_ARCH=20 Thanks, Srinu On Monday, June 5, 2023 at 12:31:01=E2=80=AFPM UTC+5:30 Jan Kiszka wrote: > On 04.06.23 11:32, Srinuvasan Arjunan wrote: > > From: Srinuvasan A > >=20 > > 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. > >=20 > > Anonymous python functions always run at the end of parsing, regardless= =20 > of where they are defined > > even when we do override in our recipe, always wins the Anonymous Pytho= n > > functions variable settings, hence we are not able to override our > > downstream toolchain. > >=20 > > Move the SDK toolchian selection from python block, now we can able to > > override from downstream layer. > >=20 > > Signed-off-by: Srinuvasan A > > --- > > meta/classes/crossvars.bbclass | 9 ++++----- > > 1 file changed, 4 insertions(+), 5 deletions(-) > >=20 > > diff --git a/meta/classes/crossvars.bbclass=20 > 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" > >=20 > > inherit compat > >=20 > > +SDK_TOOLCHAIN =3D "${@'build-essential' if d.getVar('ISAR_CROSS_COMPIL= E')=20 > =3D=3D '0' or d.getVar('HOST_ARCH') =3D=3D d.getVar('DISTRO_ARCH') or=20 > d.getVar('DISTRO_ARCH') =3D=3D None else 'crossbuild-essential-${DISTRO_A= RCH}'}" > > + > > +SDK_TOOLCHAIN:append =3D "${@'=20 > crossbuild-essential-${COMPAT_DISTRO_ARCH}' if isar_can_build_compat(d)= =20 > 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 =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', False) > > buildchroot_dep =3D "buildchroot-host:do_build" > > - sdk_toolchain =3D "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 +=3D " crossbuild-essential-" +=20 > d.getVar('COMPAT_DISTRO_ARCH') > > - d.setVar('SDK_TOOLCHAIN', sdk_toolchain) > > } > > --=20 > Siemens AG, Technology > Competence Center Embedded Linux > > ------=_Part_12047_1860008882.1685948874859 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable Yes tested working fine, here i do the append overrides in downstream layer= , like how the previous implementation before things move into the python b= lock.

https://github.com/ilbers/isar/commit/43f402f486= 2c3779a492c50a26475ea1221a2b01

Now in present im= plementation comapt-arch override was removed and this selection of compat = will be handled by=C2=A0 ISAR_ENABLE_COMPAT_ARCH

Thanks,
Srinu=

On Monday, June 5, 2023 at 12:31:01=E2=80=AFPM = UTC+5:30 Jan Kiszka wrote:
On 04.06.23 11:32, Srinuvasan Arjunan wrote:
> From: Srinuvasan A <= srinuv...@siemens.com>
>=20
> 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.
>=20
> Anonymous python functions always run at the end of parsing, regar= dless 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.
>=20
> Move the SDK toolchian selection from python block, now we can abl= e to
> override from downstream layer.
>=20
> Signed-off-by: Srinuvasan A <srinuv...@siemens.com>
> ---
> meta/classes/crossvars.bbclass | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>=20
> diff --git a/meta/classes/crossvars.bbclass b/meta/classes/crossva= rs.bbclass
> index 201d460..120e6d1 100644
> --- a/meta/classes/crossvars.bbclass
> +++ b/meta/classes/crossvars.bbclass
> @@ -5,6 +5,10 @@ ISAR_CROSS_COMPILE ??=3D "0"
> =20
> inherit compat
> =20
> +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&= #39;) =3D=3D None else 'crossbuild-essential-${DISTRO_ARCH}'}"
> +
> +SDK_TOOLCHAIN:append =3D "${@' crossbuild-essential-${CO= MPAT_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()).p= w_name)
> @@ -17,19 +21,14 @@ python __anonymous() {
> sbuild_dep =3D "sbuild-chroot-target:do_build"
> buildchroot_dir =3D d.getVar('BUILDCHROOT_TARGET_DIR&= #39;, False)
> buildchroot_dep =3D "buildchroot-target:do_build&quo= t;
> - sdk_toolchain =3D "build-essential"
> else:
> d.setVar('BUILD_HOST_ARCH', d.getVar('HOST_AR= CH'))
> schroot_dir =3D d.getVar('SCHROOT_HOST_DIR', Fals= e)
> sbuild_dep =3D "sbuild-chroot-host:do_build"
> buildchroot_dir =3D d.getVar('BUILDCHROOT_HOST_DIR= 9;, False)
> buildchroot_dep =3D "buildchroot-host:do_build"
> - sdk_toolchain =3D "crossbuild-essential-" + dis= tro_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 +=3D " crossbuild-essential-" + d= .getVar('COMPAT_DISTRO_ARCH')
> - d.setVar('SDK_TOOLCHAIN', sdk_toolchain)
> }

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

------=_Part_12047_1860008882.1685948874859-- ------=_Part_12046_1719731813.1685948874859--