diff --git a/tools/update_kernel_commits.py b/tools/update_kernel_commits.py index 0319556bd8..146ff93e81 100755 --- a/tools/update_kernel_commits.py +++ b/tools/update_kernel_commits.py @@ -117,7 +117,13 @@ def branch_commit_to_variable(branch_name, commit): Returns: - str: The variable name in the expected format. """ - variable_name = branch_name.replace("eve-kernel-", "KERNEL_COMMIT_").replace("-", "_") + m = re.match(r"(?P.*v\d+\.\d+(?:\.\d+)?)-(?P.*)", branch_name) + + if not m: + exit(f"Error: Invalid branch name format: {branch_name}") + + branch_name = m.group("branch").replace("eve-kernel-", "KERNEL_COMMIT_").replace("-", "_") + variable_name = branch_name + "_" + m.group("platform") return f"{variable_name} = {commit}\n"