scripts: update: commit systematically the update Not committing cube update leave some trailing space and this cause confusion and misunderstanding. So Cube update is now systematically committed. Remove "--force" option (cherry picked from commit f9fe0ccba5dcdfc40b8cdecbedb6a3565b0df892) Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com> GitOrigin-RevId: f9fe0ccba5dcdfc40b8cdecbedb6a3565b0df892 Change-Id: I3e076865ba88f5535d20f665e6986deeeb5c4566 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/hal_stm32/+/3307683 Tested-by: CopyBot Service Account <copybot.service@gmail.com> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Yuval Peress <peress@google.com> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
diff --git a/scripts/serie_update.py b/scripts/serie_update.py index 0ac75ec..a832aa4 100644 --- a/scripts/serie_update.py +++ b/scripts/serie_update.py
@@ -49,7 +49,6 @@ self, stm32_serie, stm32cube_repo_path, - force, noclean, version_update, debug, @@ -59,7 +58,6 @@ Args: stm32_serie: stm32 serie ex:stm32f3xx stm32cube_repo_path: directory path where to fetch github repo - force: boolean to force or not git commit after applying update noclean: boolean to clean or not github repo after update done version_update: string to force a specified version to be updated debug: boolean to set log debug level @@ -82,7 +80,6 @@ self.stm32_serie_upper = stm32_serie.upper() # ex:STM32F3 self.stm32_seriexx_upper = self.stm32_serie_upper + "xx" # ex:STM32F3xx self.serie = self.stm32_serie_upper[5:] - self.force = force self.noclean = noclean self.version_update = version_update self.debug = debug @@ -649,47 +646,43 @@ def merge_commit(self, lib=False): """Apply zephyr stm32 patch to latest stm32Cube version""" - # Merge & commit if needed - if self.force: - # to clean the .rej files, uncomment line: reject() - # reject() - if lib: - logging.info("%s", "commit BLE library update") - commit_msg = "lib/stm32: " - else: - logging.info("%s", "commit HAL/LL Cube update ") - commit_msg = "stm32cube: " + # Merge & commit + # to clean the .rej files, uncomment line: reject() + # reject() + if lib: + logging.info("%s", "commit BLE library update") + commit_msg = "lib/stm32: " + else: + logging.info("%s", "commit HAL/LL Cube update ") + commit_msg = "stm32cube: " - commit_file_path = self.zephyr_module_serie_path / "commit.msg" - with open(commit_file_path, "w") as commit: - commit.write( - commit_msg - + "update " - + self.stm32_serie - + " to cube version " - + self.version_update.upper() - + "\n" - ) + commit_file_path = self.zephyr_module_serie_path / "commit.msg" + with open(commit_file_path, "w") as commit: + commit.write( + commit_msg + + "update " + + self.stm32_serie + + " to cube version " + + self.version_update.upper() + + "\n" + ) - commit.write("\n") - commit.write( - "Update Cube version for " - + self.stm32_seriexx_upper - + " series" - + "\n" - ) - commit.write("on https://github.com/STMicroelectronics" + "\n") - commit.write(f"from version {self.current_version}\n") - commit.write(f"to version {self.version_update}\n") - self.os_cmd( - ("git", "commit", "-as", "-F", commit_file_path), - cwd=self.zephyr_module_serie_path, + commit.write("\n") + commit.write( + "Update Cube version for " + self.stm32_seriexx_upper + " series" + "\n" ) - self.os_cmd( - ("git", "rebase", "--whitespace=fix", "HEAD~1"), - cwd=self.zephyr_module_serie_path, - ) - Path(commit_file_path).unlink() + commit.write("on https://github.com/STMicroelectronics" + "\n") + commit.write(f"from version {self.current_version}\n") + commit.write(f"to version {self.version_update}\n") + self.os_cmd( + ("git", "commit", "-as", "-F", commit_file_path), + cwd=self.zephyr_module_serie_path, + ) + self.os_cmd( + ("git", "rebase", "--whitespace=fix", "HEAD~1"), + cwd=self.zephyr_module_serie_path, + ) + Path(commit_file_path).unlink() def reject(self): """Clean *.rej files"""
diff --git a/scripts/update_stm32_package.py b/scripts/update_stm32_package.py index 0fe4948..5a1ec5c 100644 --- a/scripts/update_stm32_package.py +++ b/scripts/update_stm32_package.py
@@ -38,16 +38,6 @@ help="Do NOT clean the STM32Cube repo directory", ) parser.add_argument( - "-f", - "--force", - action="store_true", - default=False, - help="Forces the merge except .rej files \n" - + "applicable only with -s option. " - + "Otrherwise merge is forced systematically " - + "for each serie", -) -parser.add_argument( "-r", "--repo", type=str, @@ -92,7 +82,6 @@ update_serie = serie_update.Stm32SerieUpdate( stmyyxx.name[:-2], repo_path, - force=True, noclean=args.noclean, debug=args.debug, version_update="", @@ -158,7 +147,6 @@ update = serie_update.Stm32SerieUpdate( args.stm32_serie, repo_path, - args.force, args.noclean, args.version, args.debug, @@ -182,24 +170,23 @@ genllheaders.main(REPO_ROOT / "stm32cube", REPO_ROOT / "stm32cube" / "common_ll") # commit autogenerate generic LL HAL headers - if args.force: - commit_file_path = REPO_ROOT / "commit.msg" - with open(commit_file_path, "w") as commit: - commit.write("stm32cube: common_ll: Regeneration after cube updates\n") - commit.write("\n") - commit.write("Re - generate common_ll headers after Cube updates\n") + commit_file_path = REPO_ROOT / "commit.msg" + with open(commit_file_path, "w") as commit: + commit.write("stm32cube: common_ll: Regeneration after cube updates\n") + commit.write("\n") + commit.write("Re - generate common_ll headers after Cube updates\n") - subprocess.check_call( - ("git", "commit", "-as", "-F", commit_file_path), - cwd=REPO_ROOT, - ) + subprocess.check_call( + ("git", "commit", "-as", "-F", commit_file_path), + cwd=REPO_ROOT, + ) - subprocess.check_call( - ("git", "rebase", "--whitespace=fix", "HEAD~1"), - stdout=std_dest, - stderr=std_dest, - cwd=REPO_ROOT, - ) - Path(commit_file_path).unlink() + subprocess.check_call( + ("git", "rebase", "--whitespace=fix", "HEAD~1"), + stdout=std_dest, + stderr=std_dest, + cwd=REPO_ROOT, + ) + Path(commit_file_path).unlink() logging.info("%s", "LL HAL header update: Done")