diff --git a/platform/target_data.go b/platform/target_data.go index 26977d676..e88954db3 100644 --- a/platform/target_data.go +++ b/platform/target_data.go @@ -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) { diff --git a/platform/target_data_test.go b/platform/target_data_test.go index cc9bd5dce..2742f8f46 100644 --- a/platform/target_data_test.go +++ b/platform/target_data_test.go @@ -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) }) }) })