mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-03 03:01:44 +00:00
[upstream_utils] Rework upstream_utils scripts (#6829)
This commit is contained in:
@@ -20,59 +20,24 @@ versions. Each library has its own patch directory (e.g., `lib_patches`).
|
||||
The example below will update a hypothetical library called `lib` to the tag
|
||||
`2.0`.
|
||||
|
||||
Start in the `upstream_utils` folder. Restore the original repo.
|
||||
Start in the `upstream_utils` folder. Make sure a clone of the upstream repo exists.
|
||||
```bash
|
||||
./update_<lib>.py
|
||||
./<lib>.py clone
|
||||
```
|
||||
|
||||
Navigate to the repo.
|
||||
Rebase the clone of the upstream repo.
|
||||
```bash
|
||||
cd /tmp/lib
|
||||
./<lib>.py rebase 2.0
|
||||
```
|
||||
|
||||
Fetch the desired version using one of the following methods.
|
||||
Update the `upstream_utils` patch files and the tag in the script.
|
||||
```bash
|
||||
# Fetch a full branch or tag
|
||||
git fetch origin 2.0
|
||||
|
||||
# Fetch just a tag (useful for expensive-to-clone repos)
|
||||
git fetch --depth 1 origin tag 2.0
|
||||
./<lib>.py format-patch
|
||||
```
|
||||
|
||||
Rebase any patches onto the new version. If the old version and new version are
|
||||
on the same branch, run the following.
|
||||
Copy the updated upstream files into the thirdparty files within allwpilib.
|
||||
```bash
|
||||
git rebase 2.0
|
||||
```
|
||||
|
||||
If the old version and new version are on different branches (e.g.,
|
||||
llvm-project), use interactive rebase instead and remove commits that are common
|
||||
between the two branches from the list of commits to rebase. In other words,
|
||||
only commits representing downstream patches should be listed.
|
||||
```bash
|
||||
git rebase -i 2.0
|
||||
```
|
||||
|
||||
Generate patch files for the new version.
|
||||
```bash
|
||||
git format-patch 2.0..HEAD --zero-commit --abbrev=40 --no-signature
|
||||
```
|
||||
|
||||
Move the patch files to `upstream_utils`.
|
||||
```
|
||||
mv *.patch allwpilib/upstream_utils/lib_patches
|
||||
```
|
||||
|
||||
Navigate back to `upstream_utils`.
|
||||
```bash
|
||||
cd allwpilib/upstream_utils
|
||||
```
|
||||
|
||||
Modify the version number in the call to `setup_upstream_repo()` in
|
||||
`update_<lib>.py`, then rerun `update_<lib>.py` to reimport the thirdparty
|
||||
files.
|
||||
```bash
|
||||
./update_<lib>.py
|
||||
./<lib>.py copy-upstream-to-thirdparty
|
||||
```
|
||||
|
||||
## Adding patch to thirdparty library
|
||||
@@ -80,12 +45,17 @@ files.
|
||||
The example below will add a new patch file to a hypothetical library called
|
||||
`lib` (Replace `<lib>` with `llvm`, `fmt`, `eigen`, ... in the following steps).
|
||||
|
||||
Start in the `upstream_utils` folder. Restore the original repo.
|
||||
Start in the `upstream_utils` folder. Make sure a clone of the upstream repo exists.
|
||||
```bash
|
||||
./update_<lib>.py
|
||||
./<lib>.py clone
|
||||
```
|
||||
|
||||
Navigate to the repo.
|
||||
Update the clone of the upstream repo.
|
||||
```bash
|
||||
./<lib>.py reset
|
||||
```
|
||||
|
||||
Navigate to the repo. If you can't find it, the directory of the clone is printed at the start of the `clone` command.
|
||||
```bash
|
||||
cd /tmp/<lib>
|
||||
```
|
||||
@@ -96,24 +66,17 @@ git add ...
|
||||
git commit -m "..."
|
||||
```
|
||||
|
||||
Generate patch files.
|
||||
```bash
|
||||
git format-patch 2.0..HEAD --zero-commit --abbrev=40 --no-signature
|
||||
```
|
||||
where `2.0` is replaced with the version specified in `update_<lib>.py`.
|
||||
|
||||
Move the patch files to `upstream_utils`.
|
||||
```
|
||||
mv *.patch allwpilib/upstream_utils/<lib>_patches
|
||||
```
|
||||
|
||||
Navigate back to `upstream_utils`.
|
||||
```bash
|
||||
cd allwpilib/upstream_utils
|
||||
```
|
||||
|
||||
Update the list of patch files in `update_<lib>.py`, then rerun
|
||||
`update_<lib>.py` to reimport the thirdparty files.
|
||||
Update the `upstream_utils` patch files.
|
||||
```bash
|
||||
./update_<lib>.py
|
||||
./<lib>.py format-patch
|
||||
```
|
||||
|
||||
Update the list of patch files in `<lib>.py`, then rerun `<lib>.py` to reimport the thirdparty files.
|
||||
```bash
|
||||
./<lib>.py copy-upstream-to-thirdparty
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user