diff mbox series

[1/1] base.bbclass: Fix the recipe parsing race issue

Message ID 20250814172348.3882586-2-tony.rex@ericsson.com
State New
Headers show
Series base.bbclass: Fix the recipe parsing race issue | expand

Commit Message

Tony Rex Aug. 14, 2025, 5:23 p.m. UTC
There seems to be some settings that are not done in time in
base.bbclass when setting up the do_fetch function which leads
to parsing issues of the recipes:

bb.data_smart.ExpansionError: Failure expanding variable
fetcher_hashes_dummyfunc[vardepvalue]

Also by fixing the build error the floating tag/branch build error
is taking effect again:
FetchError("Recipe uses a floating tag/branch

Signed-off-by: Tony Rex <tony.rex@ericsson.com>
---
 meta/classes-global/base.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alexander Kanavin Aug. 15, 2025, 9:04 a.m. UTC | #1
I don't understand. Does this patch trigger the fail or fix it? If it
fixes the fail, how can the fail be observed?

Alex

On Thu, 14 Aug 2025 at 21:05, Tony Rex via lists.openembedded.org
<tony.rex=ericsson.com@lists.openembedded.org> wrote:
>
> There seems to be some settings that are not done in time in
> base.bbclass when setting up the do_fetch function which leads
> to parsing issues of the recipes:
>
> bb.data_smart.ExpansionError: Failure expanding variable
> fetcher_hashes_dummyfunc[vardepvalue]
>
> Also by fixing the build error the floating tag/branch build error
> is taking effect again:
> FetchError("Recipe uses a floating tag/branch
>
> Signed-off-by: Tony Rex <tony.rex@ericsson.com>
> ---
>  meta/classes-global/base.bbclass | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/meta/classes-global/base.bbclass b/meta/classes-global/base.bbclass
> index 6be1f5c2df..c955bb861f 100644
> --- a/meta/classes-global/base.bbclass
> +++ b/meta/classes-global/base.bbclass
> @@ -147,7 +147,7 @@ def setup_hosttools_dir(dest, toolsvar, d, fatal=True):
>  python fetcher_hashes_dummyfunc() {
>      return
>  }
> -fetcher_hashes_dummyfunc[vardepvalue] = "${@bb.fetch.get_hashvalue(d)}"
> +fetcher_hashes_dummyfunc[vardepvalue] := "${@bb.fetch.get_hashvalue(d)}"
>
>  addtask fetch
>  do_fetch[dirs] = "${DL_DIR}"
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#221870): https://lists.openembedded.org/g/openembedded-core/message/221870
> Mute This Topic: https://lists.openembedded.org/mt/114706198/1686489
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Tony Rex Aug. 15, 2025, 12:18 p.m. UTC | #2
Hi Alex!

It fixes the faulty parsing and resolving variables in recipes and as a side effect the floating tag/branch protection is working as intended again.

I put the verification of the floating tag/branch and a way to test it in the cover-letter ( [PATCH 0/1] base.bbclass: Fix the recipe parsing race issue):

It seems that the race condition happens when doing do_fetch on really small repos and it can be difficult to reproduce so below the other case with floating tag/branch that is easier to verify.

To verify the floating tag/branch issue have s simple recipe hello_1.0.bb and set the SRC_URI to SRC_URI = "git://<repository>;protocol=https;user=${USER};branch=master;tag=v1.0"

run command bitbake hello everything builds.
 
Apply the patch

run command bitbake hello
ERROR: hello-1.0-r1 do_fetch: Bitbake Fetcher Error: FetchError("Recipe uses a floating tag/branch 'v1.0' for repo '<repository>' without a fixed SRCREV yet doesn't call bb.fetch2.get_srcrev() (use SRCPV in PV for OE).", None)
ERROR: Logfile of failure stored in: hello/1.0/temp/log.do_fetch.3289932
ERROR: Task (hello/hello_1.0.bb:do_fetch) failed with exit code '1'

 Tony

-----Original Message-----
From: Alexander Kanavin <alex.kanavin@gmail.com> 
Sent: Friday, 15 August 2025 11:05
To: Tony Rex <tony.rex@ericsson.com>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [OE-core] [PATCH 1/1] base.bbclass: Fix the recipe parsing race issue

[You don't often get email from alex.kanavin@gmail.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

I don't understand. Does this patch trigger the fail or fix it? If it fixes the fail, how can the fail be observed?

Alex

On Thu, 14 Aug 2025 at 21:05, Tony Rex via lists.openembedded.org <tony.rex=ericsson.com@lists.openembedded.org> wrote:
>
> There seems to be some settings that are not done in time in 
> base.bbclass when setting up the do_fetch function which leads to 
> parsing issues of the recipes:
>
> bb.data_smart.ExpansionError: Failure expanding variable 
> fetcher_hashes_dummyfunc[vardepvalue]
>
> Also by fixing the build error the floating tag/branch build error is 
> taking effect again:
> FetchError("Recipe uses a floating tag/branch
>
> Signed-off-by: Tony Rex <tony.rex@ericsson.com>
> ---
>  meta/classes-global/base.bbclass | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/meta/classes-global/base.bbclass 
> b/meta/classes-global/base.bbclass
> index 6be1f5c2df..c955bb861f 100644
> --- a/meta/classes-global/base.bbclass
> +++ b/meta/classes-global/base.bbclass
> @@ -147,7 +147,7 @@ def setup_hosttools_dir(dest, toolsvar, d, fatal=True):
>  python fetcher_hashes_dummyfunc() {
>      return
>  }
> -fetcher_hashes_dummyfunc[vardepvalue] = "${@bb.fetch.get_hashvalue(d)}"
> +fetcher_hashes_dummyfunc[vardepvalue] := "${@bb.fetch.get_hashvalue(d)}"
>
>  addtask fetch
>  do_fetch[dirs] = "${DL_DIR}"
>
> 
>
diff mbox series

Patch

diff --git a/meta/classes-global/base.bbclass b/meta/classes-global/base.bbclass
index 6be1f5c2df..c955bb861f 100644
--- a/meta/classes-global/base.bbclass
+++ b/meta/classes-global/base.bbclass
@@ -147,7 +147,7 @@  def setup_hosttools_dir(dest, toolsvar, d, fatal=True):
 python fetcher_hashes_dummyfunc() {
     return
 }
-fetcher_hashes_dummyfunc[vardepvalue] = "${@bb.fetch.get_hashvalue(d)}"
+fetcher_hashes_dummyfunc[vardepvalue] := "${@bb.fetch.get_hashvalue(d)}"
 
 addtask fetch
 do_fetch[dirs] = "${DL_DIR}"