Skip to content

Commit b7c9e55

Browse files
committed
chore(ci): add support for submodule
STM32Cube repos have submodules. Signed-off-by: Frederic Pillon <[email protected]>
1 parent aa13ab1 commit b7c9e55

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

CI/update/stm32cube.py

+20-2
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,24 @@ def updateSTRepo():
316316
f"{rname}/{bname}",
317317
],
318318
]
319+
gitmodule_path = repo_path / ".gitmodules"
320+
if gitmodule_path.exists():
321+
git_cmds += (
322+
[
323+
"git",
324+
"-C",
325+
repo_path,
326+
"submodule",
327+
"update",
328+
"--init",
329+
"--recursive",
330+
],
331+
)
319332
else:
320333
# Clone it as it does not exists yet
321-
git_cmds = [["git", "-C", repo_local_path, "clone", gh_STM32Cube]]
334+
git_cmds = [
335+
["git", "-C", repo_local_path, "clone", "--recursive", gh_STM32Cube]
336+
]
322337
for cmd in git_cmds:
323338
execute_cmd(cmd, None)
324339
latestTag(serie, repo_name, repo_path)
@@ -336,7 +351,10 @@ def latestTag(serie, repo_name, repo_path):
336351
version_tag = execute_cmd(
337352
["git", "-C", repo_path, "describe", "--tags", sha1_id], None
338353
)
339-
execute_cmd(["git", "-C", repo_path, "checkout", version_tag], subprocess.DEVNULL)
354+
execute_cmd(
355+
["git", "-C", repo_path, "checkout", "-f", "--recurse-submodules", version_tag],
356+
subprocess.DEVNULL,
357+
)
340358
cube_versions[serie] = version_tag
341359
# print(f"Latest tagged version available for {repo_name} is {version_tag}")
342360

0 commit comments

Comments
 (0)