Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When a buildpack declares distro information, but a base image does not, consider it not a match #1348

Merged
merged 1 commit into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion platform/target_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,12 @@ func TargetSatisfiedForBuild(base files.TargetMetadata, module buildpack.TargetM
if !matches(base.ArchVariant, module.ArchVariant) {
return false
}
if base.Distro == nil || len(module.Distros) == 0 {
if len(module.Distros) == 0 {
return true
}
if base.Distro == nil {
return false
}
foundMatchingDist := false
for _, modDist := range module.Distros {
if matches(base.Distro.Name, modDist.Name) && matches(base.Distro.Version, modDist.Version) {
Expand Down
6 changes: 3 additions & 3 deletions platform/target_data_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ func testTargetData(t *testing.T, when spec.G, it spec.S) {
})
})

when("has extra information", func() {
it("matches", func() {
when("has distro information", func() {
it("does not match", func() {
h.AssertEq(t, platform.TargetSatisfiedForBuild(baseTarget, buildpack.TargetMetadata{OS: baseTarget.OS, Arch: baseTarget.Arch, ArchVariant: "MMX"}), true)
h.AssertEq(t, platform.TargetSatisfiedForBuild(baseTarget, buildpack.TargetMetadata{
OS: baseTarget.OS,
Arch: baseTarget.Arch,
Distros: []buildpack.OSDistro{{Name: "a", Version: "2"}},
}), true)
}), false)
})
})
})
Expand Down
Loading