diff options
author | Ruslan Bilovol <rbilovol@cisco.com> | 2017-11-22 13:20:05 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-07-24 11:52:27 +0100 |
commit | bf5b43495a99bb8d002e02c688746e78c9430c21 (patch) | |
tree | 6f4e21e6b52678ac0a72d92be7a5be146252530c /scripts/relocate_sdk.py | |
parent | 2019f782604a554412cc2ceb0f46760a83984487 (diff) | |
download | poky-bf5b43495a99bb8d002e02c688746e78c9430c21.tar.gz |
relocate_sdk.py: remove hardcoded SDK path
This patch removes hardcodes added to relocate_sdk.py
during SDK build, making it flexible and reusable.
Now default SDK path is passed to the script as
parameter rather then harcoded inside it.
This allows to reuse this script for multiple
relocations, and adds possibility to relocate
SDK multiple times
(From OE-Core rev: 6671a4d980c8bef8f402780a308f6c43a25044aa)
Signed-off-by: Ruslan Bilovol <rbilovol@cisco.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/relocate_sdk.py')
-rwxr-xr-x | scripts/relocate_sdk.py | 17 |
1 files changed, 9 insertions, 8 deletions
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] |