-
Notifications
You must be signed in to change notification settings - Fork 610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[upstream_utils] Rework upstream_utils scripts #6829
[upstream_utils] Rework upstream_utils scripts #6829
Conversation
Turns out that is how wpiformat wants it
Implementing them here seems fine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried updating Sleipnir, and it broke:
[tav@myriad upstream_utils]$ ./sleipnir.py clone
INFO: Opening repository at /tmp/Sleipnir
Cloning into 'Sleipnir'...
remote: Enumerating objects: 709, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 709 (delta 0), reused 5 (delta 0), pack-reused 704
Receiving objects: 100% (709/709), 500.16 KiB | 1.09 MiB/s, done.
remote: Enumerating objects: 56, done.
remote: Counting objects: 100% (16/16), done.
remote: Compressing objects: 100% (15/15), done.
remote: Total 56 (delta 0), reused 5 (delta 0), pack-reused 40
Receiving objects: 100% (56/56), 9.78 KiB | 9.78 MiB/s, done.
remote: Enumerating objects: 206, done.
remote: Counting objects: 100% (127/127), done.
remote: Compressing objects: 100% (120/120), done.
remote: Total 206 (delta 28), reused 10 (delta 7), pack-reused 79
Receiving objects: 100% (206/206), 449.69 KiB | 2.32 MiB/s, done.
Resolving deltas: 100% (34/34), done.
remote: Enumerating objects: 56, done.
remote: Counting objects: 100% (14/14), done.
remote: Compressing objects: 100% (13/13), done.
remote: Total 56 (delta 0), reused 8 (delta 0), pack-reused 42
Receiving objects: 100% (56/56), 9.75 KiB | 1.39 MiB/s, done.
remote: Enumerating objects: 27, done.
remote: Counting objects: 100% (20/20), done.
remote: Compressing objects: 100% (20/20), done.
remote: Total 27 (delta 3), reused 2 (delta 0), pack-reused 7
Receiving objects: 100% (27/27), 25.70 KiB | 548.00 KiB/s, done.
Resolving deltas: 100% (3/3), done.
HEAD is now at b6ffa2d Don't use pool allocator on Windows (#597)
[tav@myriad upstream_utils]$ ./sleipnir.py rebase 9b50f5d293d74f37f95788ea6cc25a87c32c3d7c
INFO: Opening repository at /tmp/Sleipnir
From https://github.com/SleipnirGroup/Sleipnir
* branch 9b50f5d293d74f37f95788ea6cc25a87c32c3d7c -> FETCH_HEAD
HEAD is now at b6ffa2d Don't use pool allocator on Windows (#597)
Successfully rebased and updated detached HEAD.
[tav@myriad upstream_utils]$ ./sleipnir.py format-patch
INFO: Opening repository at /tmp/Sleipnir
0001-Migrate-from-pybind11-to-nanobind-598.patch
remote: Enumerating objects: 56, done.
remote: Counting objects: 100% (16/16), done.
remote: Compressing objects: 100% (15/15), done.
remote: Total 56 (delta 0), reused 6 (delta 0), pack-reused 40
Receiving objects: 100% (56/56), 9.78 KiB | 9.78 MiB/s, done.
remote: Enumerating objects: 2, done.
remote: Counting objects: 100% (2/2), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 2 (delta 0), reused 1 (delta 0), pack-reused 0
Receiving objects: 100% (2/2), 4.64 KiB | 4.64 MiB/s, done.
0002-Only-use-clang-cl-in-Windows-Python-builds-599.patch
0003-Remove-using-enum-declarations.patch
0004-Use-fmtlib.patch
0005-Remove-unsupported-constexpr.patch
0006-Use-wpi-SmallVector.patch
0007-Suppress-clang-tidy-false-positives.patch
Traceback (most recent call last):
File "/home/tav/frc/wpilib/allwpilib/upstream_utils/./sleipnir.py", line 74, in <module>
main()
File "/home/tav/frc/wpilib/allwpilib/upstream_utils/./sleipnir.py", line 70, in main
sleipnir.main()
File "/home/tav/frc/wpilib/allwpilib/upstream_utils/upstream_utils.py", line 466, in main
self.format_patch(args.new_tag)
File "/home/tav/frc/wpilib/allwpilib/upstream_utils/upstream_utils.py", line 399, in format_patch
os.rename(f, os.path.join(patch_dest, f))
OSError: [Errno 18] Invalid cross-device link: '0001-Migrate-from-pybind11-to-nanobind-598.patch' -> '/home/tav/frc/wpilib/allwpilib/upstream_utils/sleipnir_patches/0001-Migrate-from-pybind11-to-nanobind-598.patch'
upstream_utils.py should delete the contents of the patch folder first, then use shutil.move()
on the new patches.
Clear the patch directory first Use shutil.move instead to handle different filesystems for temp dir and allwpilib
upstream_utils generated two more patches than it should have for the Sleipnir update. One of these commands should be updating the tag in sleipnir.py so it generates patches for the correct range. [tav@myriad upstream_utils]$ ./sleipnir.py clone
INFO: Opening repository at /tmp/Sleipnir
Cloning into 'Sleipnir'...
remote: Enumerating objects: 709, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 709 (delta 0), reused 5 (delta 0), pack-reused 704
Receiving objects: 100% (709/709), 500.16 KiB | 1.83 MiB/s, done.
remote: Enumerating objects: 56, done.
remote: Counting objects: 100% (16/16), done.
remote: Compressing objects: 100% (15/15), done.
remote: Total 56 (delta 0), reused 5 (delta 0), pack-reused 40
Receiving objects: 100% (56/56), 9.78 KiB | 9.78 MiB/s, done.
remote: Enumerating objects: 206, done.
remote: Counting objects: 100% (127/127), done.
remote: Compressing objects: 100% (120/120), done.
remote: Total 206 (delta 28), reused 10 (delta 7), pack-reused 79
Receiving objects: 100% (206/206), 449.69 KiB | 2.71 MiB/s, done.
Resolving deltas: 100% (34/34), done.
remote: Enumerating objects: 56, done.
remote: Counting objects: 100% (14/14), done.
remote: Compressing objects: 100% (13/13), done.
remote: Total 56 (delta 0), reused 8 (delta 0), pack-reused 42
Receiving objects: 100% (56/56), 9.75 KiB | 9.75 MiB/s, done.
remote: Enumerating objects: 27, done.
remote: Counting objects: 100% (20/20), done.
remote: Compressing objects: 100% (20/20), done.
remote: Total 27 (delta 3), reused 2 (delta 0), pack-reused 7
Receiving objects: 100% (27/27), 25.70 KiB | 560.00 KiB/s, done.
Resolving deltas: 100% (3/3), done.
HEAD is now at b6ffa2d Don't use pool allocator on Windows (#597)
[tav@myriad upstream_utils]$ ./sleipnir.py rebase 9b50f5d293d74f37f95788ea6cc25a87c32c3d7c
INFO: Opening repository at /tmp/Sleipnir
From https://github.com/SleipnirGroup/Sleipnir
* branch 9b50f5d293d74f37f95788ea6cc25a87c32c3d7c -> FETCH_HEAD
HEAD is now at b6ffa2d Don't use pool allocator on Windows (#597)
Successfully rebased and updated detached HEAD.
[tav@myriad upstream_utils]$ ./sleipnir.py format-patch
INFO: Opening repository at /tmp/Sleipnir
0001-Migrate-from-pybind11-to-nanobind-598.patch
remote: Enumerating objects: 56, done.
remote: Counting objects: 100% (16/16), done.
remote: Compressing objects: 100% (15/15), done.
Receiving objects: 100% (56/56), 9.78 KiB | 9.78 MiB/s, done.
remote: Total 56 (delta 0), reused 6 (delta 0), pack-reused 40
remote: Enumerating objects: 2, done.
remote: Counting objects: 100% (2/2), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 2 (delta 0), reused 1 (delta 0), pack-reused 0
Receiving objects: 100% (2/2), 4.64 KiB | 4.64 MiB/s, done.
0002-Only-use-clang-cl-in-Windows-Python-builds-599.patch
0003-Remove-using-enum-declarations.patch
0004-Use-fmtlib.patch
0005-Remove-unsupported-constexpr.patch
0006-Use-wpi-SmallVector.patch
0007-Suppress-clang-tidy-false-positives.patch
WARNING: Automatically updating tag in line 59 with a comment above it that may need updating.
WARNING: The patch directory has patches ['0001-Migrate-from-pybind11-to-nanobind-598.patch', '0002-Only-use-clang-cl-in-Windows-Python-builds-599.patch', '0003-Remove-using-enum-declarations.patch', '0004-Use-fmtlib.patch', '0005-Remove-unsupported-constexpr.patch', '0006-Use-wpi-SmallVector.patch', '0007-Suppress-clang-tidy-false-positives.patch'] not in the patch list
WARNING: The patch list has patches ['0001-Remove-using-enum-declarations.patch', '0002-Use-fmtlib.patch', '0003-Remove-unsupported-constexpr.patch', '0004-Use-wpi-SmallVector.patch', '0005-Suppress-clang-tidy-false-positives.patch'] not in the patch directory [tav@myriad allwpilib]$ git st
On branch upstream-utils-commands
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
deleted: upstream_utils/sleipnir_patches/0001-Remove-using-enum-declarations.patch
deleted: upstream_utils/sleipnir_patches/0002-Use-fmtlib.patch
deleted: upstream_utils/sleipnir_patches/0003-Remove-unsupported-constexpr.patch
deleted: upstream_utils/sleipnir_patches/0004-Use-wpi-SmallVector.patch
deleted: upstream_utils/sleipnir_patches/0005-Suppress-clang-tidy-false-positives.patch
Untracked files:
(use "git add <file>..." to include in what will be committed)
upstream_utils/sleipnir_patches/0001-Migrate-from-pybind11-to-nanobind-598.patch
upstream_utils/sleipnir_patches/0002-Only-use-clang-cl-in-Windows-Python-builds-599.patch
upstream_utils/sleipnir_patches/0003-Remove-using-enum-declarations.patch
upstream_utils/sleipnir_patches/0004-Use-fmtlib.patch
upstream_utils/sleipnir_patches/0005-Remove-unsupported-constexpr.patch
upstream_utils/sleipnir_patches/0006-Use-wpi-SmallVector.patch
upstream_utils/sleipnir_patches/0007-Suppress-clang-tidy-false-positives.patch
no changes added to commit (use "git add" and/or "git commit -a") |
Seems like |
If |
Currently, Going forward, I can think of two options:
I like 1 better since when possible, it usually goes better to make stuff work than to tell people not to do it. |
Having rebase override the old script tag puts the tag and patches in the upstream_utils folder in an inconsistent state. We could avoid that by putting all metadata in the upstream git repo. One thing I can think of is having a movable tag in the upstream repo that designates the root of the patch series (e.g., |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Sleipnir update works now.
upstream_utils.py's functions need docstrings.
Don't redundantly specify the tag
Fixes #6818
Notes:
./<lib>.py info
: Displays information about the library. (Mostly useful for clone directory, URL, tag, and patch list, but we might as well include the rest of the constructor arguments)./<lib>.py reset
: Effectively./<lib>.py rebase <current tag>
- Resets the clone to the tag and applies the patches. (Useful for adding new patches)new-tag
argument toformat-patch
default to the current tag. (Useful for adding new patches)eigen.py
)