Skip to content

Commit

Permalink
Revert "scripts: serie_update: fetch submodules"
Browse files Browse the repository at this point in the history
This reverts commit 3fe2e32.
  • Loading branch information
Desvauxm-st authored Dec 19, 2023
1 parent 3fe2e32 commit 9624ae1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 28 deletions.
8 changes: 4 additions & 4 deletions scripts/ble_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ def build_patch_from_current_zephyr_version(

temp_source_lib_path = Path(temp_source_path / "lib")

# Checkout the current Zephyr version of the STM32Cube repo
# reset the STM32Cube repo to this current version
os_cmd(
("git", "checkout", "-f", "--recurse-submodules", version),
("git", "reset", "--hard", version),
cwd=src_repo_path,
)

Expand Down Expand Up @@ -218,9 +218,9 @@ def update(
build_patch_from_current_zephyr_version(
src_repo_path, temp_source_path, dest_lib_path, current_version
)
# Checkout the latest version of the STM32Cube repo
# reset the STM32Cube repo to this update version
os_cmd(
("git", "checkout", "-f", "--recurse-submodules", update_version),
("git", "reset", "--hard", update_version),
cwd=src_repo_path,
)
copy_hci_files(src_repo_path, dest_lib_path)
Expand Down
33 changes: 9 additions & 24 deletions scripts/serie_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def __init__(

# ##### 3 root directories to work with ########
# 1: STM32Cube repo Default $HOME/STM32Cube_repo
# 2: zephyr stm32 path : ex: .../zephyr_project/module/hal/stm32
# 2 : zephyr stm32 path : ex: .../zephyr_project/module/hal/stm32
# 3: Temporary directory to construct the update
# (within STM32Cube repo dir)
self.stm32cube_repo_path = stm32cube_repo_path
Expand Down Expand Up @@ -192,26 +192,14 @@ def clone_cube_repo(self):
# if already exists, then just clean and fetch
self.os_cmd(("git", "clean", "-fdx"), cwd=self.stm32cube_serie_path)
self.os_cmd(("git", "fetch"), cwd=self.stm32cube_serie_path)
# this is useful when HAL/CMSIS Device drivers submodules are not
# already present locally, otherwise "git fetch" is sufficient
self.os_cmd(("git", "submodule", "update", "--init"),
cwd=self.stm32cube_serie_path)
branch = self.major_branch()
# "Using --recurse-submodules will update the content of all active
# submodules according to the commit recorded in the superproject.
# If local modifications in a submodule would be overwritten the
# checkout will fail unless -f is used."
# https://git-scm.com/docs/git-checkout
self.os_cmd(
("git", "checkout", "-f", "--recurse-submodules", branch),
("git", "reset", "--hard", branch),
cwd=self.stm32cube_serie_path,
)
else:
# HAL & CMSIS Device drivers are now included as git submodules in
# upstream STM32Cube GitHub repositories
# So to get them too, --recursive or --recurse-submodules is needed
self.os_cmd(
("git", "clone", "--recursive", repo_name),
("git", "clone", repo_name),
cwd=self.stm32cube_repo_path,
)
branch = self.major_branch()
Expand Down Expand Up @@ -272,7 +260,6 @@ def extract_source(self):
# for CMSIS files
temp_cmsis_soc_path = self.stm32cube_temp_serie / "soc"
Path.mkdir(temp_cmsis_soc_path, parents=True)

stm32cube_cmsis_include_path = (
self.stm32cube_serie_path
/ "Drivers"
Expand Down Expand Up @@ -303,7 +290,6 @@ def extract_source(self):
# for hal and ll drivers
temp_drivers_include_path = self.stm32cube_temp_serie / "drivers" / "include"
temp_drivers_include_path.parent.mkdir(parents=True)

stm32cube_driver_inc = (
self.stm32cube_serie_path
/ "Drivers"
Expand Down Expand Up @@ -334,9 +320,9 @@ def build_from_current_cube_version(self):
"""Build a commit in temporary dir with STM32Cube version
corresponding to zephyr current hal version
"""
# Checkout the current Zephyr version of the STM32Cube repo
# reset the STM32Cube repo to this current version
self.os_cmd(
("git", "checkout", "-f", "--recurse-submodules", self.current_version),
("git", "reset", "--hard", self.current_version),
cwd=self.stm32cube_serie_path,
)

Expand Down Expand Up @@ -579,9 +565,9 @@ def build_from_version_update(self):
"""Build a commit in temporary dir with STM32Cube version
corresponding to zephyr latest hal version
"""
# Checkout the latest version of the upstream STM32Cube repo
# reset the STM32Cube repo to this latest version
self.os_cmd(
("git", "checkout", "-f", "--recurse-submodules", self.version_update),
("git", "reset", "--hard", self.version_update),
cwd=self.stm32cube_serie_path,
)

Expand Down Expand Up @@ -707,8 +693,7 @@ def reject(self):

def cleanup_stm32cube_repo(self):
"""clean the STM32Cube repo"""
self.os_cmd(("git", "checkout", "-f", "--recurse-submodules", "HEAD"),
cwd=self.stm32cube_serie_path)
self.os_cmd(("git", "reset", "--hard", "HEAD"), cwd=self.stm32cube_serie_path)

def clean_files(self):
"""Clean repo file if required"""
Expand All @@ -724,7 +709,7 @@ def clean_files(self):
)
else:
self.os_cmd(
("git", "checkout", "-f", "--recurse-submodules", "HEAD"),
("git", "reset", "--hard", "HEAD"),
cwd=self.stm32cube_serie_path,
)

Expand Down

0 comments on commit 9624ae1

Please sign in to comment.