summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2018-07-25 16:45:23 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-07-25 16:46:56 +0100
commitd8762a1ea74bbd9a9ee1510fe5ffa8db1b7d0d61 (patch)
tree86cc816ce37adccfc5bc4fad83d0a156a176b69f
parentdafacf04532fa46201a2c7cce8a217d656131e18 (diff)
downloadpoky-d8762a1ea74bbd9a9ee1510fe5ffa8db1b7d0d61.tar.gz
Revert "relocate_sdk.py: remove hardcoded SDK path"
This reverts commit 6671a4d980c8bef8f402780a308f6c43a25044aa. This breaks uninative tarball since the call of relocate_sdk.py from uninative.bbclass wasn't updated to account for this change. It isn't clear what value that code could pass in and this isn't simple to fix so revert until a better fix can be found that doesn't break uninative. (From OE-Core rev: b247392b4ced57cfe694656032f6a6723740a9e8) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/populate_sdk_base.bbclass5
-rw-r--r--meta/files/toolchain-shar-relocate.sh2
-rwxr-xr-xscripts/relocate_sdk.py17
3 files changed, 14 insertions, 10 deletions
diff --git a/meta/classes/populate_sdk_base.bbclass b/meta/classes/populate_sdk_base.bbclass
index e27ee036a2..7ffaf84a45 100644
--- a/meta/classes/populate_sdk_base.bbclass
+++ b/meta/classes/populate_sdk_base.bbclass
@@ -161,6 +161,11 @@ do_populate_sdk[stamp-extra-info] = "${MACHINE_ARCH}${SDKMACHINE}"
161 161
162fakeroot create_sdk_files() { 162fakeroot 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
164} 169}
165 170
166python check_sdk_sysroots() { 171python check_sdk_sysroots() {
diff --git a/meta/files/toolchain-shar-relocate.sh b/meta/files/toolchain-shar-relocate.sh
index f82ff2be48..e3c10018ef 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
38fi 38fi
39\${PYTHON} ${env_setup_script%/*}/relocate_sdk.py $DEFAULT_INSTALL_DIR $target_sdk_dir $dl_path $executable_files 39\${PYTHON} ${env_setup_script%/*}/relocate_sdk.py $target_sdk_dir $dl_path $executable_files
40EOF 40EOF
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 0d5a6f5161..c752fa2c61 100755
--- a/scripts/relocate_sdk.py
+++ b/scripts/relocate_sdk.py
@@ -38,6 +38,8 @@ else:
38 def b(x): 38 def b(x):
39 return x.encode(sys.getfilesystemencoding()) 39 return x.encode(sys.getfilesystemencoding())
40 40
41old_prefix = re.compile(b("##DEFAULT_INSTALL_DIR##"))
42
41def get_arch(): 43def get_arch():
42 f.seek(0) 44 f.seek(0)
43 e_ident =f.read(16) 45 e_ident =f.read(16)
@@ -210,22 +212,19 @@ def change_dl_sysdirs(elf_file_name):
210 f.write(sysdirslen) 212 f.write(sysdirslen)
211 213
212# MAIN 214# MAIN
213if len(sys.argv) < 5: 215if len(sys.argv) < 4:
214 sys.exit(-1) 216 sys.exit(-1)
215 217
216# In python > 3, strings may also contain Unicode characters. So, convert 218# In python > 3, strings may also contain Unicode characters. So, convert
217# them to bytes 219# them to bytes
218if sys.version_info < (3,): 220if sys.version_info < (3,):
219 new_prefix = sys.argv[2] 221 new_prefix = sys.argv[1]
220 new_dl_path = sys.argv[3] 222 new_dl_path = sys.argv[2]
221else: 223else:
222 new_prefix = sys.argv[2].encode() 224 new_prefix = sys.argv[1].encode()
223 new_dl_path = sys.argv[3].encode() 225 new_dl_path = sys.argv[2].encode()
224
225executables_list = sys.argv[4:]
226 226
227old_prefix_ne = b(sys.argv[1]) 227executables_list = sys.argv[3:]
228old_prefix = re.compile(re.escape(old_prefix_ne));
229 228
230for e in executables_list: 229for e in executables_list:
231 perms = os.stat(e)[stat.ST_MODE] 230 perms = os.stat(e)[stat.ST_MODE]