From a7828cdca724826ac7d1984be88c4b0be7f9fb83 Mon Sep 17 00:00:00 2001 From: Jordan R Abrahams-Whitehead Date: Fri, 10 May 2024 19:09:55 +0000 Subject: llvm_tools: continue_on_failure for setup_for_workon.py patch_manager.py supports the idea of continuing on patch failure. This is handy when we need to be able to identify whether some later patches when using setup_for_workon.py apply, despite earlier patches failing. BUG=None TEST=py/bin/llvm_tools/setup_for_workon.py \ --checkout m/main \ --clean-llvm \ --continue-on-failure \ --package sys-libs/scudo Change-Id: I698f5df8f6b2bd3f05e31c2a19abaac36870a951 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5530676 Tested-by: Jordan Abrahams-Whitehead Commit-Queue: Jordan Abrahams-Whitehead Reviewed-by: George Burgess --- llvm_tools/setup_for_workon.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/llvm_tools/setup_for_workon.py b/llvm_tools/setup_for_workon.py index 77ebf38f..1a89cbf7 100644 --- a/llvm_tools/setup_for_workon.py +++ b/llvm_tools/setup_for_workon.py @@ -33,15 +33,19 @@ def apply_patches( patch_manager: Path, patch_metadata_file: Path, current_rev: git_llvm_rev.Rev, + continue_on_failure: bool = False, ) -> None: """Applies patches using `patch_manager` to `llvm_dir`.""" + cmd: List[Union[str, Path]] = [ + patch_manager, + f"--svn_version={current_rev.number}", + f"--src_path={llvm_dir.path}", + f"--patch_metadata_file={patch_metadata_file}", + ] + if continue_on_failure: + cmd.append("--failure_mode=continue") subprocess.run( - [ - patch_manager, - f"--svn_version={current_rev.number}", - f"--src_path={llvm_dir.path}", - f"--patch_metadata_file={patch_metadata_file}", - ], + cmd, check=True, stdin=subprocess.DEVNULL, ) @@ -193,6 +197,11 @@ def main(argv: List[str]) -> None: action="store_false", help="Don't create a commit with all changes applied.", ) + parser.add_argument( + "--continue-on-failure", + action="store_true", + help="Keep applying later patches even if an earlier patch fails.", + ) parser.add_argument( "--workon-board", dest="workon_board", @@ -283,6 +292,7 @@ def main(argv: List[str]) -> None: patch_manager=files_dir / "patch_manager" / "patch_manager.py", patch_metadata_file=files_dir / "PATCHES.json", current_rev=rev, + continue_on_failure=opts.continue_on_failure, ) write_patch_application_stamp(opts.llvm_dir, package_name) write_gentoo_cmake_hack(opts.llvm_dir, ebuild_dir) -- cgit v1.2.3