summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChen Qi <Qi.Chen@windriver.com>2024-12-04 23:32:06 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-12-09 15:23:28 +0000
commit19f1ab574ff687742a860a58c79b962a50753b4c (patch)
tree68569f6ad0ca1d1835fded12170b17babc591de4
parent011e8bf639a45310754560dc1f89843b07ef4bc6 (diff)
downloadpoky-19f1ab574ff687742a860a58c79b962a50753b4c.tar.gz
toolchain-shar-relocate.sh: fix the replacing commands
There're two cases that the current replacing commands cannot handle well: 1. Files with whitespace in their names 2. Installation path with keyword such as 'script' This results in installation failure of a buildtools. We can use the following commands to reproduce the problem. 1. bitbake buildtools-tarball 2. ./tmp/deploy/sdk/x86_64-buildtools-nativesdk-standalone-5.1.sh -d dir-with-keyword-script -y The error message is like below: Setting it up...sed: can't read /PATH/TO/dir-with-keyword-script/sysroots/x86_64-wrlinuxsdk-linux /usr/lib/python3.13/site-packages/setuptools/_vendor/jaraco/text/Lorem: No such file or directory Failed to replace perl. Relocate script failed. Abort! The actual file name is /PATH/TO/dir-with-keyword-script/sysroots/x86_64-pokysdk-linux/usr/lib/python3.13 /site-packages/setuptools/_vendor/jaraco/text/Lorem ipsum.txt Note that the file path matches "script.*text". In fact, if we install the SDK into some directory containing both 'script' and 'text', all files will be matched. This is not expected. This patch fixes the replacing commands by doing the following two things: 1. Use '\n' as the field separator for xargs so that files with white spaces are not splitted. 2. Use awk to match the second filed of the file command's output so that the file path does not mess up with the matching process. (From OE-Core rev: 443912d512edbb75f16c52de489b33b6f8687431) Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/files/toolchain-shar-relocate.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/meta/files/toolchain-shar-relocate.sh b/meta/files/toolchain-shar-relocate.sh
index b017714df0..69ea063c8c 100644
--- a/meta/files/toolchain-shar-relocate.sh
+++ b/meta/files/toolchain-shar-relocate.sh
@@ -57,8 +57,8 @@ fi
57# replace the host perl with SDK perl. 57# replace the host perl with SDK perl.
58for replace in "$target_sdk_dir -maxdepth 1" "$native_sysroot"; do 58for replace in "$target_sdk_dir -maxdepth 1" "$native_sysroot"; do
59 $SUDO_EXEC find $replace -type f 59 $SUDO_EXEC find $replace -type f
60done | xargs -n100 file | grep ":.*\(ASCII\|script\|source\).*text" | \ 60done | xargs -d '\n' -n100 file | \
61 awk -F': ' '{printf "\"%s\"\n", $1}' | \ 61 awk -F': ' '{if (match($2, ".*(ASCII|script|source).*text")) {printf "\"%s\"\n", $1}}' | \
62 grep -Fv -e "$target_sdk_dir/environment-setup-" \ 62 grep -Fv -e "$target_sdk_dir/environment-setup-" \
63 -e "$target_sdk_dir/relocate_sdk" \ 63 -e "$target_sdk_dir/relocate_sdk" \
64 -e "$target_sdk_dir/post-relocate-setup" \ 64 -e "$target_sdk_dir/post-relocate-setup" \