From f760b3a28c334d3d14ebd38f447c21a90228f3b3 Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Thu, 28 Nov 2024 11:37:31 -0500 Subject: [PATCH] fix: restore ability to use occam with extensions Recent change to support multi-arch for buildpacks brokle occam for extensions. This was because extensions were being built with "pack buildpack package" which seems to work for extensions if a tgz is passed in but not an expanded directory. Update to use "pack extension package" for extensions instead. Unfortunately pack does not yet seem to support multi-arch for extensions so we'll have to add the --target option for extensions after that has been added. Signed-off-by: Michael Dawson --- packagers/jam.go | 20 +++++++++++++++----- packagers/jam_test.go | 3 +-- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/packagers/jam.go b/packagers/jam.go index fc3a1af..373281a 100644 --- a/packagers/jam.go +++ b/packagers/jam.go @@ -106,11 +106,21 @@ func (j Jam) Execute(buildpackDir, output, version string, offline bool) error { } - args = []string{ - "buildpack", "package", - output, - "--format", "file", - "--target", fmt.Sprintf("linux/%s", runtime.GOARCH), + if ( command == "--buildpack") { + args = []string{ + "buildpack", "package", + output, + "--format", "file", + "--target", fmt.Sprintf("linux/%s", runtime.GOARCH), + } + } else { + // pack extension does not yet support multi-arch + // update to inclue --target once it does + args = []string{ + "extension", "package", + output, + "--format", "file", + } } err = j.pack.Execute(pexec.Execution{ diff --git a/packagers/jam_test.go b/packagers/jam_test.go index 381aeb4..10a9a26 100644 --- a/packagers/jam_test.go +++ b/packagers/jam_test.go @@ -109,10 +109,9 @@ func testJam(t *testing.T, context spec.G, it spec.S) { })) Expect(pack.ExecuteCall.Receives.Execution.Args).To(Equal([]string{ - "buildpack", "package", + "extension", "package", "some-output", "--format", "file", - "--target", fmt.Sprintf("linux/%s", runtime.GOARCH), })) }) })