Skip to content

Commit 9f94e32

Browse files
committed
[NXP][script] Updating update_nxp_sdk script to clean force update processing
Signed-off-by: Gatien Chapon <gatien.chapon@nxp.com>
1 parent 6b82df0 commit 9f94e32

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

scripts/setup/nxp/update_nxp_sdk.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,12 @@
3030
all_platform_sdk_list = list(map(lambda plat: plat["plat_name"], ALL_PLATFORM_SDK))
3131

3232

33-
def clean_sdk(sdk_target_location):
33+
def clean_sdk_local_changes(sdk_target_location):
3434
print("SDK will be cleaned all local modification(s) will be lost")
3535
# Cleaning all local modifications
3636
git_clean_command = "git reset --hard && git clean -xdf"
3737
command = ['west', 'forall', '-c', git_clean_command, '-a']
3838
subprocess.run(command, cwd=sdk_target_location, check=True)
39-
# Retrying an update
40-
update_platform_sdk_version(sdk_target_location, False)
4139

4240

4341
def init_platform_sdk_version(sdk_target_location, force):
@@ -64,7 +62,11 @@ def update_platform_sdk_version(sdk_target_location, force):
6462
subprocess.run(command, cwd=sdk_target_location, check=True)
6563
except (RuntimeError, subprocess.CalledProcessError) as exception:
6664
if force:
67-
clean_sdk(sdk_target_location)
65+
# In case of force update option and in case of update failure:
66+
# 1. try to clean all local modications if any
67+
# 2. Retry the west update command. It should be successfull now as all local modifications have been cleaned
68+
clean_sdk_local_changes(sdk_target_location)
69+
subprocess.run(command, cwd=sdk_target_location, check=True)
6870
else:
6971
print(exception)
7072
print("Error SDK cannot be updated, local changes should be cleaned manually or use --force to force update")

0 commit comments

Comments
 (0)