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 1bd990bca7
commit 024f156fc8
3 changed files with 9 additions and 10 deletions

8
Cargo.lock generated
View File

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

View File

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

View File

@@ -132,8 +132,13 @@ impl Update {
/// Check wether new version is higher than new version
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)
== version_compare::Cmp::Gt
match (
semver::Version::parse(new_version),
semver::Version::parse(current_version),
) {
(Ok(new), Ok(current)) => new > current,
_ => false,
}
}
}
impl From<Status> for UpdateStatus {