Implement update check functionality with version comparison and archive listing

- Added `check.rs` to handle package update checks, including logic for determining available updates from remote git repositories and archive listings.
- Introduced `versions.rs` to manage version patterns, comparison logic, and extraction of candidate versions from git refs and archive listings.
- Implemented `hex.rs` for encoding byte arrays to lowercase hexadecimal strings.
This commit is contained in:
2026-03-29 12:09:44 -05:00
parent 192cdc1af2
commit 57a364aa97
41 changed files with 8304 additions and 7267 deletions
+7 -7
View File
@@ -412,7 +412,7 @@ fn verify_file_hash(path: &Path, expected: &str) -> Result<bool> {
}
hasher.update(&buf[..n]);
}
let actual = format!("{:x}", hasher.finalize());
let actual = crate::hex::encode_lower(hasher.finalize());
Ok(actual == hex)
}
"sha512" => {
@@ -427,7 +427,7 @@ fn verify_file_hash(path: &Path, expected: &str) -> Result<bool> {
}
hasher.update(&buf[..n]);
}
let actual = format!("{:x}", hasher.finalize());
let actual = crate::hex::encode_lower(hasher.finalize());
Ok(actual == hex)
}
"sha1" => {
@@ -442,7 +442,7 @@ fn verify_file_hash(path: &Path, expected: &str) -> Result<bool> {
}
hasher.update(&buf[..n]);
}
let actual = format!("{:x}", hasher.finalize());
let actual = crate::hex::encode_lower(hasher.finalize());
Ok(actual == hex)
}
"md5" => {
@@ -457,7 +457,7 @@ fn verify_file_hash(path: &Path, expected: &str) -> Result<bool> {
ctx.consume(&buf[..n]);
}
let digest = ctx.finalize();
let actual = format!("{:x}", digest);
let actual = crate::hex::encode_lower(*digest);
Ok(actual == hex)
}
"b2" | "b2sum" => {
@@ -994,17 +994,17 @@ mod tests {
let sha256_hex = {
let mut h = Sha256::new();
h.update(b"abc");
format!("{:x}", h.finalize())
crate::hex::encode_lower(h.finalize())
};
let sha512_hex = {
let mut h = Sha512::new();
h.update(b"abc");
format!("{:x}", h.finalize())
crate::hex::encode_lower(h.finalize())
};
let sha1_hex = {
let mut h = Sha1::new();
h.update(b"abc");
format!("{:x}", h.finalize())
crate::hex::encode_lower(h.finalize())
};
let md5_hex = format!("{:x}", md5::compute(b"abc"));
let b2_hex = b2sum_rust::Blake2bSum::new(64)