Update dependencies and enhance archive extraction support

- Bump version of the `depot` package from 0.15.2 to 0.16.0 in Cargo.toml and meson.build.
- Add new dependencies: `lz4_flex` and `lzma-rust2` in Cargo.toml and Cargo.lock.
- Implement support for extracting `.tar.lz4`, `.tar.lzma`, and `.tar.lzip` formats in the extractor module.
- Refactor archive extraction logic to streamline handling of various archive formats.
- Add tests for new archive formats to ensure extraction functionality works as expected.
This commit is contained in:
2026-03-10 20:09:03 -05:00
parent 7fad7c552b
commit ccd43fca6a
8 changed files with 607 additions and 243 deletions
+67
View File
@@ -83,6 +83,36 @@ pub fn build(
anyhow::bail!("ninja build failed");
}
if flags.skip_tests {
crate::log_info!("Skipping tests: disabled by build.flags.skip_tests");
} else {
let test_suites = meson_test_suites(flags);
if test_suites.is_empty() {
crate::log_info!("Running meson test...");
} else {
crate::log_info!("Running meson test suite(s): {}...", test_suites.join(" "));
}
let mut test_cmd = Command::new("meson");
test_cmd.current_dir(&build_dir);
test_cmd.arg("test");
test_cmd.arg("-C").arg(&build_dir);
test_cmd.arg("--num-processes").arg(num_cpus().to_string());
test_cmd.arg("--print-errorlogs");
for suite in &test_suites {
test_cmd.arg("--suite").arg(suite);
}
crate::builder::prepare_tool_command(&mut test_cmd, &env_vars);
let status = test_cmd
.status()
.with_context(|| format!("Failed to run meson test for {}", spec.package.name))?;
if !status.success() {
anyhow::bail!("meson test failed");
}
}
crate::source::hooks::run_post_compile_commands(spec, &actual_src, destdir)?;
state.mark_done(BuildStep::PostCompileDone)?;
} else {
@@ -146,6 +176,21 @@ fn resolve_build_dir(actual_src: &Path, flags: &crate::package::BuildFlags) -> P
}
}
fn meson_test_suites(flags: &crate::package::BuildFlags) -> Vec<String> {
let mut suites = Vec::new();
let single = flags.make_test_target.trim();
if !single.is_empty() {
suites.push(single.to_string());
}
for suite in &flags.make_test_targets {
let trimmed = suite.trim();
if !trimmed.is_empty() {
suites.push(trimmed.to_string());
}
}
suites
}
fn has_option(configure: &[String], long: &str) -> bool {
let prefix = format!("{long}=");
for arg in configure {
@@ -407,6 +452,28 @@ mod tests {
);
}
#[test]
fn test_meson_test_suites_uses_single_and_multiple_targets() {
let flags = BuildFlags {
make_test_target: "unit".to_string(),
make_test_targets: vec!["integration".to_string(), " smoke ".to_string()],
..BuildFlags::default()
};
assert_eq!(
meson_test_suites(&flags),
vec![
"unit".to_string(),
"integration".to_string(),
"smoke".to_string()
]
);
}
#[test]
fn test_meson_test_suites_empty_without_targets() {
assert!(meson_test_suites(&BuildFlags::default()).is_empty());
}
#[test]
fn test_resolve_actual_src_uses_source_subdir_under_source() -> Result<()> {
let src = tempdir()?;