-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for ARM64 support in DependencyResolver
This commit adds support to DependencyResolver.Resolve to pick a Dependency and consider the architecture. It looks at either `BP_ARCH` (if set) or `runtime.GOARCH` otherwise. It then compares this to the `arch=` value that is set in PURL. We are using the PURL because it exists already and already contains the arch info. This is opposed to adding a new property to the dependency metadata. We *may* end up doing that still, but this just gets things working more quickly now and we can change this in the future. Signed-off-by: Daniel Mikusa <[email protected]>
- Loading branch information
Showing
3 changed files
with
80 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -282,6 +282,10 @@ func testBuildpack(t *testing.T, context spec.G, it spec.S) { | |
resolver libpak.DependencyResolver | ||
) | ||
|
||
it.Before(func() { | ||
t.Setenv("BP_ARCH", "amd64") // force for test consistency | ||
}) | ||
|
||
context("Resolve", func() { | ||
|
||
it("filters by id", func() { | ||
|
@@ -315,6 +319,42 @@ func testBuildpack(t *testing.T, context spec.G, it spec.S) { | |
})) | ||
}) | ||
|
||
it("filters by arch", func() { | ||
resolver.Dependencies = []libpak.BuildpackDependency{ | ||
{ | ||
ID: "test-id-1", | ||
Name: "test-name", | ||
Version: "1.0", | ||
URI: "test-uri-amd64", | ||
SHA256: "test-sha256", | ||
Stacks: []string{"test-stack-1", "test-stack-2"}, | ||
PURL: "pkg:generic/[email protected]?arch=amd64", | ||
}, | ||
{ | ||
ID: "test-id-1", | ||
Name: "test-name", | ||
Version: "1.0", | ||
URI: "test-uri-arm64", | ||
SHA256: "test-sha256", | ||
Stacks: []string{"test-stack-1", "test-stack-2"}, | ||
PURL: "pkg:generic/[email protected]?arch=arm64", | ||
}, | ||
} | ||
resolver.StackID = "test-stack-1" | ||
|
||
t.Setenv("BP_ARCH", "arm64") | ||
|
||
Expect(resolver.Resolve("test-id-1", "1.0")).To(Equal(libpak.BuildpackDependency{ | ||
ID: "test-id-1", | ||
Name: "test-name", | ||
Version: "1.0", | ||
URI: "test-uri-arm64", | ||
SHA256: "test-sha256", | ||
Stacks: []string{"test-stack-1", "test-stack-2"}, | ||
PURL: "pkg:generic/[email protected]?arch=arm64", | ||
})) | ||
}) | ||
|
||
it("filters by version constraint", func() { | ||
resolver.Dependencies = []libpak.BuildpackDependency{ | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters