Hi, Ryan:

Thanks for the quick reply.

Arha, I did not see that MR, just subscribed this mail list today.

Yes exactly, UBOOT_LOCALVERSION has the same problem, it's also handled in
this patch.

the best,
thank you

Ryan Eatmon <[email protected]> 於 2023年5月30日 週二 下午8:11寫道:

>
>
> On 5/30/2023 1:09 PM, Ming Liu wrote:
> > From: Ming Liu <[email protected]>
> >
> > An error was observed as follows:
> > ERROR: ExpansionError during parsing
> .../meta-ti/meta-ti-bsp/recipes-kernel/linux/
> linux-ti-staging-systest_5.10.bb
> > Traceback (most recent call last):
> >    File "Var <KERNEL_LOCALVERSION>", line 1, in <module>
> >    File ".../openembedded-core/bitbake/lib/bb/fetch2/__init__.py", line
> 788, in get_srcrev(d=<bb.data_smart.DataSmart object at 0x7fe9da2f0c70>,
> method_name='sortable_revision'):
> >           if not scms:
> >      >        raise FetchError("SRCREV was used yet no valid SCM was
> found in SRC_URI")
> >
> > with the latest bitbake on commit: 893f3b116b6
> > [ fetch2/npm: evaluate PATH before patching HOME ]
> >
> > the root cause is the variable SRCPV could not be expanded during
> > recipe parsing stage due to some uri variables in bitbake being unset.
> >
> > Insteadly, it has to be expanded in recipe finializing stage, let's
> > introduce a RecipeParsed event handler to set it.
> >
> > We need set UBOOT_LOCALVERSION in this handler as well, because that
> > has the same problem.
> >
> > Meanwhile, I have sent a patch to OE:
> >
> https://patchwork.yoctoproject.org/project/oe-core/patch/[email protected]/
> >
> > to make KERNEL_LOCALVERSION to be a standard OE variable, just like how
> > UBOOT_LOCALVERSION being handled in OE.
>
> Sadly, UBOOT_LOCALVERSION has the same error.  It's just random which
> one presents itself as the parser error.  We already have a patch from
> Denys that addresses this, I'm looking at it now.
>
>
> > Signed-off-by: Ming Liu <[email protected]>
> > ---
> >   meta-ti-bsp/classes/ti-localversion.bbclass       | 15 +++++++++++++++
> >   meta-ti-bsp/recipes-bsp/u-boot/u-boot-ti.inc      |  8 +++-----
> >   .../recipes-kernel/linux/setup-defconfig.inc      |  4 +---
> >   3 files changed, 19 insertions(+), 8 deletions(-)
> >   create mode 100644 meta-ti-bsp/classes/ti-localversion.bbclass
> >
> > diff --git a/meta-ti-bsp/classes/ti-localversion.bbclass
> b/meta-ti-bsp/classes/ti-localversion.bbclass
> > new file mode 100644
> > index 00000000..6e7246af
> > --- /dev/null
> > +++ b/meta-ti-bsp/classes/ti-localversion.bbclass
> > @@ -0,0 +1,15 @@
> > +# Helper class to append a string to the name of the local version of
> kernel/uboot images.
> > +
> > +# Take 'KERNEL', 'UBOOT', set 'KERNEL_LOCALVERSION' and
> 'UBOOT_LOCALVERSION' accordingly
> > +LOCALVERSION_VAR ??= "KERNEL"
> > +
> > +python localversion_handler () {
> > +    import bb.event
> > +
> > +    if isinstance(e, bb.event.RecipeParsed):
> > +        srcpv = bb.fetch2.get_srcrev(e.data)
> > +        e.data.setVar('%s_LOCALVERSION' %
> e.data.getVar('LOCALVERSION_VAR'), "-g%s" %
> srcpv.replace('AUTOINC+','')[:10])
> > +}
> > +
> > +addhandler localversion_handler
> > +localversion_handler[eventmask] = "bb.event.RecipeParsed"
> > diff --git a/meta-ti-bsp/recipes-bsp/u-boot/u-boot-ti.inc
> b/meta-ti-bsp/recipes-bsp/u-boot/u-boot-ti.inc
> > index 8e236dfe..2f461ad4 100644
> > --- a/meta-ti-bsp/recipes-bsp/u-boot/u-boot-ti.inc
> > +++ b/meta-ti-bsp/recipes-bsp/u-boot/u-boot-ti.inc
> > @@ -1,7 +1,3 @@
> > -# UBOOT_LOCALVERSION can be set to add a tag to the end of the
> > -# U-boot version string.  such as the commit id
> > -UBOOT_LOCALVERSION = "-g${@d.getVar('SRCPV',
> True).replace('AUTOINC+','')[:10]}"
> > -
> >   UBOOT_SUFFIX ?= "img"
> >   SPL_BINARY ?= "MLO"
> >
> > @@ -61,7 +57,9 @@ PKG:${PN}-dbg = "u-boot-dbg"
> >   S = "${WORKDIR}/git"
> >
> >   # Support for secure devices - detailed info is in doc/README.ti-secure
> > -inherit ti-secdev
> > +inherit ti-secdev ti-localversion
> > +
> > +LOCALVERSION_VAR = "UBOOT"
> >
> >   SYSROOT_DIRS += "/boot"
> >
> > diff --git a/meta-ti-bsp/recipes-kernel/linux/setup-defconfig.inc
> b/meta-ti-bsp/recipes-kernel/linux/setup-defconfig.inc
> > index df7d9ac8..2db2bb84 100644
> > --- a/meta-ti-bsp/recipes-kernel/linux/setup-defconfig.inc
> > +++ b/meta-ti-bsp/recipes-kernel/linux/setup-defconfig.inc
> > @@ -1,6 +1,4 @@
> > -# KERNEL_LOCALVERSION can be set to add a tag to the end of the
> > -# kernel version string.  such as the commit id
> > -KERNEL_LOCALVERSION = "-g${@d.getVar('SRCPV',
> True).replace('AUTOINC+','')[:10]}"
> > +inherit ti-localversion
> >
> >   # Check the defconfig file and see if it points to an in kernel
> >   # defconfig that should be used, or if it is a complete config file
> >
> >
> >
> > 
> >
>
> --
> Ryan Eatmon                [email protected]
> -----------------------------------------
> Texas Instruments, Inc.  -  LCPD  -  MGTS
>
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#16631): 
https://lists.yoctoproject.org/g/meta-ti/message/16631
Mute This Topic: https://lists.yoctoproject.org/mt/99225679/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-ti/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to