diff --git a/postal/buildpack.go b/postal/buildpack.go index f430b9aa..b634bf48 100644 --- a/postal/buildpack.go +++ b/postal/buildpack.go @@ -73,7 +73,7 @@ func parseBuildpack(path, name string) ([]Dependency, string, error) { func stacksInclude(stacks []string, stack string) bool { for _, s := range stacks { - if s == stack { + if s == stack || s == "*" { return true } } diff --git a/postal/service_test.go b/postal/service_test.go index f38a85ef..6dd56221 100644 --- a/postal/service_test.go +++ b/postal/service_test.go @@ -86,6 +86,14 @@ stacks = ["some-stack"] uri = "some-uri" version = "4.5.6" strip-components = 1 + +[[metadata.dependencies]] +id = "some-other-entry" +sha256 = "some-sha" +stacks = ["*"] +uri = "some-uri" +version = "4.5.6" +strip-components = 1 `) Expect(err).NotTo(HaveOccurred()) @@ -115,6 +123,21 @@ strip-components = 1 })) }) + context("when the dependency has a wildcard stack", func() { + it("is compatible with all stack ids", func() { + dependency, err := service.Resolve(path, "some-other-entry", "", "random-stack") + Expect(err).NotTo(HaveOccurred()) + Expect(dependency).To(Equal(postal.Dependency{ + ID: "some-other-entry", + Stacks: []string{"*"}, + URI: "some-uri", + SHA256: "some-sha", + Version: "4.5.6", + StripComponents: 1, + })) + }) + }) + context("when there is NOT a default version", func() { context("when the entry version is empty", func() { it("picks the dependency with the highest semantic version number", func() {