Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] kernel.bbclass: keep the sources when do_symlink_kernsrc reruns
@ 2026-11-14 18:55 Babanpreet Singh
  2026-11-14 20:31 ` Etienne Cordonnier
  0 siblings, 1 reply; 3+ messages in thread
From: Babanpreet Singh @ 2026-11-14 18:55 UTC (permalink / raw)
  To: openembedded-core
  Cc: Bruce Ashfield, Richard Purdie, Etienne Cordonnier,
	Julien Stephan, Babanpreet Singh

With S outside STAGING_KERNEL_DIR, a second do_symlink_kernsrc without
do_unpack deletes the sources and leaves STAGING_KERNEL_DIR as a link
to itself:

  do_kernel_checkout: [Errno 17] File exists: '.../linux-yocto-7.2.13+git'

S is already a symlink to STAGING_KERNEL_DIR by then. Skip the move
when the two resolve to the same directory.

[YOCTO #15325]

Suggested-by: Julien Stephan <jstephan@baylibre.com>
Signed-off-by: Babanpreet Singh <bbnpreetsingh@gmail.com>
---
 meta/classes-recipe/kernel.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/classes-recipe/kernel.bbclass b/meta/classes-recipe/kernel.bbclass
index 46da867a63..44223a4712 100644
--- a/meta/classes-recipe/kernel.bbclass
+++ b/meta/classes-recipe/kernel.bbclass
@@ -196,7 +196,7 @@ do_clean[cleandirs] += " ${S} ${STAGING_KERNEL_DIR} ${B} ${STAGING_KERNEL_BUILDD
 python do_symlink_kernsrc () {
     s = d.getVar("S")
     kernsrc = d.getVar("STAGING_KERNEL_DIR")
-    if s != kernsrc:
+    if os.path.realpath(s) != os.path.realpath(kernsrc):
         bb.utils.mkdirhier(kernsrc)
         bb.utils.remove(kernsrc, recurse=True)
         if s[-1] == '/':
-- 
2.43.0


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

* Re: [PATCH] kernel.bbclass: keep the sources when do_symlink_kernsrc reruns
  2026-11-14 18:55 [PATCH] kernel.bbclass: keep the sources when do_symlink_kernsrc reruns Babanpreet Singh
@ 2026-11-14 20:31 ` Etienne Cordonnier
  2026-11-15  6:22   ` Babanpreet Singh
  0 siblings, 1 reply; 3+ messages in thread
From: Etienne Cordonnier @ 2026-11-14 20:31 UTC (permalink / raw)
  To: Babanpreet Singh
  Cc: openembedded-core, Bruce Ashfield, Richard Purdie, Julien Stephan

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

Hi Babanpreet,

are you aware of
https://lists.openembedded.org/g/openembedded-core/topic/103308574?msg=192851#msg192851
? It has some useful context about what I had tried a while ago.

Étienne

On Sat, Nov 14, 2026 at 7:55 PM Babanpreet Singh <bbnpreetsingh@gmail.com>
wrote:

> With S outside STAGING_KERNEL_DIR, a second do_symlink_kernsrc without
> do_unpack deletes the sources and leaves STAGING_KERNEL_DIR as a link
> to itself:
>
>   do_kernel_checkout: [Errno 17] File exists: '.../linux-yocto-7.2.13+git'
>
> S is already a symlink to STAGING_KERNEL_DIR by then. Skip the move
> when the two resolve to the same directory.
>
> [YOCTO #15325]
>
> Suggested-by: Julien Stephan <jstephan@baylibre.com>
> Signed-off-by: Babanpreet Singh <bbnpreetsingh@gmail.com>
> ---
>  meta/classes-recipe/kernel.bbclass | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/meta/classes-recipe/kernel.bbclass
> b/meta/classes-recipe/kernel.bbclass
> index 46da867a63..44223a4712 100644
> --- a/meta/classes-recipe/kernel.bbclass
> +++ b/meta/classes-recipe/kernel.bbclass
> @@ -196,7 +196,7 @@ do_clean[cleandirs] += " ${S} ${STAGING_KERNEL_DIR}
> ${B} ${STAGING_KERNEL_BUILDD
>  python do_symlink_kernsrc () {
>      s = d.getVar("S")
>      kernsrc = d.getVar("STAGING_KERNEL_DIR")
> -    if s != kernsrc:
> +    if os.path.realpath(s) != os.path.realpath(kernsrc):
>          bb.utils.mkdirhier(kernsrc)
>          bb.utils.remove(kernsrc, recurse=True)
>          if s[-1] == '/':
> --
> 2.43.0
>
>

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

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

* Re: [PATCH] kernel.bbclass: keep the sources when do_symlink_kernsrc reruns
  2026-11-14 20:31 ` Etienne Cordonnier
@ 2026-11-15  6:22   ` Babanpreet Singh
  0 siblings, 0 replies; 3+ messages in thread
From: Babanpreet Singh @ 2026-11-15  6:22 UTC (permalink / raw)
  To: Etienne Cordonnier
  Cc: openembedded-core, Bruce Ashfield, Richard Purdie, Julien Stephan,
	Babanpreet Singh

On Sat, 14 Nov 2026 at 21:31 +0100, Etienne Cordonnier wrote:
> are you aware of
> https://lists.openembedded.org/g/openembedded-core/topic/103308574?msg=192851#msg192851
> ? It has some useful context about what I had tried a while ago.

Hi Étienne,

Yes, I read your v2 to v5 and Richard's review of v5 before writing
this. The copy was what he objected to, so this one makes none. When
S already resolves to STAGING_KERNEL_DIR it leaves both alone.

Thanks for the pointer.

Baban

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

end of thread, other threads:[~2026-11-15  6:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-14 18:55 [PATCH] kernel.bbclass: keep the sources when do_symlink_kernsrc reruns Babanpreet Singh
2026-11-14 20:31 ` Etienne Cordonnier
2026-11-15  6:22   ` Babanpreet Singh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox