diff options
author | Staffan Rydén <staffan.ryden@axis.com> | 2023-07-20 13:02:56 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-07-21 11:52:26 +0100 |
commit | 3ebef7a7195c7fd62c6b38be6dda24e548ef034b (patch) | |
tree | 721881e9f9a37fc0ccdad0d925cce9bc620d106f /meta/classes-recipe/kernel.bbclass | |
parent | 6d5adecd028582bf548cfa47c3b0f9e76fbc2d1f (diff) | |
download | poky-3ebef7a7195c7fd62c6b38be6dda24e548ef034b.tar.gz |
kernel: Fix path comparison in kernel staging dir symlinking
Due to an oversight in the do_symlink_kernsrc function, the path
comparison between "S" and "STAGING_KERNEL_DIR" is broken. The code
obtains both variables, but modifies the local copy of "S" before
comparing them, causing the comparison to always return false.
This can cause the build to fail when the EXTERNALSRC flag is enabled,
since the code will try to create a symlink even if one already exists.
This patch resolves the issue by comparing the variables before they are
modified.
(From OE-Core rev: afd2038ef8a66a5e6433be31a14e1eb0d9f9a1d3)
Signed-off-by: Staffan Rydén <staffan.ryden@axis.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes-recipe/kernel.bbclass')
-rw-r--r-- | meta/classes-recipe/kernel.bbclass | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/meta/classes-recipe/kernel.bbclass b/meta/classes-recipe/kernel.bbclass index b3865dcb0f..2e9563186e 100644 --- a/meta/classes-recipe/kernel.bbclass +++ b/meta/classes-recipe/kernel.bbclass | |||
@@ -181,13 +181,14 @@ do_unpack[cleandirs] += " ${S} ${STAGING_KERNEL_DIR} ${B} ${STAGING_KERNEL_BUILD | |||
181 | do_clean[cleandirs] += " ${S} ${STAGING_KERNEL_DIR} ${B} ${STAGING_KERNEL_BUILDDIR}" | 181 | do_clean[cleandirs] += " ${S} ${STAGING_KERNEL_DIR} ${B} ${STAGING_KERNEL_BUILDDIR}" |
182 | python do_symlink_kernsrc () { | 182 | python do_symlink_kernsrc () { |
183 | s = d.getVar("S") | 183 | s = d.getVar("S") |
184 | if s[-1] == '/': | ||
185 | # drop trailing slash, so that os.symlink(kernsrc, s) doesn't use s as directory name and fail | ||
186 | s=s[:-1] | ||
187 | kernsrc = d.getVar("STAGING_KERNEL_DIR") | 184 | kernsrc = d.getVar("STAGING_KERNEL_DIR") |
188 | if s != kernsrc: | 185 | if s != kernsrc: |
189 | bb.utils.mkdirhier(kernsrc) | 186 | bb.utils.mkdirhier(kernsrc) |
190 | bb.utils.remove(kernsrc, recurse=True) | 187 | bb.utils.remove(kernsrc, recurse=True) |
188 | if s[-1] == '/': | ||
189 | # drop trailing slash, so that os.symlink(kernsrc, s) doesn't use s as | ||
190 | # directory name and fail | ||
191 | s = s[:-1] | ||
191 | if d.getVar("EXTERNALSRC"): | 192 | if d.getVar("EXTERNALSRC"): |
192 | # With EXTERNALSRC S will not be wiped so we can symlink to it | 193 | # With EXTERNALSRC S will not be wiped so we can symlink to it |
193 | os.symlink(s, kernsrc) | 194 | os.symlink(s, kernsrc) |