build: replace version-compare crate with semver

closes #399
This commit is contained in:
Christian Visintin
2026-03-21 10:58:59 +01:00
parent 0ba43d5714
commit bd0843d3da
3 changed files with 9 additions and 10 deletions

8
Cargo.lock generated
View File

@@ -5771,6 +5771,7 @@ dependencies = [
"remotefs-webdav", "remotefs-webdav",
"rpassword", "rpassword",
"self_update", "self_update",
"semver",
"serde", "serde",
"serial_test", "serial_test",
"shellexpand", "shellexpand",
@@ -5786,7 +5787,6 @@ dependencies = [
"unicode-width 0.2.0", "unicode-width 0.2.0",
"uzers", "uzers",
"vergen-git2", "vergen-git2",
"version-compare",
"whoami", "whoami",
"wildmatch", "wildmatch",
] ]
@@ -6440,12 +6440,6 @@ dependencies = [
"rustversion", "rustversion",
] ]
[[package]]
name = "version-compare"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03c2856837ef78f57382f06b2b8563a2f512f7185d732608fd9176cb3b8edf0e"
[[package]] [[package]]
name = "version_check" name = "version_check"
version = "0.9.5" version = "0.9.5"

View File

@@ -77,6 +77,7 @@ self_update = { version = "0.42", default-features = false, features = [
"compression-zip-deflate", "compression-zip-deflate",
"rustls", "rustls",
] } ] }
semver = "1"
serde = { version = "1", features = ["derive"] } serde = { version = "1", features = ["derive"] }
shellexpand = "3" shellexpand = "3"
simplelog = "0.12" simplelog = "0.12"
@@ -89,7 +90,6 @@ tui-realm-stdlib = "3"
tui-term = "0.2" tui-term = "0.2"
tuirealm = "3" tuirealm = "3"
unicode-width = "0.2" unicode-width = "0.2"
version-compare = "0.2"
whoami = "2" whoami = "2"
wildmatch = "2" wildmatch = "2"

View File

@@ -132,8 +132,13 @@ impl Update {
/// Check wether new version is higher than new version /// Check wether new version is higher than new version
fn is_new_version_higher(new_version: &str, current_version: &str) -> bool { fn is_new_version_higher(new_version: &str, current_version: &str) -> bool {
version_compare::compare(new_version, current_version).unwrap_or(version_compare::Cmp::Lt) match (
== version_compare::Cmp::Gt semver::Version::parse(new_version),
semver::Version::parse(current_version),
) {
(Ok(new), Ok(current)) => new > current,
_ => false,
}
} }
} }
impl From<Status> for UpdateStatus { impl From<Status> for UpdateStatus {