deb: pin the cross variant choice of M-A:same build-deps in tests

An unqualified Multi-Arch: same build-dependency resolves to the
host-architecture variant only, even when a build-architecture
candidate exists: that is what dpkg's checker accepts (KnownFacts
accepts foreign, host and all instances) and what sbuild installs,
whose dummy package carries the parsed Build-Depends unqualified and
whose sbuild-cross-resolver only filters foreign M-A:foreign and
Essential packages out of the apt universe — verified by resolving a
sbuild-style dummy:arm64 against the resolute/stonking indexes, which
yields libelf-dev:arm64 & co and never the amd64 variants.

The build-architecture side of such a library is only ever installed
through an explicit :native declaration.  Pin both rules so a resolver
regression towards dual-installing unqualified dependencies cannot
reappear unnoticed.
This commit is contained in:
2026-09-25 20:53:02 +02:00
parent 4b52f8e9e9
commit 99c6f63cd4
+33
View File
@@ -1154,6 +1154,39 @@ mod tests {
assert_eq!(spec, "t:amd64"); 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 /// Qualified dependencies install exactly the variant their qualifier
/// selects per dpkg semantics; virtual names (no candidates) pass /// selects per dpkg semantics; virtual names (no candidates) pass
/// through unqualified for apt to resolve a provider. /// through unqualified for apt to resolve a provider.