diff options
author | Adrian Dole <adriandole@google.com> | 2022-10-05 22:11:44 +0000 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-10-14 17:34:29 +0000 |
commit | b20b2304b692de6a423acb0035303d53c4ee3e3d (patch) | |
tree | cd097883e36d7aca59ed444e5a3036fce6cbb2c0 /llvm_tools/update_chromeos_llvm_hash.py | |
parent | 5971b3261cd08aaa8821f2b57a6e1ad2c0ac511e (diff) | |
download | toolchain-utils-b20b2304b692de6a423acb0035303d53c4ee3e3d.tar.gz |
llvm_tools: update_chromeos_llvm_hash failure modes
Support 'disable_patches' and 'remove_patches'
failure mode options.
BUG=b:250648178
TEST=./patch_utils_unittest.py
./update_chromeos_llvm_hash_unittest.py
./patch_manager_unittest.py
./update_chromeos_llvm_hash [...] --failure_mode remove_patches
./update_chromeos_llvm_hash [...] --failure_mode disable_patches
Change-Id: I6269b2220cf05413c7776087030297773ab9a154
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/3935651
Reviewed-by: Adrian Dole <adriandole@google.com>
Auto-Submit: Adrian Dole <adriandole@google.com>
Tested-by: Adrian Dole <adriandole@google.com>
Reviewed-by: Denis Nikitin <denik@chromium.org>
Reviewed-by: Jordan Abrahams-Whitehead <ajordanr@google.com>
Commit-Queue: Adrian Dole <adriandole@google.com>
Diffstat (limited to 'llvm_tools/update_chromeos_llvm_hash.py')
-rwxr-xr-x | llvm_tools/update_chromeos_llvm_hash.py | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/llvm_tools/update_chromeos_llvm_hash.py b/llvm_tools/update_chromeos_llvm_hash.py index c52c7328..75c6ce6c 100755 --- a/llvm_tools/update_chromeos_llvm_hash.py +++ b/llvm_tools/update_chromeos_llvm_hash.py @@ -411,7 +411,7 @@ def RemovePatchesFromFilesDir(patches): """Removes the patches from $FILESDIR of a package. Args: - patches: A list of absolute pathes of patches to remove + patches: A list of absolute paths of patches to remove Raises: ValueError: Failed to remove a patch in $FILESDIR. @@ -728,13 +728,26 @@ def UpdatePackagesPatchMetadataFile( src_path = Path(dirname) with patch_utils.git_clean_context(src_path): - patches_info = patch_utils.apply_all_from_json( - svn_version=svn_version, - llvm_src_dir=src_path, - patches_json_fp=patches_json_fp, - continue_on_failure=mode - == failure_modes.FailureModes.CONTINUE, - ) + if ( + mode == failure_modes.FailureModes.FAIL + or mode == failure_modes.FailureModes.CONTINUE + ): + patches_info = patch_utils.apply_all_from_json( + svn_version=svn_version, + llvm_src_dir=src_path, + patches_json_fp=patches_json_fp, + continue_on_failure=mode + == failure_modes.FailureModes.CONTINUE, + ) + elif mode == failure_modes.FailureModes.REMOVE_PATCHES: + patches_info = patch_utils.remove_old_patches( + svn_version, src_path, patches_json_fp + ) + elif mode == failure_modes.FailureModes.DISABLE_PATCHES: + patches_info = patch_utils.update_version_ranges( + svn_version, src_path, patches_json_fp + ) + package_info[cur_package] = patches_info._asdict() return package_info |