All of lore.kernel.org
 help / color / mirror / Atom feed
* [meta-ti-bsp] [PATCH] ti-localversion.bbclass: introduce bbclass
@ 2023-05-30 18:09 liu.ming50
  2023-05-30 18:11 ` [meta-ti] " Ryan Eatmon
  0 siblings, 1 reply; 3+ messages in thread
From: liu.ming50 @ 2023-05-30 18:09 UTC (permalink / raw)
  To: meta-ti; +Cc: max.krummenacher, francesco.dolcini, Ming Liu

From: Ming Liu <liu.ming50@gmail.com>

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/20230530170949.12045-1-liu.ming50@gmail.com/

to make KERNEL_LOCALVERSION to be a standard OE variable, just like how
UBOOT_LOCALVERSION being handled in OE.

Signed-off-by: Ming Liu <liu.ming50@gmail.com>
---
 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
-- 
2.25.1



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

* Re: [meta-ti] [meta-ti-bsp] [PATCH] ti-localversion.bbclass: introduce bbclass
  2023-05-30 18:09 [meta-ti-bsp] [PATCH] ti-localversion.bbclass: introduce bbclass liu.ming50
@ 2023-05-30 18:11 ` Ryan Eatmon
  2023-05-30 18:13   ` Ming Liu
  0 siblings, 1 reply; 3+ messages in thread
From: Ryan Eatmon @ 2023-05-30 18:11 UTC (permalink / raw)
  To: Ming Liu, meta-ti; +Cc: max.krummenacher, francesco.dolcini



On 5/30/2023 1:09 PM, Ming Liu wrote:
> From: Ming Liu <liu.ming50@gmail.com>
> 
> 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/20230530170949.12045-1-liu.ming50@gmail.com/
> 
> 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 <liu.ming50@gmail.com>
> ---
>   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
> 
> 
> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#16628): https://lists.yoctoproject.org/g/meta-ti/message/16628
> Mute This Topic: https://lists.yoctoproject.org/mt/99225679/6551054
> Group Owner: meta-ti+owner@lists.yoctoproject.org
> Unsubscribe: https://lists.yoctoproject.org/g/meta-ti/unsub [reatmon@ti.com]
> -=-=-=-=-=-=-=-=-=-=-=-
> 

-- 
Ryan Eatmon                reatmon@ti.com
-----------------------------------------
Texas Instruments, Inc.  -  LCPD  -  MGTS


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

* Re: [meta-ti] [meta-ti-bsp] [PATCH] ti-localversion.bbclass: introduce bbclass
  2023-05-30 18:11 ` [meta-ti] " Ryan Eatmon
@ 2023-05-30 18:13   ` Ming Liu
  0 siblings, 0 replies; 3+ messages in thread
From: Ming Liu @ 2023-05-30 18:13 UTC (permalink / raw)
  To: Ryan Eatmon; +Cc: meta-ti, max.krummenacher, francesco.dolcini

[-- Attachment #1: Type: text/plain, Size: 5499 bytes --]

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 <reatmon@ti.com> 於 2023年5月30日 週二 下午8:11寫道:

>
>
> On 5/30/2023 1:09 PM, Ming Liu wrote:
> > From: Ming Liu <liu.ming50@gmail.com>
> >
> > 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/20230530170949.12045-1-liu.ming50@gmail.com/
> >
> > 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 <liu.ming50@gmail.com>
> > ---
> >   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
> >
> >
> >
> > -=-=-=-=-=-=-=-=-=-=-=-
> > Links: You receive all messages sent to this group.
> > View/Reply Online (#16628):
> https://lists.yoctoproject.org/g/meta-ti/message/16628
> > Mute This Topic: https://lists.yoctoproject.org/mt/99225679/6551054
> > Group Owner: meta-ti+owner@lists.yoctoproject.org
> > Unsubscribe: https://lists.yoctoproject.org/g/meta-ti/unsub [
> reatmon@ti.com]
> > -=-=-=-=-=-=-=-=-=-=-=-
> >
>
> --
> Ryan Eatmon                reatmon@ti.com
> -----------------------------------------
> Texas Instruments, Inc.  -  LCPD  -  MGTS
>

[-- Attachment #2: Type: text/html, Size: 7609 bytes --]

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

end of thread, other threads:[~2023-05-30 18:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-30 18:09 [meta-ti-bsp] [PATCH] ti-localversion.bbclass: introduce bbclass liu.ming50
2023-05-30 18:11 ` [meta-ti] " Ryan Eatmon
2023-05-30 18:13   ` Ming Liu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.