diff --git a/packagers/jam.go b/packagers/jam.go index 698d6b0..fc3a1af 100644 --- a/packagers/jam.go +++ b/packagers/jam.go @@ -87,17 +87,40 @@ func (j Jam) Execute(buildpackDir, output, version string, offline bool) error { return err } + tmpDir, _ := os.MkdirTemp("", "build") + if _, err := os.Stat(buildpackTarballPath); err == nil { + doUnzip := pexec.NewExecutable("tar") + args = []string{ + "-xvf", + buildpackTarballPath, + } + err = doUnzip.Execute(pexec.Execution{ + Dir: tmpDir, + Args: args, + Stdout: os.Stdout, + Stderr: os.Stderr, + }) + if err != nil { + return err + } + + } + args = []string{ "buildpack", "package", output, - "--path", buildpackTarballPath, "--format", "file", "--target", fmt.Sprintf("linux/%s", runtime.GOARCH), } - return j.pack.Execute(pexec.Execution{ + err = j.pack.Execute(pexec.Execution{ + Dir: tmpDir, Args: args, Stdout: os.Stdout, Stderr: os.Stderr, }) + + os.RemoveAll(tmpDir) + + return err } diff --git a/packagers/jam_test.go b/packagers/jam_test.go index 15fe67c..381aeb4 100644 --- a/packagers/jam_test.go +++ b/packagers/jam_test.go @@ -53,7 +53,6 @@ func testJam(t *testing.T, context spec.G, it spec.S) { Expect(pack.ExecuteCall.Receives.Execution.Args).To(Equal([]string{ "buildpack", "package", "some-output", - "--path", filepath.Join("some-jam-output", "some-version.tgz"), "--format", "file", "--target", fmt.Sprintf("linux/%s", runtime.GOARCH), })) @@ -75,7 +74,6 @@ func testJam(t *testing.T, context spec.G, it spec.S) { Expect(pack.ExecuteCall.Receives.Execution.Args).To(Equal([]string{ "buildpack", "package", "some-output", - "--path", filepath.Join("some-jam-output", "some-version.tgz"), "--format", "file", "--target", fmt.Sprintf("linux/%s", runtime.GOARCH), })) @@ -113,7 +111,6 @@ func testJam(t *testing.T, context spec.G, it spec.S) { Expect(pack.ExecuteCall.Receives.Execution.Args).To(Equal([]string{ "buildpack", "package", "some-output", - "--path", filepath.Join("some-jam-output", "some-version.tgz"), "--format", "file", "--target", fmt.Sprintf("linux/%s", runtime.GOARCH), }))