aboutsummaryrefslogtreecommitdiff
path: root/llvm_tools/patch_sync/src/main.rs
diff options
context:
space:
mode:
authorJordan R Abrahams <ajordanr@google.com>2022-01-19 23:51:36 +0000
committerCommit Bot <commit-bot@chromium.org>2022-01-22 01:16:33 +0000
commit86d317a4fdb5f603df849b7056815db5ebe30804 (patch)
treecdb8d8de13f3585d6471ece3ccdfaab72b498649 /llvm_tools/patch_sync/src/main.rs
parentf96fffcd3c3bcfa3af9fed129aed3466ee9adc1b (diff)
downloadtoolchain-utils-86d317a4fdb5f603df849b7056815db5ebe30804.tar.gz
patch_sync: Fix for Rust 1.55 compat, cli patch
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>
Diffstat (limited to 'llvm_tools/patch_sync/src/main.rs')
-rw-r--r--llvm_tools/patch_sync/src/main.rs18
1 files changed, 11 insertions, 7 deletions
diff --git a/llvm_tools/patch_sync/src/main.rs b/llvm_tools/patch_sync/src/main.rs
index 8c1eff1c..033691e4 100644
--- a/llvm_tools/patch_sync/src/main.rs
+++ b/llvm_tools/patch_sync/src/main.rs
@@ -37,13 +37,14 @@ fn main() -> Result<()> {
no_commit,
} => transpose_subcmd(TransposeOpt {
cros_checkout_path,
- cros_reviewers: cros_reviewers.split(',').map(ToOwned::to_owned).collect(),
+ cros_reviewers: cros_reviewers
+ .map(|r| r.split(',').map(ToOwned::to_owned).collect())
+ .unwrap_or_default(),
old_cros_ref,
android_checkout_path,
android_reviewers: android_reviewers
- .split(',')
- .map(ToOwned::to_owned)
- .collect(),
+ .map(|r| r.split(',').map(ToOwned::to_owned).collect())
+ .unwrap_or_default(),
old_android_ref,
sync,
verbose,
@@ -80,8 +81,11 @@ fn show_subcmd(args: ShowOpt) -> Result<()> {
parsed_collection
} else {
filter_patches_by_platform(&parsed_collection, platform).map_patches(|p| {
+ // Need to do this platforms creation as Rust 1.55 cannot use "from".
+ let mut platforms = BTreeSet::new();
+ platforms.insert(platform.to_string());
PatchDictSchema {
- platforms: BTreeSet::from([platform.to_string()]),
+ platforms,
..p.clone()
}
})
@@ -230,7 +234,7 @@ enum Opt {
/// Emails to send review requests to during Chromium OS upload.
/// Comma separated.
#[structopt(long = "cros-rev")]
- cros_reviewers: String,
+ cros_reviewers: Option<String>,
/// Git ref (e.g. hash) for the ChromiumOS overlay to use as the base.
#[structopt(long = "overlay-base-ref")]
@@ -243,7 +247,7 @@ enum Opt {
/// Emails to send review requests to during Android upload.
/// Comma separated.
#[structopt(long = "aosp-rev")]
- android_reviewers: String,
+ android_reviewers: Option<String>,
/// Git ref (e.g. hash) for the llvm_android repo to use as the base.
#[structopt(long = "aosp-base-ref")]