diff --git a/src/deb/local.rs b/src/deb/local.rs index be678a4..2c436ae 100644 --- a/src/deb/local.rs +++ b/src/deb/local.rs @@ -1154,6 +1154,39 @@ mod tests { assert_eq!(spec, "t:amd64"); } + /// Cross parity with dpkg's checker and sbuild's apt-resolved dummy + /// package: an unqualified Multi-Arch: same name resolves to the + /// host-architecture variant even when a build-architecture candidate + /// exists — the build-architecture side is only ever installed + /// through an explicit `:native` declaration (or a pkh quirk + /// injecting one), never alongside the host variant. + #[test] + fn install_spec_unqualified_same_package_never_dual_installs() { + let host = "arm64"; + let build = "amd64"; + + let spec = install_spec_for( + &rel("t"), + &[cand("amd64", "same"), cand("arm64", "same")], + build, + host, + ) + .unwrap(); + assert_eq!(spec, "t:arm64"); + + // The build-architecture side comes from `:native` declarations: + // the co-installable build-arch variant of the same source + // package. + let spec = install_spec_for( + &rel("t:native"), + &[cand("amd64", "same"), cand("arm64", "same")], + build, + host, + ) + .unwrap(); + assert_eq!(spec, "t:amd64"); + } + /// Qualified dependencies install exactly the variant their qualifier /// selects per dpkg semantics; virtual names (no candidates) pass /// through unqualified for apt to resolve a provider.