diff options
-rw-r--r-- | meta/classes/populate_sdk_base.bbclass | 5 | ||||
-rw-r--r-- | meta/files/toolchain-shar-relocate.sh | 2 | ||||
-rwxr-xr-x | scripts/relocate_sdk.py | 17 |
3 files changed, 10 insertions, 14 deletions
diff --git a/meta/classes/populate_sdk_base.bbclass b/meta/classes/populate_sdk_base.bbclass index 7ffaf84a45..e27ee036a2 100644 --- a/meta/classes/populate_sdk_base.bbclass +++ b/meta/classes/populate_sdk_base.bbclass | |||
@@ -161,11 +161,6 @@ do_populate_sdk[stamp-extra-info] = "${MACHINE_ARCH}${SDKMACHINE}" | |||
161 | 161 | ||
162 | fakeroot create_sdk_files() { | 162 | fakeroot create_sdk_files() { |
163 | cp ${COREBASE}/scripts/relocate_sdk.py ${SDK_OUTPUT}/${SDKPATH}/ | 163 | cp ${COREBASE}/scripts/relocate_sdk.py ${SDK_OUTPUT}/${SDKPATH}/ |
164 | |||
165 | # Replace the ##DEFAULT_INSTALL_DIR## with the correct pattern. | ||
166 | # Escape special characters like '+' and '.' in the SDKPATH | ||
167 | escaped_sdkpath=$(echo ${SDKPATH} |sed -e "s:[\+\.]:\\\\\\\\\0:g") | ||
168 | sed -i -e "s:##DEFAULT_INSTALL_DIR##:$escaped_sdkpath:" ${SDK_OUTPUT}/${SDKPATH}/relocate_sdk.py | ||
169 | } | 164 | } |
170 | 165 | ||
171 | python check_sdk_sysroots() { | 166 | python check_sdk_sysroots() { |
diff --git a/meta/files/toolchain-shar-relocate.sh b/meta/files/toolchain-shar-relocate.sh index e3c10018ef..f82ff2be48 100644 --- a/meta/files/toolchain-shar-relocate.sh +++ b/meta/files/toolchain-shar-relocate.sh | |||
@@ -36,7 +36,7 @@ if [ x\${PYTHON} = "x" ]; then | |||
36 | echo "SDK could not be relocated. No python found." | 36 | echo "SDK could not be relocated. No python found." |
37 | exit 1 | 37 | exit 1 |
38 | fi | 38 | fi |
39 | \${PYTHON} ${env_setup_script%/*}/relocate_sdk.py $target_sdk_dir $dl_path $executable_files | 39 | \${PYTHON} ${env_setup_script%/*}/relocate_sdk.py $DEFAULT_INSTALL_DIR $target_sdk_dir $dl_path $executable_files |
40 | EOF | 40 | EOF |
41 | 41 | ||
42 | $SUDO_EXEC mv $tdir/relocate_sdk.sh ${env_setup_script%/*}/relocate_sdk.sh | 42 | $SUDO_EXEC mv $tdir/relocate_sdk.sh ${env_setup_script%/*}/relocate_sdk.sh |
diff --git a/scripts/relocate_sdk.py b/scripts/relocate_sdk.py index c752fa2c61..0d5a6f5161 100755 --- a/scripts/relocate_sdk.py +++ b/scripts/relocate_sdk.py | |||
@@ -38,8 +38,6 @@ else: | |||
38 | def b(x): | 38 | def b(x): |
39 | return x.encode(sys.getfilesystemencoding()) | 39 | return x.encode(sys.getfilesystemencoding()) |
40 | 40 | ||
41 | old_prefix = re.compile(b("##DEFAULT_INSTALL_DIR##")) | ||
42 | |||
43 | def get_arch(): | 41 | def get_arch(): |
44 | f.seek(0) | 42 | f.seek(0) |
45 | e_ident =f.read(16) | 43 | e_ident =f.read(16) |
@@ -212,19 +210,22 @@ def change_dl_sysdirs(elf_file_name): | |||
212 | f.write(sysdirslen) | 210 | f.write(sysdirslen) |
213 | 211 | ||
214 | # MAIN | 212 | # MAIN |
215 | if len(sys.argv) < 4: | 213 | if len(sys.argv) < 5: |
216 | sys.exit(-1) | 214 | sys.exit(-1) |
217 | 215 | ||
218 | # In python > 3, strings may also contain Unicode characters. So, convert | 216 | # In python > 3, strings may also contain Unicode characters. So, convert |
219 | # them to bytes | 217 | # them to bytes |
220 | if sys.version_info < (3,): | 218 | if sys.version_info < (3,): |
221 | new_prefix = sys.argv[1] | 219 | new_prefix = sys.argv[2] |
222 | new_dl_path = sys.argv[2] | 220 | new_dl_path = sys.argv[3] |
223 | else: | 221 | else: |
224 | new_prefix = sys.argv[1].encode() | 222 | new_prefix = sys.argv[2].encode() |
225 | new_dl_path = sys.argv[2].encode() | 223 | new_dl_path = sys.argv[3].encode() |
224 | |||
225 | executables_list = sys.argv[4:] | ||
226 | 226 | ||
227 | executables_list = sys.argv[3:] | 227 | old_prefix_ne = b(sys.argv[1]) |
228 | old_prefix = re.compile(re.escape(old_prefix_ne)); | ||
228 | 229 | ||
229 | for e in executables_list: | 230 | for e in executables_list: |
230 | perms = os.stat(e)[stat.ST_MODE] | 231 | perms = os.stat(e)[stat.ST_MODE] |