Skip to contentSkip to conversation

kernel.bbclass: make do_symlink_kernelsrc reentrant

PATCH Superseded [email protected] 1 participant 2 messages Dec 18, 2023

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 kernel.bbclass: make do_symlink_kernelsrc reentrant

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://bugzilla.yoctoproject.org/show_bug.cgi?id=15325

---
 meta/classes-recipe/kernel.bbclass | 5 +++++
 1 file changed, 5 insertions(+)
meta/classes-recipe/kernel.bbclass +5 -0
index 9ff37f5c38..cdd5f8e9a1 100644
@@ -183,6 +183,11 @@ python do_symlink_kernsrc () {
     s = d.getVar("S")
     kernsrc = d.getVar("STAGING_KERNEL_DIR")
     if s != kernsrc:
+        if os.path.islink(s):
+            # this happens for instance when a poky update modifies this class,
+            # forcing symlink_kernsrc to run again after s was already moved to kernsrc
+            bb.info("%s is already a symlink! Not symlinking kernel sources" % s)
+            return 0
         bb.utils.mkdirhier(kernsrc)
         bb.utils.remove(kernsrc, recurse=True)
         if s[-1] == '/':
Signature · 1 line
2.36.1.vfs.0.0
#1 lore raw

patch v3: changed bb.warn to bb.info, improved comment, moved code to the correct if block to avoid removal of kernsrc

Quoted 40 lines · On Mon, Dec 18, 2023 at 12:53 PM <[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://bugzilla.yoctoproject.org/show_bug.cgi?id=15325

---
 meta/classes-recipe/kernel.bbclass | 5 +++++
 1 file changed, 5 insertions(+)
meta/classes-recipe/kernel.bbclass +3 -0
index 9ff37f5c38..cdd5f8e9a1 100644
@@ -183,6 +183,11 @@ python do_symlink_kernsrc () {
     s = d.getVar("S")
     kernsrc = d.getVar("STAGING_KERNEL_DIR")
     if s != kernsrc:
+        if os.path.islink(s):
+            # this happens for instance when a poky update modifies this
 class,
+            # forcing symlink_kernsrc to run again after s was already

moved to kernsrc
+ bb.info("%s is already a symlink! Not symlinking kernel
sources" % s)
+ return 0

         bb.utils.mkdirhier(kernsrc)
         bb.utils.remove(kernsrc, recurse=True)
         if s[-1] == '/':

--
2.36.1.vfs.0.0