Skip to content

Commit

Permalink
Merge pull request #1077 from spkenv/test-selector-var-opts
Browse files Browse the repository at this point in the history
Fix test selector not handling "distro" (or other var opts)
  • Loading branch information
jrray authored Jul 18, 2024
2 parents 5bc6371 + e3dbd15 commit 0615c98
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions crates/spk-schema/src/v0/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -467,21 +467,33 @@ impl Recipe for Spec<VersionIdent> {
.get_build_requirements(variant)
.unwrap_or_default()
.iter()
.any(|req| {
let Request::Pkg(PkgRequest {
.any(|req| match req {
Request::Pkg(PkgRequest {
pkg:
RangeIdent {
name, components, ..
},
..
}) = req
else {
return false;
};
*name == pkg.0.name
&& ComponentBTreeSet::new(components).satisfies(
&ComponentBTreeSet::new(&pkg.0.components),
)
}) => {
*name == pkg.0.name
&& ComponentBTreeSet::new(components).satisfies(
&ComponentBTreeSet::new(&pkg.0.components),
)
}
Request::Var(VarRequest {
var,
value: var_request_value,
..
}) => {
// The variant spec entry may be
// an "opt" like "distro" but this
// is only possible if there were
// no components specified.
pkg.0.components.is_empty()
&& var.as_str() == pkg.0.name.as_str()
&& var_request_value.as_pinned()
== Some(value.as_str())
}
})
{
return false;
Expand Down

0 comments on commit 0615c98

Please sign in to comment.