this fails in linux-variscrite recipe from meta-variscite-bsp

https://snips.sh/f/9klGZxlCRE

On Tue, Dec 19, 2023 at 5:40 AM Etienne Cordonnier via
lists.openembedded.org <[email protected]>
wrote:
>
> Patch v4: use idempotent copy of the files instead of simply skipping the 
> code (see discussion under v2 of the patch).
>
> On Tue, Dec 19, 2023 at 2:38 PM Etienne Cordonnier via lists.openembedded.org 
> <[email protected]> wrote:
>>
>> From: Etienne Cordonnier <[email protected]>
>>
>> The function do_symlink_kernsrc is not reentrant in the case where S is 
>> defined
>> to a non-default value. This causes build-failures e.g. when building 
>> linux-yocto, then updating
>> poky to a commit which modifies kernel.bbclass, and then building 
>> linux-yocto again.
>>
>> Bugzilla: 
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__bugzilla.yoctoproject.org_show-5Fbug.cgi-3Fid-3D15325&d=DwIDAg&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=VB1zXAiE9q_CqM9DgoA0BbtloUxpQE_rQ7eqk7HGzBW9KzFu44K9hS1iahsqSuIk&s=9Cr8vwWgUwwGM5oCO07DB4sO9sQpMCdweS1u8CmZ0Qw&e=
>>
>> Tested with a recipe "my-custom-linux" which unpacks sources to a custom 
>> ${S} directory
>> and ran symlink_kernsrc several times:
>> $ bitbake -f -c symlink_kernsrc my-custom-linux
>>
>> Signed-off-by: Etienne Cordonnier <[email protected]>
>> ---
>>  meta/classes-recipe/kernel.bbclass | 8 +++++++-
>>  1 file changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/meta/classes-recipe/kernel.bbclass 
>> b/meta/classes-recipe/kernel.bbclass
>> index 9ff37f5c38..42c5519f81 100644
>> --- a/meta/classes-recipe/kernel.bbclass
>> +++ b/meta/classes-recipe/kernel.bbclass
>> @@ -189,11 +189,17 @@ python do_symlink_kernsrc () {
>>              # drop trailing slash, so that os.symlink(kernsrc, s) doesn't 
>> use s as
>>              # directory name and fail
>>              s = s[:-1]
>> -        if d.getVar("EXTERNALSRC"):
>> +        if d.getVar("EXTERNALSRC") and not os.path.islink(s):
>>              # With EXTERNALSRC S will not be wiped so we can symlink to it
>>              os.symlink(s, kernsrc)
>>          else:
>>              import shutil
>> +            # perform idempotent/reentrant copy
>> +            s_copy = s + ".orig"
>> +            if not os.path.isdir(s_copy):
>> +                shutil.copytree(s, s_copy)
>> +            bb.utils.remove(s, recurse=True)
>> +            shutil.copytree(s_copy, s)
>>              shutil.move(s, kernsrc)
>>              os.symlink(kernsrc, s)
>>  }
>> --
>> 2.36.1.vfs.0.0
>>
>>
>>
>>
>
> 
>
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#192838): 
https://lists.openembedded.org/g/openembedded-core/message/192838
Mute This Topic: https://lists.openembedded.org/mt/103262114/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to