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
+54
View File
@@ -184,6 +184,47 @@ pub(crate) fn host_build_spec(spec: &PackageSpec) -> PackageSpec {
host_spec
}
pub(crate) fn requested_static_build() -> Result<Option<bool>> {
crate::build_options::requested_static_build()
}
pub(crate) fn static_build_args_for(build_type: BuildType) -> Result<Vec<String>> {
let Some(enabled) = requested_static_build()? else {
return Ok(Vec::new());
};
let args = match build_type {
BuildType::Autotools => vec![if enabled {
"--enable-static".to_string()
} else {
"--disable-static".to_string()
}],
BuildType::CMake => vec![format!(
"-DBUILD_SHARED_LIBS={}",
if enabled { "OFF" } else { "ON" }
)],
BuildType::Meson => vec![format!(
"-Ddefault_library={}",
if enabled { "static" } else { "shared" }
)],
BuildType::Perl => vec![format!(
"LINKTYPE={}",
if enabled { "static" } else { "dynamic" }
)],
_ => Vec::new(),
};
Ok(args)
}
pub(crate) fn build_tool_package_option(build_type: BuildType) -> Option<&'static str> {
crate::build_options::build_tool_package_option(build_type)
}
pub(crate) fn requested_build_tool_package(build_type: BuildType) -> Option<String> {
crate::build_options::requested_build_tool_package(build_type)
}
fn configured_install_dir(value: &str, default: &str) -> String {
let trimmed = value.trim();
if trimmed.is_empty() {
@@ -889,6 +930,19 @@ mod tests {
);
}
#[test]
fn test_build_tool_package_option_maps_supported_builders() {
assert_eq!(
build_tool_package_option(BuildType::Meson),
Some("DEPOT_MESON_PACKAGE")
);
assert_eq!(
build_tool_package_option(BuildType::CMake),
Some("DEPOT_CMAKE_PACKAGE")
);
assert_eq!(build_tool_package_option(BuildType::Bin), None);
}
#[test]
fn test_standard_build_env_exports_native_linker_and_cpp() {
let mut spec = mk_spec(Vec::new(), Vec::new());