aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan R Abrahams-Whitehead <ajordanr@google.com>2022-06-14 23:36:55 +0000
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-06-15 17:27:35 +0000
commitc74d39dcf1bcd1b6b4fa25418eb978687c011010 (patch)
tree251dce8567953d93f7971e70d7da2d19d4ef358b
parent472996cf6cd2b9281a1cc3cfb96f1505b20472f0 (diff)
downloadtoolchain-utils-c74d39dcf1bcd1b6b4fa25418eb978687c011010.tar.gz
llvm_tools: Print removed in patch_manager.py
We should print out what we actually did, instead of just exiting silently when everything goes well. This is informative to the user running patch_manager.py code. BUG=b:188465085 TEST=./patch_manager_unittest.py Change-Id: Idcb203d0c3e28d1b00e7b9503334863b7844d033 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/3706059 Reviewed-by: George Burgess <gbiv@chromium.org> Tested-by: Jordan Abrahams-Whitehead <ajordanr@google.com> Commit-Queue: Jordan Abrahams-Whitehead <ajordanr@google.com>
-rwxr-xr-xllvm_tools/patch_manager.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/llvm_tools/patch_manager.py b/llvm_tools/patch_manager.py
index b499d52f..eba3a530 100755
--- a/llvm_tools/patch_manager.py
+++ b/llvm_tools/patch_manager.py
@@ -481,12 +481,15 @@ def RemoveOldPatches(svn_version: int, llvm_src_dir: Path,
patches_list = json.load(f)
patch_entries = (patch_utils.PatchEntry.from_dict(llvm_src_dir, elem)
for elem in patches_list)
- filtered_entries = [
- entry.to_dict() for entry in patch_entries
- if not entry.is_old(svn_version)
- ]
+ oldness = [(entry, entry.is_old(svn_version)) for entry in patch_entries]
+ filtered_entries = [entry.to_dict() for entry, old in oldness if not old]
with patch_utils.atomic_write(patches_json_fp, encoding='utf-8') as f:
_WriteJsonChanges(filtered_entries, f)
+ removed_entries = [entry for entry, old in oldness if old]
+ plural_patches = 'patch' if len(removed_entries) == 1 else 'patches'
+ print(f'Removed {len(removed_entries)} old {plural_patches}:')
+ for r in removed_entries:
+ print(f'- {r.rel_patch_path}: {r.title()}')
def UpdateVersionRanges(svn_version: int, llvm_src_dir: Path,