[upstream_utils] Use "git am" instead of "git apply" for patches (#4248)

This creates actual commits in the thirdparty repo, which makes rebasing
them onto new versions much easier.
This commit is contained in:
Tyler Veness
2022-05-18 12:23:15 -07:00
committed by GitHub
parent 4253d6d5f0
commit 8bd614bb1e
6 changed files with 136 additions and 90 deletions

View File

@@ -3,13 +3,18 @@
import os
import shutil
from upstream_utils import setup_upstream_repo, comment_out_invalid_includes, walk_cwd_and_copy_if, apply_patches
from upstream_utils import setup_upstream_repo, comment_out_invalid_includes, walk_cwd_and_copy_if, am_patches
def main():
root, repo = setup_upstream_repo("https://github.com/fmtlib/fmt", "8.1.1")
wpiutil = os.path.join(root, "wpiutil")
# Apply patches to original git repo
prefix = os.path.join(root, "upstream_utils/fmt_patches")
am_patches(
repo, [os.path.join(prefix, "0001-Don-t-throw-on-write-failure.patch")])
# Delete old install
for d in ["src/main/native/fmtlib/src", "src/main/native/fmtlib/include"]:
shutil.rmtree(os.path.join(wpiutil, d), ignore_errors=True)
@@ -31,9 +36,6 @@ def main():
comment_out_invalid_includes(
f, [os.path.join(wpiutil, "src/main/native/fmtlib/include")])
apply_patches(root,
["upstream_utils/fmt-dont-throw-on-write-failure.patch"])
if __name__ == "__main__":
main()