Skip to content

ci(stm32cube): manage Release candidate for HAL/CMSIS versions #1630

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions CI/update/stm32cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,10 +370,12 @@ def parseVersion(path):
main_found = False
sub1_found = False
sub2_found = False
rc_found = False
if "HAL" in str(path):
main_pattern = re.compile(r"HAL_VERSION_MAIN.*0x([\dA-Fa-f]+)")
sub1_pattern = re.compile(r"HAL_VERSION_SUB1.*0x([\dA-Fa-f]+)")
sub2_pattern = re.compile(r"HAL_VERSION_SUB2.*0x([\dA-Fa-f]+)")
rc_pattern = re.compile(r"HAL_VERSION_RC.*0x([\dA-Fa-f]+)")
else:
main_pattern = re.compile(
r"(?:CMSIS|DEVICE|CMSIS_DEVICE)_VERSION_MAIN.*0x([\dA-Fa-f]+)"
Expand All @@ -384,6 +386,9 @@ def parseVersion(path):
sub2_pattern = re.compile(
r"(?:CMSIS|DEVICE|CMSIS_DEVICE)_VERSION_SUB2.*0x([\dA-Fa-f]+)"
)
rc_pattern = re.compile(
r"(?:CMSIS|DEVICE|CMSIS_DEVICE)_VERSION_RC.*0x([\dA-Fa-f]+)"
)

for i, line in enumerate(open(path, encoding="utf8", errors="ignore")):
for match in re.finditer(main_pattern, line):
Expand All @@ -395,7 +400,10 @@ def parseVersion(path):
for match in re.finditer(sub2_pattern, line):
VERSION_SUB2 = int(match.group(1), 16)
sub2_found = True
if main_found and sub1_found and sub2_found:
for match in re.finditer(rc_pattern, line):
VERSION_RC = int(match.group(1), 16)
rc_found = True
if main_found and sub1_found and sub2_found and rc_found:
break
else:
print(f"Could not find the full version in {path}")
Expand All @@ -408,7 +416,16 @@ def parseVersion(path):
if sub2_found:
print(f"sub2 version found: {VERSION_SUB2}")
VERSION_SUB2 = "FF"
return f"{VERSION_MAIN}.{VERSION_SUB1}.{VERSION_SUB2}"
if rc_found:
print(f"rc version found: {VERSION_RC}")
VERSION_RC = "FF"

ret = f"{VERSION_MAIN}.{VERSION_SUB1}.{VERSION_SUB2}"

if VERSION_RC != 0:
ret = f"{ret}RC{VERSION_RC}"

return ret


def checkVersion(serie, repo_path):
Expand Down