diff options
author | Laurentiu Palcu <laurentiu.palcu@intel.com> | 2012-09-25 19:35:46 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-09-26 15:02:28 +0100 |
commit | 6bc5925ea962ff68dcfac72c221b2445f71c78aa (patch) | |
tree | c6b0d14bcac71786f8c2d1525c65b31996efc6bc | |
parent | 04ced3d73881a17f2a65b6cd33e303e31519ad6c (diff) | |
download | poky-6bc5925ea962ff68dcfac72c221b2445f71c78aa.tar.gz |
SDK: trap any IO errors in the relocate script
If the files being relocated are already used by other processes the
relocate script will fail with a traceback. This patch will trap any IO
errors when opening such a file and gracefully report them to the user.
Also change the exit code from 1 to -1 for a better adt-installer user
experience (like pointing the user to the adt_installer.log).
[YOCTO #3164]
(From OE-Core rev: 26daec758b2eaeb208356d5aa8a9a191bd366751)
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-x | scripts/relocate_sdk.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/scripts/relocate_sdk.py b/scripts/relocate_sdk.py index b247e65ce3..637ffe9483 100755 --- a/scripts/relocate_sdk.py +++ b/scripts/relocate_sdk.py | |||
@@ -29,6 +29,7 @@ import sys | |||
29 | import stat | 29 | import stat |
30 | import os | 30 | import os |
31 | import re | 31 | import re |
32 | import errno | ||
32 | 33 | ||
33 | old_prefix = re.compile("##DEFAULT_INSTALL_DIR##") | 34 | old_prefix = re.compile("##DEFAULT_INSTALL_DIR##") |
34 | 35 | ||
@@ -171,7 +172,7 @@ def change_dl_sysdirs(): | |||
171 | 172 | ||
172 | # MAIN | 173 | # MAIN |
173 | if len(sys.argv) < 4: | 174 | if len(sys.argv) < 4: |
174 | exit(1) | 175 | exit(-1) |
175 | 176 | ||
176 | new_prefix = sys.argv[1] | 177 | new_prefix = sys.argv[1] |
177 | new_dl_path = sys.argv[2] | 178 | new_dl_path = sys.argv[2] |
@@ -184,7 +185,16 @@ for e in executables_list: | |||
184 | else: | 185 | else: |
185 | os.chmod(e, perms|stat.S_IRWXU) | 186 | os.chmod(e, perms|stat.S_IRWXU) |
186 | 187 | ||
187 | f = open(e, "r+b") | 188 | try: |
189 | f = open(e, "r+b") | ||
190 | except IOError as ioex: | ||
191 | if ioex.errno == errno.ETXTBSY: | ||
192 | print("Could not open %s. File used by another process.\nPlease "\ | ||
193 | "make sure you exit all processes that might use any SDK "\ | ||
194 | "binaries." % e) | ||
195 | else: | ||
196 | print("Could not open %s: %s(%d)" % (e, ioex.strerror, ioex.errno)) | ||
197 | exit(-1) | ||
188 | 198 | ||
189 | arch = get_arch() | 199 | arch = get_arch() |
190 | if arch: | 200 | if arch: |