mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-03 03:01:44 +00:00
[upstream_utils] Refactor upstream_utils scripts (#4367)
* Root folder variable names are now more descriptive * clone_repo() now restores the current working directory * Removed setup_upstream_repo() since it's now identical to clone_repo() * Moved am_patches()'s for loop into user scripts so the filename prefix doesn't need to be included in every patch filename * Renamed am_patches() to git_am() since its only job now is to run "git am" * Removed unused apply_patches() function * Fixed typo in git_am()'s ignore_whitespace arg name
This commit is contained in:
@@ -4,12 +4,11 @@ import os
|
||||
import shutil
|
||||
|
||||
from upstream_utils import (
|
||||
setup_upstream_repo,
|
||||
get_repo_root,
|
||||
clone_repo,
|
||||
comment_out_invalid_includes,
|
||||
walk_cwd_and_copy_if,
|
||||
am_patches,
|
||||
walk_if,
|
||||
copy_to,
|
||||
git_am,
|
||||
)
|
||||
|
||||
|
||||
@@ -153,54 +152,49 @@ def overwrite_tests(wpiutil_root, llvm_root):
|
||||
|
||||
|
||||
def main():
|
||||
root, repo = setup_upstream_repo(
|
||||
"https://github.com/llvm/llvm-project", "llvmorg-14.0.6"
|
||||
)
|
||||
wpiutil = os.path.join(root, "wpiutil")
|
||||
upstream_root = clone_repo("https://github.com/llvm/llvm-project", "llvmorg-14.0.6")
|
||||
wpilib_root = get_repo_root()
|
||||
wpiutil = os.path.join(wpilib_root, "wpiutil")
|
||||
|
||||
patch_root = os.path.join(root, "upstream_utils/llvm_patches")
|
||||
frontend_patches = [
|
||||
os.path.join(patch_root, "0001-Fix-spelling-language-errors.patch"),
|
||||
os.path.join(patch_root, "0002-Remove-StringRef-ArrayRef-and-Optional.patch"),
|
||||
os.path.join(
|
||||
patch_root,
|
||||
"0003-Wrap-std-min-max-calls-in-parens-for-Windows-warning.patch",
|
||||
),
|
||||
os.path.join(patch_root, "0004-Change-unique_function-storage-size.patch"),
|
||||
os.path.join(patch_root, "0005-Threading-updates.patch"),
|
||||
os.path.join(patch_root, "0006-ifdef-guard-safety.patch"),
|
||||
os.path.join(patch_root, "0007-Explicitly-use-std.patch"),
|
||||
os.path.join(patch_root, "0008-Remove-format_provider.patch"),
|
||||
os.path.join(patch_root, "0009-Add-compiler-warning-pragmas.patch"),
|
||||
os.path.join(patch_root, "0010-Remove-unused-functions.patch"),
|
||||
os.path.join(patch_root, "0011-Detemplatize-SmallVectorBase.patch"),
|
||||
os.path.join(patch_root, "0012-Add-vectors-to-raw_ostream.patch"),
|
||||
os.path.join(patch_root, "0013-Extra-collections-features.patch"),
|
||||
os.path.join(patch_root, "0014-EpochTracker-ABI-macro.patch"),
|
||||
os.path.join(patch_root, "0015-Delete-numbers-from-MathExtras.patch"),
|
||||
os.path.join(patch_root, "0016-Add-lerp-and-sgn.patch"),
|
||||
os.path.join(patch_root, "0017-Fixup-includes.patch"),
|
||||
os.path.join(patch_root, "0018-Use-std-is_trivially_copy_constructible.patch"),
|
||||
os.path.join(patch_root, "0019-Windows-support.patch"),
|
||||
os.path.join(patch_root, "0020-Prefer-fmtlib.patch"),
|
||||
os.path.join(patch_root, "0021-Prefer-wpi-s-fs.h.patch"),
|
||||
os.path.join(patch_root, "0022-Remove-unused-functions.patch"),
|
||||
os.path.join(patch_root, "0023-OS-specific-changes.patch"),
|
||||
os.path.join(patch_root, "0024-Use-SmallVector-for-UTF-conversion.patch"),
|
||||
os.path.join(
|
||||
patch_root, "0025-Prefer-to-use-static-pointers-in-raw_ostream.patch"
|
||||
),
|
||||
os.path.join(patch_root, "0026-constexpr-endian-byte-swap.patch"),
|
||||
os.path.join(
|
||||
patch_root,
|
||||
"0027-Copy-type-traits-from-STLExtras.h-into-PointerUnion..patch",
|
||||
),
|
||||
os.path.join(patch_root, "0028-Remove-StringMap-test-for-llvm-sort.patch"),
|
||||
]
|
||||
am_patches(repo, frontend_patches, use_threeway=True)
|
||||
# Apply patches to upstream Git repo
|
||||
os.chdir(upstream_root)
|
||||
for f in [
|
||||
"0001-Fix-spelling-language-errors.patch",
|
||||
"0002-Remove-StringRef-ArrayRef-and-Optional.patch",
|
||||
"0003-Wrap-std-min-max-calls-in-parens-for-Windows-warning.patch",
|
||||
"0004-Change-unique_function-storage-size.patch",
|
||||
"0005-Threading-updates.patch",
|
||||
"0006-ifdef-guard-safety.patch",
|
||||
"0007-Explicitly-use-std.patch",
|
||||
"0008-Remove-format_provider.patch",
|
||||
"0009-Add-compiler-warning-pragmas.patch",
|
||||
"0010-Remove-unused-functions.patch",
|
||||
"0011-Detemplatize-SmallVectorBase.patch",
|
||||
"0012-Add-vectors-to-raw_ostream.patch",
|
||||
"0013-Extra-collections-features.patch",
|
||||
"0014-EpochTracker-ABI-macro.patch",
|
||||
"0015-Delete-numbers-from-MathExtras.patch",
|
||||
"0016-Add-lerp-and-sgn.patch",
|
||||
"0017-Fixup-includes.patch",
|
||||
"0018-Use-std-is_trivially_copy_constructible.patch",
|
||||
"0019-Windows-support.patch",
|
||||
"0020-Prefer-fmtlib.patch",
|
||||
"0021-Prefer-wpi-s-fs.h.patch",
|
||||
"0022-Remove-unused-functions.patch",
|
||||
"0023-OS-specific-changes.patch",
|
||||
"0024-Use-SmallVector-for-UTF-conversion.patch",
|
||||
"0025-Prefer-to-use-static-pointers-in-raw_ostream.patch",
|
||||
"0026-constexpr-endian-byte-swap.patch",
|
||||
"0027-Copy-type-traits-from-STLExtras.h-into-PointerUnion..patch",
|
||||
"0028-Remove-StringMap-test-for-llvm-sort.patch",
|
||||
]:
|
||||
git_am(
|
||||
os.path.join(wpilib_root, "upstream_utils/llvm_patches", f),
|
||||
use_threeway=True,
|
||||
)
|
||||
|
||||
overwrite_source(wpiutil, repo)
|
||||
overwrite_tests(wpiutil, repo)
|
||||
overwrite_source(wpiutil, upstream_root)
|
||||
overwrite_tests(wpiutil, upstream_root)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user