diff mbox series

kernel.bbclass: keep the sources when do_symlink_kernsrc reruns

Message ID 20261114185527.6-1-bbnpreetsingh@gmail.com
State New
Headers show
Series kernel.bbclass: keep the sources when do_symlink_kernsrc reruns | expand

Commit Message

Babanpreet Singh Nov. 14, 2026, 6:55 p.m. UTC
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 mbox series

Patch

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] == '/':