Teach solana-install about release channels (#5372)
$ solana-install init edge # <-- setup an install using the edge channel $ solana-install update # <-- update to the latest edge channel release
This commit is contained in:
@@ -33,13 +33,20 @@ fn is_pubkey(string: String) -> Result<(), String> {
|
||||
}
|
||||
}
|
||||
|
||||
fn is_semver(string: String) -> Result<(), String> {
|
||||
match semver::Version::parse(&string) {
|
||||
fn is_semver(semver: &str) -> Result<(), String> {
|
||||
match semver::Version::parse(&semver) {
|
||||
Ok(_) => Ok(()),
|
||||
Err(err) => Err(format!("{:?}", err)),
|
||||
}
|
||||
}
|
||||
|
||||
fn is_release_channel(channel: &str) -> Result<(), String> {
|
||||
match channel {
|
||||
"edge" | "beta" | "stable" => Ok(()),
|
||||
_ => Err(format!("Invalid release channel {}", channel)),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn main() -> Result<(), String> {
|
||||
solana_logger::setup();
|
||||
|
||||
@@ -107,12 +114,12 @@ pub fn main() -> Result<(), String> {
|
||||
}
|
||||
})
|
||||
.arg(
|
||||
Arg::with_name("release_semver")
|
||||
.value_name("release-semver")
|
||||
Arg::with_name("explicit_release")
|
||||
.value_name("release")
|
||||
.index(1)
|
||||
.conflicts_with_all(&["json_rpc_url", "update_manifest_pubkey"])
|
||||
.validator(is_semver)
|
||||
.help("The exact version to install. Updates will not be available if this argument is used"),
|
||||
.validator(|string| is_semver(&string).or_else(|_| is_release_channel(&string)))
|
||||
.help("The exact version to install. Either a semver or release channel name"),
|
||||
),
|
||||
)
|
||||
.subcommand(
|
||||
@@ -206,7 +213,9 @@ pub fn main() -> Result<(), String> {
|
||||
.unwrap();
|
||||
let data_dir = matches.value_of("data_dir").unwrap();
|
||||
let no_modify_path = matches.is_present("no_modify_path");
|
||||
let release_semver = matches.value_of("release_semver");
|
||||
let explicit_release = matches
|
||||
.value_of("explicit_release")
|
||||
.map(ToString::to_string);
|
||||
|
||||
command::init(
|
||||
config_file,
|
||||
@@ -214,7 +223,13 @@ pub fn main() -> Result<(), String> {
|
||||
json_rpc_url,
|
||||
&update_manifest_pubkey,
|
||||
no_modify_path,
|
||||
release_semver,
|
||||
explicit_release.map(|explicit_release| {
|
||||
if is_semver(&explicit_release).is_ok() {
|
||||
config::ExplicitRelease::Semver(explicit_release)
|
||||
} else {
|
||||
config::ExplicitRelease::Channel(explicit_release)
|
||||
}
|
||||
}),
|
||||
)
|
||||
}
|
||||
("info", Some(matches)) => {
|
||||
@@ -310,11 +325,11 @@ pub fn main_init() -> Result<(), String> {
|
||||
}
|
||||
})
|
||||
.arg(
|
||||
Arg::with_name("release_semver")
|
||||
.value_name("release-semver")
|
||||
Arg::with_name("explicit_release")
|
||||
.value_name("release")
|
||||
.index(1)
|
||||
.conflicts_with_all(&["json_rpc_url", "update_manifest_pubkey"])
|
||||
.validator(is_semver)
|
||||
.validator(|string| is_semver(&string).or_else(|_| is_release_channel(&string)))
|
||||
.help("The exact version to install. Updates will not be available if this argument is used"),
|
||||
)
|
||||
.get_matches();
|
||||
@@ -329,7 +344,9 @@ pub fn main_init() -> Result<(), String> {
|
||||
.unwrap();
|
||||
let data_dir = matches.value_of("data_dir").unwrap();
|
||||
let no_modify_path = matches.is_present("no_modify_path");
|
||||
let release_semver = matches.value_of("release_semver");
|
||||
let explicit_release = matches
|
||||
.value_of("explicit_release")
|
||||
.map(ToString::to_string);
|
||||
|
||||
command::init(
|
||||
config_file,
|
||||
@@ -337,6 +354,12 @@ pub fn main_init() -> Result<(), String> {
|
||||
json_rpc_url,
|
||||
&update_manifest_pubkey,
|
||||
no_modify_path,
|
||||
release_semver,
|
||||
explicit_release.map(|explicit_release| {
|
||||
if is_semver(&explicit_release).is_ok() {
|
||||
config::ExplicitRelease::Semver(explicit_release)
|
||||
} else {
|
||||
config::ExplicitRelease::Channel(explicit_release)
|
||||
}
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
Reference in New Issue
Block a user