This commit is contained in:
2026-08-24 11:58:19 +02:00
parent 42fcfc2dfa
commit 429429e414
10 changed files with 477 additions and 189 deletions
+30 -13
View File
@@ -219,7 +219,9 @@ pub fn run_source_build(
let report = crate::debian::deps::check_build_depends(&ctrl, &check_opts)?;
if !report.is_ok() {
eprintln!("{}", report.message());
return Err(Box::new(crate::debian::deps::UnmetBuildDependencies(report)));
return Err(Box::new(crate::debian::deps::UnmetBuildDependencies(
report,
)));
}
}
@@ -892,7 +894,9 @@ mod differential_tests {
if let Some(a) = arch {
cmd.args(["-a", a]);
}
let output = cmd.output().expect("run dpkg-architecture (is dpkg-dev installed?)");
let output = cmd
.output()
.expect("run dpkg-architecture (is dpkg-dev installed?)");
assert!(
output.status.success(),
"dpkg-architecture -f {arch:?} failed: {}",
@@ -907,7 +911,10 @@ mod differential_tests {
let ours = crate::debian::arch::arch_env(arch)
.unwrap_or_else(|e| panic!("native arch_env({arch:?}) failed: {e}"));
assert_eq!(ours, expected, "arch_env({arch:?}) differs from dpkg-architecture");
assert_eq!(
ours, expected,
"arch_env({arch:?}) differs from dpkg-architecture"
);
}
/// Every architecture known to the local dpkg must produce an identical
@@ -993,12 +1000,16 @@ mod differential_tests {
ignore_builtin: true,
admindir: admindir.clone(),
};
let control_info = crate::debian::ControlInfo::parse_content(control).expect("parse control");
let control_info =
crate::debian::ControlInfo::parse_content(control).expect("parse control");
let report = crate::debian::deps::check_build_depends(&control_info, &opts)
.expect("native parse failure");
let ours_exit = if report.is_ok() { 0 } else { 1 };
assert_eq!(ours_exit, real_exit, "exit status mismatch for {control:?} {args:?}");
assert_eq!(
ours_exit, real_exit,
"exit status mismatch for {control:?} {args:?}"
);
assert_eq!(
report.message(),
real_msg,
@@ -1083,7 +1094,11 @@ Provides: virtual-thing (= 2.0), plain-virtual
diff_checkbuilddeps_case(&control_ab, STATUS, &["-B", "-P", "cross"]);
// Combined unmet + conflict reporting in one run.
case("missing-one, libc6 (>> 999)", "libfoo-dev", &["-P", "cross"]);
case(
"missing-one, libc6 (>> 999)",
"libfoo-dev",
&["-P", "cross"],
);
}
/// Differential check of [`crate::debian::version`] against real
@@ -1094,10 +1109,10 @@ Provides: virtual-thing (= 2.0), plain-virtual
let vectors = crate::debian::version::test_vectors::COMPARE;
assert!(!vectors.is_empty());
for (a, b, expected) in vectors {
let va = crate::debian::DebianVersion::parse(a)
.unwrap_or_else(|e| panic!("parse {a}: {e}"));
let vb = crate::debian::DebianVersion::parse(b)
.unwrap_or_else(|e| panic!("parse {b}: {e}"));
let va =
crate::debian::DebianVersion::parse(a).unwrap_or_else(|e| panic!("parse {a}: {e}"));
let vb =
crate::debian::DebianVersion::parse(b).unwrap_or_else(|e| panic!("parse {b}: {e}"));
let ours = match va.cmp(&vb) {
std::cmp::Ordering::Less => -1,
std::cmp::Ordering::Equal => 0,
@@ -1151,8 +1166,7 @@ Provides: virtual-thing (= 2.0), plain-virtual
let tree = root.join(NAME);
fs::write(tree.join("debian/control"), &control).expect("write control");
fs::write(tree.join("debian/changelog"), &changelog).expect("write changelog");
fs::write(tree.join("debian/source/format"), "3.0 (native)\n")
.expect("write format");
fs::write(tree.join("debian/source/format"), "3.0 (native)\n").expect("write format");
fs::write(tree.join("debian/rules"), &rules).expect("write rules");
#[cfg(unix)]
{
@@ -1192,7 +1206,10 @@ Provides: virtual-thing (= 2.0), plain-virtual
let parallel = env::num_parallel();
let build_env_vars: Vec<(String, String)> = [
("LANG".to_string(), "C".to_string()),
("DEB_BUILD_OPTIONS".to_string(), format!("parallel={parallel}")),
(
"DEB_BUILD_OPTIONS".to_string(),
format!("parallel={parallel}"),
),
("SOURCE_DATE_EPOCH".to_string(), entry.timestamp.to_string()),
]
.into_iter()