diff mbox series

[kirkstone] externalsrc: Ensure SRCREV is processed before accessing SRC_URI

Message ID 20231207223258.3273718-1-yoann.congal@smile.fr
State Accepted, archived
Commit f6563cca6c4bf627e904d81fbe5b0b0f2b16a107
Headers show
Series [kirkstone] externalsrc: Ensure SRCREV is processed before accessing SRC_URI | expand

Commit Message

Yoann Congal Dec. 7, 2023, 10:32 p.m. UTC
Call bb.fetch.get_srcrev() before accessing SRC_URI. Without this new
bb.fetch.get_srcrev() call, SRC_URI might be accessed before SRCREV had
a chance to be processed.

In master, this is fixed by https://git.yoctoproject.org/poky/commit/?id=62afa02d01794376efab75623f42e7e08af08526
However, this commit is not suited for backport since it is quite invasive.
The part of the commit that fix the bug is:
    --- a/meta/classes/externalsrc.bbclass
    +++ b/meta/classes/externalsrc.bbclass
    @@ -63,6 +63,7 @@ python () {
             else:
                 d.setVar('B', '${WORKDIR}/${BPN}-${PV}')

    +        bb.fetch.get_hashvalue(d)
             local_srcuri = []
             fetch = bb.fetch2.Fetch((d.getVar('SRC_URI') or '').split(), d)
             for url in fetch.urls:

NB: bb.fetch.get_hashvalue() does not exist in kirkstone but is
equivalent to bb.fetch.get_srcrev().

Fixes [YOCTO #14918]

Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
Suggested-by: Chris Wyse <chris.wyse@wysechoice.net>
---
Richard, Steve: This is the commit we discussed at today's bug triage.
---
 meta/classes/externalsrc.bbclass | 3 +++
 1 file changed, 3 insertions(+)

Comments

Steve Sakoman Dec. 14, 2023, 4:24 p.m. UTC | #1
This patch resulted in oe-seftest failures on the autobuilder:

https://autobuilder.yoctoproject.org/typhoon/#/builders/83/builds/6322

A representative log:

https://errors.yoctoproject.org/Errors/Details/746003/

Steve

On Thu, Dec 7, 2023 at 12:33 PM Yoann Congal <yoann.congal@smile.fr> wrote:
>
> Call bb.fetch.get_srcrev() before accessing SRC_URI. Without this new
> bb.fetch.get_srcrev() call, SRC_URI might be accessed before SRCREV had
> a chance to be processed.
>
> In master, this is fixed by https://git.yoctoproject.org/poky/commit/?id=62afa02d01794376efab75623f42e7e08af08526
> However, this commit is not suited for backport since it is quite invasive.
> The part of the commit that fix the bug is:
>     --- a/meta/classes/externalsrc.bbclass
>     +++ b/meta/classes/externalsrc.bbclass
>     @@ -63,6 +63,7 @@ python () {
>              else:
>                  d.setVar('B', '${WORKDIR}/${BPN}-${PV}')
>
>     +        bb.fetch.get_hashvalue(d)
>              local_srcuri = []
>              fetch = bb.fetch2.Fetch((d.getVar('SRC_URI') or '').split(), d)
>              for url in fetch.urls:
>
> NB: bb.fetch.get_hashvalue() does not exist in kirkstone but is
> equivalent to bb.fetch.get_srcrev().
>
> Fixes [YOCTO #14918]
>
> Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
> Suggested-by: Chris Wyse <chris.wyse@wysechoice.net>
> ---
> Richard, Steve: This is the commit we discussed at today's bug triage.
> ---
>  meta/classes/externalsrc.bbclass | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass
> index 97d7379d9f..eb6afca4ab 100644
> --- a/meta/classes/externalsrc.bbclass
> +++ b/meta/classes/externalsrc.bbclass
> @@ -62,6 +62,9 @@ python () {
>          else:
>              d.setVar('B', '${WORKDIR}/${BPN}-${PV}')
>
> +        # Ensure SRCREV has been processed before accessing SRC_URI
> +        bb.fetch.get_srcrev(d)
> +
>          local_srcuri = []
>          fetch = bb.fetch2.Fetch((d.getVar('SRC_URI') or '').split(), d)
>          for url in fetch.urls:
> --
> 2.30.2
>
Yoann Congal Dec. 14, 2023, 9:50 p.m. UTC | #2
Le 14/12/2023 à 17:24, Steve Sakoman a écrit :
> This patch resulted in oe-seftest failures on the autobuilder:
> 
> https://autobuilder.yoctoproject.org/typhoon/#/builders/83/builds/6322
> 
> A representative log:
> 
> https://errors.yoctoproject.org/Errors/Details/746003/

Thanks Steve!

Good news, I can reproduce this locally and easily:
  oe-selftest -r devtool.DevtoolUpdateTests.test_devtool_update_recipe_local_files_subdir -T machine -T toolchain-user -T toolchain-system -j 15

I've commented this on the bug: https://bugzilla.yoctoproject.org/show_bug.cgi?id=14918#c7

I'll look into this.

> Steve
> 
> On Thu, Dec 7, 2023 at 12:33 PM Yoann Congal <yoann.congal@smile.fr> wrote:
>>
>> Call bb.fetch.get_srcrev() before accessing SRC_URI. Without this new
>> bb.fetch.get_srcrev() call, SRC_URI might be accessed before SRCREV had
>> a chance to be processed.
>>
>> In master, this is fixed by https://git.yoctoproject.org/poky/commit/?id=62afa02d01794376efab75623f42e7e08af08526
>> However, this commit is not suited for backport since it is quite invasive.
>> The part of the commit that fix the bug is:
>>     --- a/meta/classes/externalsrc.bbclass
>>     +++ b/meta/classes/externalsrc.bbclass
>>     @@ -63,6 +63,7 @@ python () {
>>              else:
>>                  d.setVar('B', '${WORKDIR}/${BPN}-${PV}')
>>
>>     +        bb.fetch.get_hashvalue(d)
>>              local_srcuri = []
>>              fetch = bb.fetch2.Fetch((d.getVar('SRC_URI') or '').split(), d)
>>              for url in fetch.urls:
>>
>> NB: bb.fetch.get_hashvalue() does not exist in kirkstone but is
>> equivalent to bb.fetch.get_srcrev().
>>
>> Fixes [YOCTO #14918]
>>
>> Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
>> Suggested-by: Chris Wyse <chris.wyse@wysechoice.net>
>> ---
>> Richard, Steve: This is the commit we discussed at today's bug triage.
>> ---
>>  meta/classes/externalsrc.bbclass | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass
>> index 97d7379d9f..eb6afca4ab 100644
>> --- a/meta/classes/externalsrc.bbclass
>> +++ b/meta/classes/externalsrc.bbclass
>> @@ -62,6 +62,9 @@ python () {
>>          else:
>>              d.setVar('B', '${WORKDIR}/${BPN}-${PV}')
>>
>> +        # Ensure SRCREV has been processed before accessing SRC_URI
>> +        bb.fetch.get_srcrev(d)
>> +
>>          local_srcuri = []
>>          fetch = bb.fetch2.Fetch((d.getVar('SRC_URI') or '').split(), d)
>>          for url in fetch.urls:
>> --
>> 2.30.2
>>
Yoann Congal Dec. 15, 2023, 9:25 p.m. UTC | #3
Le 14/12/2023 à 22:50, Yoann Congal a écrit :
> Le 14/12/2023 à 17:24, Steve Sakoman a écrit :
>> This patch resulted in oe-seftest failures on the autobuilder:
>>
>> https://autobuilder.yoctoproject.org/typhoon/#/builders/83/builds/6322
>>
>> A representative log:
>>
>> https://errors.yoctoproject.org/Errors/Details/746003/
> 
> Thanks Steve!
> 
> Good news, I can reproduce this locally and easily:
>   oe-selftest -r devtool.DevtoolUpdateTests.test_devtool_update_recipe_local_files_subdir -T machine -T toolchain-user -T toolchain-system -j 15
> 
> I've commented this on the bug: https://bugzilla.yoctoproject.org/show_bug.cgi?id=14918#c7
> 
> I'll look into this.

V2 sent => https://lists.openembedded.org/g/openembedded-core/message/192547
I've tested that it passes my bug reproducer AND all the previously failing self-tests (I did not test beyond that though)

>> Steve
>>
>> On Thu, Dec 7, 2023 at 12:33 PM Yoann Congal <yoann.congal@smile.fr> wrote:
>>>
>>> Call bb.fetch.get_srcrev() before accessing SRC_URI. Without this new
>>> bb.fetch.get_srcrev() call, SRC_URI might be accessed before SRCREV had
>>> a chance to be processed.
>>>
>>> In master, this is fixed by https://git.yoctoproject.org/poky/commit/?id=62afa02d01794376efab75623f42e7e08af08526
>>> However, this commit is not suited for backport since it is quite invasive.
>>> The part of the commit that fix the bug is:
>>>     --- a/meta/classes/externalsrc.bbclass
>>>     +++ b/meta/classes/externalsrc.bbclass
>>>     @@ -63,6 +63,7 @@ python () {
>>>              else:
>>>                  d.setVar('B', '${WORKDIR}/${BPN}-${PV}')
>>>
>>>     +        bb.fetch.get_hashvalue(d)
>>>              local_srcuri = []
>>>              fetch = bb.fetch2.Fetch((d.getVar('SRC_URI') or '').split(), d)
>>>              for url in fetch.urls:
>>>
>>> NB: bb.fetch.get_hashvalue() does not exist in kirkstone but is
>>> equivalent to bb.fetch.get_srcrev().
>>>
>>> Fixes [YOCTO #14918]
>>>
>>> Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
>>> Suggested-by: Chris Wyse <chris.wyse@wysechoice.net>
>>> ---
>>> Richard, Steve: This is the commit we discussed at today's bug triage.
>>> ---
>>>  meta/classes/externalsrc.bbclass | 3 +++
>>>  1 file changed, 3 insertions(+)
>>>
>>> diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass
>>> index 97d7379d9f..eb6afca4ab 100644
>>> --- a/meta/classes/externalsrc.bbclass
>>> +++ b/meta/classes/externalsrc.bbclass
>>> @@ -62,6 +62,9 @@ python () {
>>>          else:
>>>              d.setVar('B', '${WORKDIR}/${BPN}-${PV}')
>>>
>>> +        # Ensure SRCREV has been processed before accessing SRC_URI
>>> +        bb.fetch.get_srcrev(d)
>>> +
>>>          local_srcuri = []
>>>          fetch = bb.fetch2.Fetch((d.getVar('SRC_URI') or '').split(), d)
>>>          for url in fetch.urls:
>>> --
>>> 2.30.2
>>>
>
diff mbox series

Patch

diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass
index 97d7379d9f..eb6afca4ab 100644
--- a/meta/classes/externalsrc.bbclass
+++ b/meta/classes/externalsrc.bbclass
@@ -62,6 +62,9 @@  python () {
         else:
             d.setVar('B', '${WORKDIR}/${BPN}-${PV}')
 
+        # Ensure SRCREV has been processed before accessing SRC_URI
+        bb.fetch.get_srcrev(d)
+
         local_srcuri = []
         fetch = bb.fetch2.Fetch((d.getVar('SRC_URI') or '').split(), d)
         for url in fetch.urls: