aboutsummaryrefslogtreecommitdiff
path: root/llvm_tools/patch_sync/src
AgeCommit message (Collapse)Author
2022-02-28llvm_tools: Allow version_range for start/endJordan R Abrahams
At present, the start_version and end_version information are split as far apart as possible due to alphabetical sorting. This leads to bugs when developers want to modify those bug ranges by hand. This CL is the first step to grouping these version ranges together under the `version_range` property. BUG=b:221489531 TEST=python3 patch_manager_unittest.py TEST=cd patch_sync; cargo test TEST=edit PATCHES.json w/ version_range; patch_sync show <...> Change-Id: I9d0fead07c61c0bd0edb745ed623990f0686b8b2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/3490757 Reviewed-by: George Burgess <gbiv@chromium.org> Tested-by: Jordan Abrahams-Whitehead <ajordanr@google.com> Commit-Queue: Jordan Abrahams-Whitehead <ajordanr@google.com>
2022-02-10patch_sync: Toggle CQ for CrOS, AndroidJordan R Abrahams
Currently, patch sync will always run CQ for CrOS, but never for Android. This was because the chrotomation bot didn't have the proper permissions to run the needed Presubmit-Ready checks. Now the bot does in fact have permission to enable the Presubmit check on Android, but some users may not have this permission when running locally. This commit introduces the ability to toggle running the presubmit/CQ checks early through the --disable-cq flags (by default it's assumed that running these checks is desirable). BUG=None TEST=patch_sync transpose --disable-cq <...> TEST=patch_sync transpose <...> Change-Id: I6185b98aa4394ba22f8433541885a450855cfbb4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/3451037 Reviewed-by: George Burgess <gbiv@chromium.org> Commit-Queue: Jordan Abrahams-Whitehead <ajordanr@google.com> Tested-by: Jordan Abrahams-Whitehead <ajordanr@google.com>
2022-02-04patch_sync: Sort android patchesJordan R Abrahams
Android requests that patches are sorted. They use their own __lt__ implementation in cherrypick_cl.py, which we should leverage to keep the sorting stable and robust to implementation details. BUG=b:217767120 TEST=patch_sync transpose <...> Change-Id: I3013b66c4552fd47052e15009df252cdcdc245ad Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/3440375 Reviewed-by: George Burgess <gbiv@chromium.org> Reviewed-by: Pirama Arumuga Nainar <pirama@google.com> Commit-Queue: Jordan Abrahams-Whitehead <ajordanr@google.com> Tested-by: Jordan Abrahams-Whitehead <ajordanr@google.com>
2022-01-25patch_sync: Conduct unconditional cleanupJordan R Abrahams
After any sort of modification, we have to conduct a full cleanup of the workspace. While it's still possible to have a panic cause no cleanup, this is an improvement over the previous work, where cleanup could fail during the transpose stage. Also add a --wip mode to prevent spamming people with emails during testing. BUG=b:209493133 TEST=Running patch_sync transpose locally Change-Id: I01e8a5897ec8eeed8f90c528c567b2ba55613b23 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/3407914 Reviewed-by: George Burgess <gbiv@chromium.org> Tested-by: Jordan Abrahams-Whitehead <ajordanr@google.com> Commit-Queue: Jordan Abrahams-Whitehead <ajordanr@google.com>
2022-01-22patch_sync: Fix for Rust 1.55 compat, cli patchJordan R Abrahams
On chrotomation, we still use Rust 1.55. Rust 1.55 does not have the "from" implementation for arrays, so we must build the BTrees by hand. Additionally, this removes the requirement for having the review strings be set. BUG=b:209493133 TEST=cargo check Change-Id: I6bc16e96cd56775c8c80667395f3dc3fb4857356 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/3403387 Tested-by: Jordan Abrahams-Whitehead <ajordanr@google.com> Reviewed-by: George Burgess <gbiv@chromium.org> Commit-Queue: Jordan Abrahams-Whitehead <ajordanr@google.com>
2022-01-14patch_sync: Rework show cmd to display mergedJordan R Abrahams
At present, patch_sync show merges two PATCHES.json files by merging their platform contents. However, because of timing, review latency, or just patches being denied, it's possible that one repo recommends a patch being applied to a certain platform, and the other denies that same patch. To resolve this conflict, this commit by default only considers patches that exist in the PATCHES.json file at the present time. The original behaviour can be enabled by turning on --keep-unmerged. BUG=b:209493133 TEST=patch_sync show <...cros> <...android> TEST=patch_sync transpose --dry-run -s <...> Change-Id: I3bdf6c36b4dbfe26d4221191b5c22363a7f0dfe0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/3388390 Reviewed-by: George Burgess <gbiv@chromium.org> Tested-by: Jordan Abrahams-Whitehead <ajordanr@google.com> Commit-Queue: Jordan Abrahams-Whitehead <ajordanr@google.com>
2022-01-14patch_sync: Filter patches betterJordan R Abrahams
This commit introduces better patch filtering. Specifically, * it prevents patches from being reintroduced to repos which already have those patches in their own PATCHES.json. * it only applies android patches which are within the desired version range. BUG=b:209493133 TEST=patch_sync transpose --no-commit -s <...> Change-Id: I667a095395a36edf290e5e652ae40efaa2df7d57 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/3382194 Reviewed-by: George Burgess <gbiv@chromium.org> Tested-by: Jordan Abrahams-Whitehead <ajordanr@google.com> Commit-Queue: Jordan Abrahams-Whitehead <ajordanr@google.com>
2022-01-14patch_sync: Bugfix for ebuild findingJordan R Abrahams
Previously, the find_ebuild function could return the original ebuild instead of the llvm symlink. This would lead to incorrect uprevs, depending on how the file system returned the order of the files. Adds a test case to prevent this from happening in the future. BUG=b:209493133 TEST=cargo test Change-Id: Ia47ecee2a9c5b6ce0559e316c5227f70dcf87833 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/3379482 Reviewed-by: George Burgess <gbiv@chromium.org> Tested-by: Jordan Abrahams-Whitehead <ajordanr@google.com> Commit-Queue: Jordan Abrahams-Whitehead <ajordanr@google.com>
2022-01-14patch_sync: Refactor shared main codeJordan R Abrahams
This commit attempts to remove duplicated code between Android and CrOS, as the complexity between this duplicated code exceeded the scope of the main file. Also adds display_patches code. This is to pretty print what patches are getting applied and to where. Only enabled if --verbose is on. Also does some minor function cleanup in version_control.rs. BUG=b:209493133 TEST=cargo test TEST=patch_sync transpose --dry-run --verbose <...> Change-Id: I63410160ff5159f4c079ac1cc189674fe3fc02a0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/3379481 Reviewed-by: George Burgess <gbiv@chromium.org> Tested-by: Jordan Abrahams-Whitehead <ajordanr@google.com> Commit-Queue: Jordan Abrahams-Whitehead <ajordanr@google.com>
2022-01-14patch_sync: Fix PatchDictSchema fieldsJordan R Abrahams
These were out of alphabetical order, and serde_json would write them in the incorrect order to the PATCHES.json file. Additionally, the `platforms` field may end up being null after some discussion with the Android team. This converts platforms to an Optional accordingly. BUG=b:209493133 TEST=patch_sync transpose <...> Change-Id: I7c0b2e984d713698a0ed53e7f36b38bef1a49d1c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/3379480 Reviewed-by: George Burgess <gbiv@chromium.org> Tested-by: Jordan Abrahams-Whitehead <ajordanr@google.com> Commit-Queue: Jordan Abrahams-Whitehead <ajordanr@google.com>
2022-01-13patch_sync: Commit featuresJordan R Abrahams
This adds several important version control features: * Changes branches on set up. * Cleans up any changes made, even if upload fails. * Sends commits for review (enabled via CLI). * Enables CQ for CrOS. BUG=b:209493133 TEST=cargo test Change-Id: I8ab2650aae301c08fd80358162a285e46d44e3e1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/3379479 Reviewed-by: George Burgess <gbiv@chromium.org> Commit-Queue: Jordan Abrahams-Whitehead <ajordanr@google.com> Tested-by: Jordan Abrahams-Whitehead <ajordanr@google.com>
2022-01-13patch_sync: Add better command debuggingJordan R Abrahams
This commit allows the git commands to print out what the command was that they failed at. This is pretty helpful in debugging what went wrong. We don't capture the repo output ever, so that can remained piped to the terminal. But we need to do some trickery for the git cmd. BUG=b:209493133 TEST=None Change-Id: I389257fef1e3bf394fb4013588df6c78e83b733a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/3379478 Reviewed-by: George Burgess <gbiv@chromium.org> Reviewed-by: Michael Benfield <mbenfield@google.com> Tested-by: Jordan Abrahams-Whitehead <ajordanr@google.com> Commit-Queue: Jordan Abrahams-Whitehead <ajordanr@google.com>
2022-01-08patch_sync: Filter patches by platformJordan R Abrahams
Because some patch collections may contain patches which don't apply to our given platform, we don't want to attempt to lookup their hashes. If we do, we may encounter a file-not-found error, as those patches haven't been ported to this platform. Also fixes a bug where no_commit was inverted. BUG=b:209493133 TEST=N/A Change-Id: I8b86133dfc6361919174f9f9b392d756b4304d2b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/3364792 Reviewed-by: George Burgess <gbiv@chromium.org> Tested-by: Jordan Abrahams-Whitehead <ajordanr@google.com> Commit-Queue: Jordan Abrahams-Whitehead <ajordanr@google.com>
2022-01-04patch_sync: Add show subcommandJordan R Abrahams
This allows users to view the combined PATCHES.json, also known as the source of truth. Also makes some changes so that serializing the patches vec to a string is more natural. BUG=b:209493133 TEST=cargo test TEST=patch_sync show -s <cros_checkout> <android_checkout> Change-Id: Ic2054c0c3c7e0bb03b698339b75e9ccc6dd68c74 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/3355361 Reviewed-by: Michael Benfield <mbenfield@google.com> Tested-by: Jordan Abrahams <ajordanr@google.com> Commit-Queue: Jordan Abrahams <ajordanr@google.com>
2022-01-04patch_sync: Add patch_parsing moduleJordan R Abrahams
At present, the patch_sync code does nothing as the base version only sets up the code for future reviews. This adds in the ability to parse the PATCHES.json files, check the differences across past versions, and transpose those patches to another repo. This parsing assumes the PATCHES.json now use the uniform schema, which the AOSP currently does, but CrOS may not by the time this commit lands. BUG=b:209493133 TEST=cargo build TEST=cargo test Change-Id: I8de01eae3d9555dbb000378516a5bf38e29fea8e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/3339405 Reviewed-by: George Burgess <gbiv@chromium.org> Tested-by: Jordan Abrahams <ajordanr@google.com> Commit-Queue: Jordan Abrahams <ajordanr@google.com>
2022-01-04patch_sync: Base code, version control managingJordan R Abrahams
This is the base code addition for the patch_sync project. This project attempts to synchronize LLVM patches and ChromeOS. This code is not meant to run, but simply be the starting point so that we break up the large code dump. This code is meant to compile, but is not meant to be run. It only adds the version control code which manages `repo` interactions. Additionally, this adds the full Cargo.toml (at least for the current patch stack). BUG=b:209493133 TEST=cargo build Change-Id: I903edba6e633ec53a7fa4d2e7b0c2aac1094933a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/3339404 Reviewed-by: George Burgess <gbiv@chromium.org> Tested-by: Jordan Abrahams <ajordanr@google.com> Commit-Queue: Jordan Abrahams <ajordanr@google.com>