apply_patches.py: Use `git apply` instead of `patch`
BUG=b:293001194
TEST=./libchrome_tools/apply_patches.py
Change-Id: I8e45e9baeab8a7025ce222dc92bd0bbe997f6a32
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/libchrome/+/4756342
Reviewed-by: Grace Cham <hscham@chromium.org>
Commit-Queue: Ryo Hashimoto <hashimoto@chromium.org>
Tested-by: Ryo Hashimoto <hashimoto@chromium.org>
diff --git a/libchrome_tools/apply_patches.py b/libchrome_tools/apply_patches.py
index 666a208..076f650 100755
--- a/libchrome_tools/apply_patches.py
+++ b/libchrome_tools/apply_patches.py
@@ -44,14 +44,12 @@
):
logging.info("Applying %s...", patch)
if patch.endswith(".patch"):
+ # "-C1" to be compatible with `patch` and to be more robust
+ # against upstream changes.
cmd_args = [
- "patch",
- "--strip=1",
- "--force",
- "--get=0",
- "--no-backup-if-mismatch",
- "--quiet",
- "--input",
+ "git",
+ "apply",
+ "-C1",
patch,
]
elif os.stat(patch).st_mode & stat.S_IXUSR != 0: