mirror of
https://github.com/mudler/luet.git
synced 2025-09-04 16:50:50 +00:00
Drop untar
This commit is contained in:
@@ -16,16 +16,18 @@
|
|||||||
package compiler_test
|
package compiler_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/mudler/luet/pkg/api/core/types"
|
"github.com/mudler/luet/pkg/api/core/types"
|
||||||
|
"github.com/mudler/luet/pkg/api/core/types/artifact"
|
||||||
. "github.com/mudler/luet/pkg/compiler"
|
. "github.com/mudler/luet/pkg/compiler"
|
||||||
sd "github.com/mudler/luet/pkg/compiler/backend"
|
sd "github.com/mudler/luet/pkg/compiler/backend"
|
||||||
"github.com/mudler/luet/pkg/compiler/types/compression"
|
"github.com/mudler/luet/pkg/compiler/types/compression"
|
||||||
"github.com/mudler/luet/pkg/compiler/types/options"
|
"github.com/mudler/luet/pkg/compiler/types/options"
|
||||||
compilerspec "github.com/mudler/luet/pkg/compiler/types/spec"
|
compilerspec "github.com/mudler/luet/pkg/compiler/types/spec"
|
||||||
helpers "github.com/mudler/luet/pkg/helpers"
|
|
||||||
fileHelper "github.com/mudler/luet/pkg/helpers/file"
|
fileHelper "github.com/mudler/luet/pkg/helpers/file"
|
||||||
pkg "github.com/mudler/luet/pkg/package"
|
pkg "github.com/mudler/luet/pkg/package"
|
||||||
"github.com/mudler/luet/pkg/tree"
|
"github.com/mudler/luet/pkg/tree"
|
||||||
@@ -64,7 +66,7 @@ var _ = Describe("Compiler", func() {
|
|||||||
artifact, err := compiler.Compile(false, spec)
|
artifact, err := compiler.Compile(false, spec)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
||||||
Expect(helpers.Untar(artifact.Path, tmpdir, false)).ToNot(HaveOccurred())
|
Expect(artifact.Unpack(ctx, tmpdir, false)).ToNot(HaveOccurred())
|
||||||
|
|
||||||
Expect(fileHelper.Exists(spec.Rel("test5"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("test5"))).To(BeTrue())
|
||||||
Expect(fileHelper.Exists(spec.Rel("test6"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("test6"))).To(BeTrue())
|
||||||
@@ -104,7 +106,7 @@ var _ = Describe("Compiler", func() {
|
|||||||
artifact, err := compiler.Compile(false, spec)
|
artifact, err := compiler.Compile(false, spec)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
||||||
Expect(helpers.Untar(artifact.Path, tmpdir, false)).ToNot(HaveOccurred())
|
Expect(artifact.Unpack(ctx, tmpdir, false)).ToNot(HaveOccurred())
|
||||||
|
|
||||||
Expect(fileHelper.Exists(spec.Rel("result"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("result"))).To(BeTrue())
|
||||||
Expect(fileHelper.Exists(spec.Rel("bina/busybox"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("bina/busybox"))).To(BeTrue())
|
||||||
@@ -134,7 +136,7 @@ var _ = Describe("Compiler", func() {
|
|||||||
artifact, err := compiler.Compile(false, spec)
|
artifact, err := compiler.Compile(false, spec)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
||||||
Expect(helpers.Untar(artifact.Path, tmpdir, false)).ToNot(HaveOccurred())
|
Expect(artifact.Unpack(ctx, tmpdir, false)).ToNot(HaveOccurred())
|
||||||
Expect(fileHelper.Exists(spec.Rel("newc"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("newc"))).To(BeTrue())
|
||||||
Expect(fileHelper.Exists(spec.Rel("test4"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("test4"))).To(BeTrue())
|
||||||
Expect(fileHelper.Exists(spec.Rel("test3"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("test3"))).To(BeTrue())
|
||||||
@@ -169,7 +171,7 @@ var _ = Describe("Compiler", func() {
|
|||||||
Expect(errs).To(BeNil())
|
Expect(errs).To(BeNil())
|
||||||
for _, artifact := range artifacts {
|
for _, artifact := range artifacts {
|
||||||
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
||||||
Expect(helpers.Untar(artifact.Path, tmpdir, false)).ToNot(HaveOccurred())
|
Expect(artifact.Unpack(ctx, tmpdir, false)).ToNot(HaveOccurred())
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
@@ -232,7 +234,7 @@ var _ = Describe("Compiler", func() {
|
|||||||
|
|
||||||
for _, artifact := range artifacts {
|
for _, artifact := range artifacts {
|
||||||
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
||||||
Expect(helpers.Untar(artifact.Path, tmpdir, false)).ToNot(HaveOccurred())
|
Expect(artifact.Unpack(ctx, tmpdir, false)).ToNot(HaveOccurred())
|
||||||
}
|
}
|
||||||
|
|
||||||
Expect(fileHelper.Exists(spec.Rel("test3"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("test3"))).To(BeTrue())
|
||||||
@@ -282,12 +284,12 @@ var _ = Describe("Compiler", func() {
|
|||||||
|
|
||||||
for _, artifact := range artifacts {
|
for _, artifact := range artifacts {
|
||||||
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
||||||
Expect(helpers.Untar(artifact.Path, tmpdir, false)).ToNot(HaveOccurred())
|
Expect(artifact.Unpack(ctx, tmpdir, false)).ToNot(HaveOccurred())
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, artifact := range artifacts2 {
|
for _, artifact := range artifacts2 {
|
||||||
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
||||||
Expect(helpers.Untar(artifact.Path, tmpdir, false)).ToNot(HaveOccurred())
|
Expect(artifact.Unpack(ctx, tmpdir, false)).ToNot(HaveOccurred())
|
||||||
}
|
}
|
||||||
|
|
||||||
Expect(fileHelper.Exists(spec.Rel("etc/hosts"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("etc/hosts"))).To(BeTrue())
|
||||||
@@ -318,10 +320,9 @@ var _ = Describe("Compiler", func() {
|
|||||||
artifacts, errs := compiler.CompileParallel(false, compilerspec.NewLuetCompilationspecs(spec))
|
artifacts, errs := compiler.CompileParallel(false, compilerspec.NewLuetCompilationspecs(spec))
|
||||||
Expect(errs).To(BeNil())
|
Expect(errs).To(BeNil())
|
||||||
Expect(len(artifacts)).To(Equal(1))
|
Expect(len(artifacts)).To(Equal(1))
|
||||||
|
|
||||||
for _, artifact := range artifacts {
|
for _, artifact := range artifacts {
|
||||||
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
||||||
Expect(helpers.Untar(artifact.Path, tmpdir, false)).ToNot(HaveOccurred())
|
Expect(artifact.Unpack(ctx, tmpdir, false)).ToNot(HaveOccurred())
|
||||||
}
|
}
|
||||||
Expect(fileHelper.Exists(spec.Rel("test5"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("test5"))).To(BeTrue())
|
||||||
Expect(fileHelper.Exists(spec.Rel("marvin"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("marvin"))).To(BeTrue())
|
||||||
@@ -355,7 +356,7 @@ var _ = Describe("Compiler", func() {
|
|||||||
|
|
||||||
for _, artifact := range artifacts {
|
for _, artifact := range artifacts {
|
||||||
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
||||||
Expect(helpers.Untar(artifact.Path, tmpdir, false)).ToNot(HaveOccurred())
|
Expect(artifact.Unpack(ctx, tmpdir, false)).ToNot(HaveOccurred())
|
||||||
}
|
}
|
||||||
Expect(fileHelper.Exists(spec.Rel("test5"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("test5"))).To(BeTrue())
|
||||||
Expect(fileHelper.Exists(spec.Rel("marvin"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("marvin"))).To(BeTrue())
|
||||||
@@ -390,7 +391,7 @@ var _ = Describe("Compiler", func() {
|
|||||||
|
|
||||||
for _, artifact := range artifacts {
|
for _, artifact := range artifacts {
|
||||||
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
||||||
Expect(helpers.Untar(artifact.Path, tmpdir, false)).ToNot(HaveOccurred())
|
Expect(artifact.Unpack(ctx, tmpdir, false)).ToNot(HaveOccurred())
|
||||||
}
|
}
|
||||||
Expect(fileHelper.Exists(spec.Rel("test5"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("test5"))).To(BeTrue())
|
||||||
Expect(fileHelper.Exists(spec.Rel("marvin"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("marvin"))).To(BeTrue())
|
||||||
@@ -424,7 +425,7 @@ var _ = Describe("Compiler", func() {
|
|||||||
|
|
||||||
for _, artifact := range artifacts {
|
for _, artifact := range artifacts {
|
||||||
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
||||||
Expect(helpers.Untar(artifact.Path, tmpdir, false)).ToNot(HaveOccurred())
|
Expect(artifact.Unpack(ctx, tmpdir, false)).ToNot(HaveOccurred())
|
||||||
}
|
}
|
||||||
Expect(fileHelper.Exists(spec.Rel("marvin"))).ToNot(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("marvin"))).ToNot(BeTrue())
|
||||||
Expect(fileHelper.Exists(spec.Rel("test5"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("test5"))).To(BeTrue())
|
||||||
@@ -457,7 +458,7 @@ var _ = Describe("Compiler", func() {
|
|||||||
|
|
||||||
for _, artifact := range artifacts {
|
for _, artifact := range artifacts {
|
||||||
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
||||||
Expect(helpers.Untar(artifact.Path, tmpdir, false)).ToNot(HaveOccurred())
|
Expect(artifact.Unpack(ctx, tmpdir, false)).ToNot(HaveOccurred())
|
||||||
}
|
}
|
||||||
Expect(fileHelper.Exists(spec.Rel("marvin"))).ToNot(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("marvin"))).ToNot(BeTrue())
|
||||||
Expect(fileHelper.Exists(spec.Rel("test5"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("test5"))).To(BeTrue())
|
||||||
@@ -490,7 +491,7 @@ var _ = Describe("Compiler", func() {
|
|||||||
|
|
||||||
for _, artifact := range artifacts {
|
for _, artifact := range artifacts {
|
||||||
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
||||||
Expect(helpers.Untar(artifact.Path, tmpdir, false)).ToNot(HaveOccurred())
|
Expect(artifact.Unpack(ctx, tmpdir, false)).ToNot(HaveOccurred())
|
||||||
}
|
}
|
||||||
Expect(fileHelper.Exists(spec.Rel("var/lib/udhcpd"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("var/lib/udhcpd"))).To(BeTrue())
|
||||||
Expect(fileHelper.Exists(spec.Rel("marvin"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("marvin"))).To(BeTrue())
|
||||||
@@ -528,9 +529,9 @@ var _ = Describe("Compiler", func() {
|
|||||||
|
|
||||||
for _, artifact := range artifacts {
|
for _, artifact := range artifacts {
|
||||||
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
||||||
Expect(helpers.Untar(artifact.Path, tmpdir, false)).ToNot(HaveOccurred())
|
Expect(artifact.Unpack(ctx, tmpdir, false)).ToNot(HaveOccurred())
|
||||||
}
|
}
|
||||||
Expect(helpers.Untar(spec.Rel("extra-layer-0.1.package.tar"), tmpdir, false)).ToNot(HaveOccurred())
|
Expect(artifact.NewPackageArtifact(spec.Rel("extra-layer-0.1.package.tar")).Unpack(ctx, tmpdir, false)).ToNot(HaveOccurred())
|
||||||
|
|
||||||
Expect(fileHelper.Exists(spec.Rel("extra-layer"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("extra-layer"))).To(BeTrue())
|
||||||
|
|
||||||
@@ -569,9 +570,9 @@ var _ = Describe("Compiler", func() {
|
|||||||
|
|
||||||
for _, artifact := range artifacts {
|
for _, artifact := range artifacts {
|
||||||
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
||||||
Expect(helpers.Untar(artifact.Path, tmpdir, false)).ToNot(HaveOccurred())
|
Expect(artifact.Unpack(ctx, tmpdir, false)).ToNot(HaveOccurred())
|
||||||
}
|
}
|
||||||
Expect(helpers.Untar(spec.Rel("c-test-1.0.package.tar"), tmpdir, false)).ToNot(HaveOccurred())
|
Expect(artifact.NewPackageArtifact(spec.Rel("c-test-1.0.package.tar")).Unpack(ctx, tmpdir, false)).ToNot(HaveOccurred())
|
||||||
|
|
||||||
Expect(fileHelper.Exists(spec.Rel("d"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("d"))).To(BeTrue())
|
||||||
Expect(fileHelper.Exists(spec.Rel("dd"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("dd"))).To(BeTrue())
|
||||||
@@ -612,9 +613,9 @@ var _ = Describe("Compiler", func() {
|
|||||||
|
|
||||||
for _, artifact := range artifacts {
|
for _, artifact := range artifacts {
|
||||||
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
||||||
Expect(helpers.Untar(artifact.Path, tmpdir, false)).ToNot(HaveOccurred())
|
Expect(artifact.Unpack(ctx, tmpdir, false)).ToNot(HaveOccurred())
|
||||||
}
|
}
|
||||||
Expect(helpers.Untar(spec.Rel("c-test-1.0.package.tar"), tmpdir, false)).ToNot(HaveOccurred())
|
Expect(artifact.NewPackageArtifact(spec.Rel("c-test-1.0.package.tar")).Unpack(ctx, tmpdir, false)).ToNot(HaveOccurred())
|
||||||
|
|
||||||
Expect(fileHelper.Exists(spec.Rel("d"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("d"))).To(BeTrue())
|
||||||
Expect(fileHelper.Exists(spec.Rel("dd"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("dd"))).To(BeTrue())
|
||||||
@@ -652,9 +653,9 @@ var _ = Describe("Compiler", func() {
|
|||||||
|
|
||||||
for _, artifact := range artifacts {
|
for _, artifact := range artifacts {
|
||||||
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
||||||
Expect(helpers.Untar(artifact.Path, tmpdir, false)).ToNot(HaveOccurred())
|
Expect(artifact.Unpack(ctx, tmpdir, false)).ToNot(HaveOccurred())
|
||||||
}
|
}
|
||||||
Expect(helpers.Untar(spec.Rel("extra-layer-0.1.package.tar"), tmpdir, false)).ToNot(HaveOccurred())
|
Expect(artifact.NewPackageArtifact(spec.Rel("extra-layer-0.1.package.tar")).Unpack(ctx, tmpdir, false)).ToNot(HaveOccurred())
|
||||||
|
|
||||||
Expect(fileHelper.Exists(spec.Rel("extra-layer"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("extra-layer"))).To(BeTrue())
|
||||||
|
|
||||||
@@ -714,9 +715,9 @@ var _ = Describe("Compiler", func() {
|
|||||||
Expect(len(artifacts[0].Dependencies)).To(Equal(6))
|
Expect(len(artifacts[0].Dependencies)).To(Equal(6))
|
||||||
for _, artifact := range artifacts {
|
for _, artifact := range artifacts {
|
||||||
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
||||||
Expect(helpers.Untar(artifact.Path, tmpdir, false)).ToNot(HaveOccurred())
|
Expect(artifact.Unpack(ctx, tmpdir, false)).ToNot(HaveOccurred())
|
||||||
}
|
}
|
||||||
Expect(helpers.Untar(spec.Rel("vhba-sys-fs-5.4.2-20190410.package.tar"), tmpdir, false)).ToNot(HaveOccurred())
|
Expect(artifact.NewPackageArtifact(spec.Rel("vhba-sys-fs-5.4.2-20190410.package.tar")).Unpack(ctx, tmpdir, false)).ToNot(HaveOccurred())
|
||||||
Expect(fileHelper.Exists(spec.Rel("sabayon-build-portage-layer-0.20191126.package.tar"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("sabayon-build-portage-layer-0.20191126.package.tar"))).To(BeTrue())
|
||||||
Expect(fileHelper.Exists(spec.Rel("build-layer-0.1.package.tar"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("build-layer-0.1.package.tar"))).To(BeTrue())
|
||||||
Expect(fileHelper.Exists(spec.Rel("build-sabayon-overlay-layer-0.20191212.package.tar"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("build-sabayon-overlay-layer-0.20191212.package.tar"))).To(BeTrue())
|
||||||
@@ -749,7 +750,7 @@ var _ = Describe("Compiler", func() {
|
|||||||
|
|
||||||
for _, artifact := range artifacts {
|
for _, artifact := range artifacts {
|
||||||
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
||||||
Expect(helpers.Untar(artifact.Path, tmpdir, false)).ToNot(HaveOccurred())
|
Expect(artifact.Unpack(ctx, tmpdir, false)).ToNot(HaveOccurred())
|
||||||
}
|
}
|
||||||
|
|
||||||
// A deps on B, so A artifacts are here:
|
// A deps on B, so A artifacts are here:
|
||||||
@@ -804,13 +805,13 @@ var _ = Describe("Compiler", func() {
|
|||||||
|
|
||||||
artifacts, errs := compiler.CompileParallel(false, compilerspec.NewLuetCompilationspecs(spec))
|
artifacts, errs := compiler.CompileParallel(false, compilerspec.NewLuetCompilationspecs(spec))
|
||||||
Expect(errs).To(BeNil())
|
Expect(errs).To(BeNil())
|
||||||
for _, artifact := range artifacts {
|
for _, a := range artifacts {
|
||||||
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
Expect(fileHelper.Exists(a.Path)).To(BeTrue())
|
||||||
Expect(helpers.Untar(artifact.Path, tmpdir, false)).ToNot(HaveOccurred())
|
Expect(a.Unpack(ctx, tmpdir, false)).ToNot(HaveOccurred())
|
||||||
|
|
||||||
for _, d := range artifact.Dependencies {
|
for _, d := range a.Dependencies {
|
||||||
Expect(fileHelper.Exists(d.Path)).To(BeTrue())
|
Expect(fileHelper.Exists(d.Path)).To(BeTrue())
|
||||||
Expect(helpers.Untar(d.Path, tmpdir, false)).ToNot(HaveOccurred())
|
Expect(artifact.NewPackageArtifact(d.Path).Unpack(ctx, tmpdir, false)).ToNot(HaveOccurred())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -848,7 +849,8 @@ var _ = Describe("Compiler", func() {
|
|||||||
Expect(errs).To(BeNil())
|
Expect(errs).To(BeNil())
|
||||||
Expect(len(artifacts)).To(Equal(1))
|
Expect(len(artifacts)).To(Equal(1))
|
||||||
Expect(len(artifacts[0].Dependencies)).To(Equal(1))
|
Expect(len(artifacts[0].Dependencies)).To(Equal(1))
|
||||||
Expect(helpers.Untar(spec.Rel("runtime-layer-0.1.package.tar"), tmpdir, false)).ToNot(HaveOccurred())
|
|
||||||
|
Expect(artifact.NewPackageArtifact(filepath.Join(tmpdir, "runtime-layer-0.1.package.tar")).Unpack(ctx, tmpdir, false)).ToNot(HaveOccurred())
|
||||||
Expect(fileHelper.Exists(spec.Rel("bin/busybox"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("bin/busybox"))).To(BeTrue())
|
||||||
Expect(fileHelper.Exists(spec.Rel("var"))).ToNot(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("var"))).ToNot(BeTrue())
|
||||||
})
|
})
|
||||||
@@ -896,11 +898,11 @@ var _ = Describe("Compiler", func() {
|
|||||||
Expect(len(artifacts)).To(Equal(2))
|
Expect(len(artifacts)).To(Equal(2))
|
||||||
Expect(len(artifacts[0].Dependencies)).To(Equal(0))
|
Expect(len(artifacts[0].Dependencies)).To(Equal(0))
|
||||||
|
|
||||||
Expect(helpers.Untar(spec.Rel("dironly-test-1.0.package.tar"), tmpdir, false)).ToNot(HaveOccurred())
|
Expect(artifact.NewPackageArtifact(filepath.Join(tmpdir, "dironly-test-1.0.package.tar")).Unpack(ctx, tmpdir, false)).ToNot(HaveOccurred())
|
||||||
Expect(fileHelper.Exists(spec.Rel("test1"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("test1"))).To(BeTrue())
|
||||||
Expect(fileHelper.Exists(spec.Rel("test2"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("test2"))).To(BeTrue())
|
||||||
|
|
||||||
Expect(helpers.Untar(spec2.Rel("dironly_filter-test-1.0.package.tar"), tmpdir2, false)).ToNot(HaveOccurred())
|
Expect(artifact.NewPackageArtifact(filepath.Join(tmpdir2, "dironly_filter-test-1.0.package.tar")).Unpack(ctx, tmpdir2, false)).ToNot(HaveOccurred())
|
||||||
Expect(fileHelper.Exists(spec2.Rel("test5"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec2.Rel("test5"))).To(BeTrue())
|
||||||
Expect(fileHelper.Exists(spec2.Rel("test6"))).ToNot(BeTrue())
|
Expect(fileHelper.Exists(spec2.Rel("test6"))).ToNot(BeTrue())
|
||||||
Expect(fileHelper.Exists(spec2.Rel("artifact42"))).ToNot(BeTrue())
|
Expect(fileHelper.Exists(spec2.Rel("artifact42"))).ToNot(BeTrue())
|
||||||
|
@@ -16,14 +16,10 @@
|
|||||||
package helpers
|
package helpers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"archive/tar"
|
|
||||||
"bytes"
|
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
|
||||||
|
|
||||||
"github.com/docker/docker/pkg/archive"
|
"github.com/docker/docker/pkg/archive"
|
||||||
"github.com/pkg/errors"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func Tar(src, dest string) error {
|
func Tar(src, dest string) error {
|
||||||
@@ -50,168 +46,3 @@ func Tar(src, dest string) error {
|
|||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
type TarModifierWrapperFunc func(path, dst string, header *tar.Header, content io.Reader) (*tar.Header, []byte, error)
|
|
||||||
type TarModifierWrapper struct {
|
|
||||||
DestinationPath string
|
|
||||||
Modifier TarModifierWrapperFunc
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewTarModifierWrapper(dst string, modifier TarModifierWrapperFunc) *TarModifierWrapper {
|
|
||||||
return &TarModifierWrapper{
|
|
||||||
DestinationPath: dst,
|
|
||||||
Modifier: modifier,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *TarModifierWrapper) GetModifier() archive.TarModifierFunc {
|
|
||||||
return func(path string, header *tar.Header, content io.Reader) (*tar.Header, []byte, error) {
|
|
||||||
return m.Modifier(m.DestinationPath, path, header, content)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func UntarProtect(src, dst string, sameOwner bool, protectedFiles []string, modifier *TarModifierWrapper) error {
|
|
||||||
var ans error
|
|
||||||
|
|
||||||
if len(protectedFiles) <= 0 {
|
|
||||||
return Untar(src, dst, sameOwner)
|
|
||||||
}
|
|
||||||
|
|
||||||
// POST: we have files to protect. I create a ReplaceFileTarWrapper
|
|
||||||
in, err := os.Open(src)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
defer in.Close()
|
|
||||||
|
|
||||||
// Create modifier map
|
|
||||||
mods := make(map[string]archive.TarModifierFunc)
|
|
||||||
for _, file := range protectedFiles {
|
|
||||||
mods[file] = modifier.GetModifier()
|
|
||||||
}
|
|
||||||
|
|
||||||
if sameOwner {
|
|
||||||
// we do have root permissions, so we can extract keeping the same permissions.
|
|
||||||
replacerArchive := archive.ReplaceFileTarWrapper(in, mods)
|
|
||||||
|
|
||||||
opts := &archive.TarOptions{
|
|
||||||
NoLchown: false,
|
|
||||||
ExcludePatterns: []string{"dev/"}, // prevent 'operation not permitted'
|
|
||||||
ContinueOnError: true,
|
|
||||||
}
|
|
||||||
|
|
||||||
ans = archive.Untar(replacerArchive, dst, opts)
|
|
||||||
} else {
|
|
||||||
ans = unTarIgnoreOwner(dst, in, mods)
|
|
||||||
}
|
|
||||||
|
|
||||||
return ans
|
|
||||||
}
|
|
||||||
|
|
||||||
func unTarIgnoreOwner(dest string, in io.ReadCloser, mods map[string]archive.TarModifierFunc) error {
|
|
||||||
tr := tar.NewReader(in)
|
|
||||||
for {
|
|
||||||
header, err := tr.Next()
|
|
||||||
|
|
||||||
var data []byte
|
|
||||||
var headerReplaced = false
|
|
||||||
|
|
||||||
switch {
|
|
||||||
case err == io.EOF:
|
|
||||||
goto tarEof
|
|
||||||
case err != nil:
|
|
||||||
return err
|
|
||||||
case header == nil:
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
// the target location where the dir/file should be created
|
|
||||||
target := filepath.Join(dest, header.Name)
|
|
||||||
if mods != nil {
|
|
||||||
modifier, ok := mods[header.Name]
|
|
||||||
if ok {
|
|
||||||
header, data, err = modifier(header.Name, header, tr)
|
|
||||||
if err != nil {
|
|
||||||
return errors.Wrap(err, "running modifier wrapper")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Override target path
|
|
||||||
target = filepath.Join(dest, header.Name)
|
|
||||||
headerReplaced = true
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check the file type
|
|
||||||
switch header.Typeflag {
|
|
||||||
|
|
||||||
// if its a dir and it doesn't exist create it
|
|
||||||
case tar.TypeDir:
|
|
||||||
if _, err := os.Stat(target); err != nil {
|
|
||||||
if err := os.MkdirAll(target, 0755); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// handle creation of file
|
|
||||||
case tar.TypeReg:
|
|
||||||
|
|
||||||
f, err := os.OpenFile(target, os.O_CREATE|os.O_RDWR, os.FileMode(header.Mode))
|
|
||||||
if err != nil {
|
|
||||||
return errors.Wrap(err, "creating destination")
|
|
||||||
}
|
|
||||||
|
|
||||||
// copy over contents
|
|
||||||
if headerReplaced {
|
|
||||||
_, err = io.Copy(f, bytes.NewReader(data))
|
|
||||||
} else {
|
|
||||||
_, err = io.Copy(f, tr)
|
|
||||||
}
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// manually close here after each file operation; defering would cause each
|
|
||||||
// file close to wait until all operations have completed.
|
|
||||||
f.Close()
|
|
||||||
|
|
||||||
case tar.TypeSymlink:
|
|
||||||
source := header.Linkname
|
|
||||||
err := os.Symlink(source, target)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
tarEof:
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Untar just a wrapper around the docker functions
|
|
||||||
func Untar(src, dest string, sameOwner bool) (err error) {
|
|
||||||
|
|
||||||
in, err := os.Open(src)
|
|
||||||
if err != nil {
|
|
||||||
return errors.Wrap(err, "while opening "+src+" for untar ")
|
|
||||||
}
|
|
||||||
defer in.Close()
|
|
||||||
|
|
||||||
if sameOwner {
|
|
||||||
opts := &archive.TarOptions{
|
|
||||||
NoLchown: false,
|
|
||||||
ExcludePatterns: []string{"dev/"}, // prevent 'operation not permitted'
|
|
||||||
ContinueOnError: true,
|
|
||||||
}
|
|
||||||
|
|
||||||
err = archive.Untar(in, dest, opts)
|
|
||||||
} else {
|
|
||||||
err = unTarIgnoreOwner(dest, in, nil)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
err = errors.Wrap(err, "while untarring "+src+" into "+dest)
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
@@ -1,136 +0,0 @@
|
|||||||
// Copyright © 2019-2020 Ettore Di Giacinto <mudler@gentoo.org>
|
|
||||||
// Daniele Rondina <geaaru@sabayonlinux.org>
|
|
||||||
//
|
|
||||||
// This program is free software; you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation; either version 2 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License along
|
|
||||||
// with this program; if not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
package helpers_test
|
|
||||||
|
|
||||||
import (
|
|
||||||
"archive/tar"
|
|
||||||
"bytes"
|
|
||||||
"fmt"
|
|
||||||
"io"
|
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
|
|
||||||
fileHelper "github.com/mudler/luet/pkg/helpers/file"
|
|
||||||
|
|
||||||
"github.com/docker/docker/pkg/archive"
|
|
||||||
. "github.com/mudler/luet/pkg/helpers"
|
|
||||||
. "github.com/onsi/ginkgo"
|
|
||||||
. "github.com/onsi/gomega"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Code from moby/moby pkg/archive/archive_test
|
|
||||||
func prepareUntarSourceDirectory(numberOfFiles int, targetPath string, makeLinks bool) (int, error) {
|
|
||||||
fileData := []byte("fooo")
|
|
||||||
for n := 0; n < numberOfFiles; n++ {
|
|
||||||
fileName := fmt.Sprintf("file-%d", n)
|
|
||||||
if err := ioutil.WriteFile(filepath.Join(targetPath, fileName), fileData, 0700); err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
if makeLinks {
|
|
||||||
if err := os.Link(filepath.Join(targetPath, fileName), filepath.Join(targetPath, fileName+"-link")); err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
totalSize := numberOfFiles * len(fileData)
|
|
||||||
return totalSize, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func tarModifierWrapperFunc(dst, path string, header *tar.Header, content io.Reader) (*tar.Header, []byte, error) {
|
|
||||||
// If the destination path already exists I rename target file name with postfix.
|
|
||||||
var basePath string
|
|
||||||
|
|
||||||
// Read data. TODO: We need change archive callback to permit to return a Reader
|
|
||||||
buffer := bytes.Buffer{}
|
|
||||||
if content != nil {
|
|
||||||
if _, err := buffer.ReadFrom(content); err != nil {
|
|
||||||
return nil, nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if header != nil {
|
|
||||||
|
|
||||||
switch header.Typeflag {
|
|
||||||
case tar.TypeReg:
|
|
||||||
basePath = filepath.Base(path)
|
|
||||||
default:
|
|
||||||
// Nothing to do. I return original reader
|
|
||||||
return header, buffer.Bytes(), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
if basePath == "file-0" {
|
|
||||||
name := filepath.Join(filepath.Join(filepath.Dir(path), fmt.Sprintf("._cfg%04d_%s", 1, basePath)))
|
|
||||||
return &tar.Header{
|
|
||||||
Mode: header.Mode,
|
|
||||||
Typeflag: header.Typeflag,
|
|
||||||
PAXRecords: header.PAXRecords,
|
|
||||||
Name: name,
|
|
||||||
}, buffer.Bytes(), nil
|
|
||||||
} else if basePath == "file-1" {
|
|
||||||
return header, []byte("newcontent"), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// else file not present
|
|
||||||
}
|
|
||||||
|
|
||||||
return header, buffer.Bytes(), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ = Describe("Helpers Archive", func() {
|
|
||||||
Context("Untar Protect", func() {
|
|
||||||
|
|
||||||
It("Detect existing and not-existing files", func() {
|
|
||||||
|
|
||||||
archiveSourceDir, err := ioutil.TempDir("", "archive-source")
|
|
||||||
Expect(err).ToNot(HaveOccurred())
|
|
||||||
defer os.RemoveAll(archiveSourceDir)
|
|
||||||
|
|
||||||
_, err = prepareUntarSourceDirectory(10, archiveSourceDir, false)
|
|
||||||
Expect(err).ToNot(HaveOccurred())
|
|
||||||
|
|
||||||
targetDir, err := ioutil.TempDir("", "archive-target")
|
|
||||||
Expect(err).ToNot(HaveOccurred())
|
|
||||||
// defer os.RemoveAll(targetDir)
|
|
||||||
|
|
||||||
sourceArchive, err := archive.TarWithOptions(archiveSourceDir, &archive.TarOptions{})
|
|
||||||
Expect(err).ToNot(HaveOccurred())
|
|
||||||
defer sourceArchive.Close()
|
|
||||||
|
|
||||||
tarModifier := NewTarModifierWrapper(targetDir, tarModifierWrapperFunc)
|
|
||||||
mods := make(map[string]archive.TarModifierFunc)
|
|
||||||
mods["file-0"] = tarModifier.GetModifier()
|
|
||||||
mods["file-1"] = tarModifier.GetModifier()
|
|
||||||
mods["file-9999"] = tarModifier.GetModifier()
|
|
||||||
|
|
||||||
replacerArchive := archive.ReplaceFileTarWrapper(sourceArchive, mods)
|
|
||||||
//replacerArchive := archive.ReplaceFileTarWrapper(sourceArchive, mods)
|
|
||||||
opts := &archive.TarOptions{
|
|
||||||
// NOTE: NoLchown boolean is used for chmod of the symlink
|
|
||||||
// Probably it's needed set this always to true.
|
|
||||||
NoLchown: true,
|
|
||||||
ExcludePatterns: []string{"dev/"}, // prevent 'operation not permitted'
|
|
||||||
ContinueOnError: true,
|
|
||||||
}
|
|
||||||
|
|
||||||
err = archive.Untar(replacerArchive, targetDir, opts)
|
|
||||||
Expect(err).ToNot(HaveOccurred())
|
|
||||||
|
|
||||||
Expect(fileHelper.Exists(filepath.Join(targetDir, "._cfg0001_file-0"))).Should(Equal(true))
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
@@ -27,7 +27,6 @@ import (
|
|||||||
compression "github.com/mudler/luet/pkg/compiler/types/compression"
|
compression "github.com/mudler/luet/pkg/compiler/types/compression"
|
||||||
"github.com/mudler/luet/pkg/compiler/types/options"
|
"github.com/mudler/luet/pkg/compiler/types/options"
|
||||||
compilerspec "github.com/mudler/luet/pkg/compiler/types/spec"
|
compilerspec "github.com/mudler/luet/pkg/compiler/types/spec"
|
||||||
"github.com/mudler/luet/pkg/helpers"
|
|
||||||
fileHelper "github.com/mudler/luet/pkg/helpers/file"
|
fileHelper "github.com/mudler/luet/pkg/helpers/file"
|
||||||
|
|
||||||
. "github.com/mudler/luet/pkg/installer"
|
. "github.com/mudler/luet/pkg/installer"
|
||||||
@@ -94,7 +93,7 @@ var _ = Describe("Installer", func() {
|
|||||||
a, err := c.Compile(false, spec)
|
a, err := c.Compile(false, spec)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(fileHelper.Exists(a.Path)).To(BeTrue())
|
Expect(fileHelper.Exists(a.Path)).To(BeTrue())
|
||||||
Expect(helpers.Untar(a.Path, tmpdir, false)).ToNot(HaveOccurred())
|
Expect(a.Unpack(ctx, tmpdir, false)).ToNot(HaveOccurred())
|
||||||
|
|
||||||
Expect(fileHelper.Exists(spec.Rel("test5"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("test5"))).To(BeTrue())
|
||||||
Expect(fileHelper.Exists(spec.Rel("test6"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("test6"))).To(BeTrue())
|
||||||
@@ -211,7 +210,7 @@ urls:
|
|||||||
artifact, err := c.Compile(false, spec)
|
artifact, err := c.Compile(false, spec)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
||||||
Expect(helpers.Untar(artifact.Path, tmpdir, false)).ToNot(HaveOccurred())
|
Expect(artifact.Unpack(ctx, tmpdir, false)).ToNot(HaveOccurred())
|
||||||
|
|
||||||
Expect(fileHelper.Exists(spec.Rel("test5"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("test5"))).To(BeTrue())
|
||||||
Expect(fileHelper.Exists(spec.Rel("test6"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("test6"))).To(BeTrue())
|
||||||
@@ -334,7 +333,7 @@ urls:
|
|||||||
artifact, err := c.Compile(false, spec)
|
artifact, err := c.Compile(false, spec)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
||||||
Expect(helpers.Untar(artifact.Path, tmpdir, false)).ToNot(HaveOccurred())
|
Expect(artifact.Unpack(ctx, tmpdir, false)).ToNot(HaveOccurred())
|
||||||
|
|
||||||
Expect(fileHelper.Exists(spec.Rel("test5"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("test5"))).To(BeTrue())
|
||||||
Expect(fileHelper.Exists(spec.Rel("test6"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("test6"))).To(BeTrue())
|
||||||
@@ -463,7 +462,7 @@ urls:
|
|||||||
artifact, err := c.Compile(false, spec)
|
artifact, err := c.Compile(false, spec)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
||||||
Expect(helpers.Untar(artifact.Path, tmpdir, false)).ToNot(HaveOccurred())
|
Expect(artifact.Unpack(ctx, tmpdir, false)).ToNot(HaveOccurred())
|
||||||
|
|
||||||
Expect(fileHelper.Exists(spec.Rel("test5"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("test5"))).To(BeTrue())
|
||||||
Expect(fileHelper.Exists(spec.Rel("test6"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("test6"))).To(BeTrue())
|
||||||
|
@@ -30,7 +30,6 @@ import (
|
|||||||
backend "github.com/mudler/luet/pkg/compiler/backend"
|
backend "github.com/mudler/luet/pkg/compiler/backend"
|
||||||
"github.com/mudler/luet/pkg/compiler/types/options"
|
"github.com/mudler/luet/pkg/compiler/types/options"
|
||||||
compilerspec "github.com/mudler/luet/pkg/compiler/types/spec"
|
compilerspec "github.com/mudler/luet/pkg/compiler/types/spec"
|
||||||
"github.com/mudler/luet/pkg/helpers"
|
|
||||||
fileHelper "github.com/mudler/luet/pkg/helpers/file"
|
fileHelper "github.com/mudler/luet/pkg/helpers/file"
|
||||||
. "github.com/mudler/luet/pkg/installer"
|
. "github.com/mudler/luet/pkg/installer"
|
||||||
pkg "github.com/mudler/luet/pkg/package"
|
pkg "github.com/mudler/luet/pkg/package"
|
||||||
@@ -92,7 +91,7 @@ var _ = Describe("Repository", func() {
|
|||||||
artifact, err := compiler.Compile(false, spec)
|
artifact, err := compiler.Compile(false, spec)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
||||||
Expect(helpers.Untar(artifact.Path, tmpdir, false)).ToNot(HaveOccurred())
|
Expect(artifact.Unpack(ctx, tmpdir, false)).ToNot(HaveOccurred())
|
||||||
|
|
||||||
Expect(fileHelper.Exists(spec.Rel("test5"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("test5"))).To(BeTrue())
|
||||||
Expect(fileHelper.Exists(spec.Rel("test6"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("test6"))).To(BeTrue())
|
||||||
@@ -165,12 +164,12 @@ var _ = Describe("Repository", func() {
|
|||||||
artifact, err := compiler.Compile(false, spec)
|
artifact, err := compiler.Compile(false, spec)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
||||||
Expect(helpers.Untar(artifact.Path, tmpdir, false)).ToNot(HaveOccurred())
|
Expect(artifact.Unpack(ctx, tmpdir, false)).ToNot(HaveOccurred())
|
||||||
|
|
||||||
artifact2, err := compiler2.Compile(false, spec2)
|
artifact2, err := compiler2.Compile(false, spec2)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(fileHelper.Exists(artifact2.Path)).To(BeTrue())
|
Expect(fileHelper.Exists(artifact2.Path)).To(BeTrue())
|
||||||
Expect(helpers.Untar(artifact2.Path, tmpdir, false)).ToNot(HaveOccurred())
|
Expect(artifact2.Unpack(ctx, tmpdir, false)).ToNot(HaveOccurred())
|
||||||
|
|
||||||
Expect(fileHelper.Exists(spec.Rel("test5"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("test5"))).To(BeTrue())
|
||||||
Expect(fileHelper.Exists(spec.Rel("test6"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("test6"))).To(BeTrue())
|
||||||
@@ -262,12 +261,12 @@ urls:
|
|||||||
artifact, err := compiler.Compile(false, spec)
|
artifact, err := compiler.Compile(false, spec)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
||||||
Expect(helpers.Untar(artifact.Path, tmpdir, false)).ToNot(HaveOccurred())
|
Expect(artifact.Unpack(ctx, tmpdir, false)).ToNot(HaveOccurred())
|
||||||
|
|
||||||
artifact2, err := compiler2.Compile(false, spec2)
|
artifact2, err := compiler2.Compile(false, spec2)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(fileHelper.Exists(artifact2.Path)).To(BeTrue())
|
Expect(fileHelper.Exists(artifact2.Path)).To(BeTrue())
|
||||||
Expect(helpers.Untar(artifact2.Path, tmpdir, false)).ToNot(HaveOccurred())
|
Expect(artifact2.Unpack(ctx, tmpdir, false)).ToNot(HaveOccurred())
|
||||||
|
|
||||||
Expect(fileHelper.Exists(spec.Rel("test5"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("test5"))).To(BeTrue())
|
||||||
Expect(fileHelper.Exists(spec.Rel("test6"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("test6"))).To(BeTrue())
|
||||||
@@ -380,12 +379,12 @@ urls:
|
|||||||
artifact, err := compiler.Compile(false, spec)
|
artifact, err := compiler.Compile(false, spec)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
Expect(fileHelper.Exists(artifact.Path)).To(BeTrue())
|
||||||
Expect(helpers.Untar(artifact.Path, tmpdir, false)).ToNot(HaveOccurred())
|
Expect(artifact.Unpack(ctx, tmpdir, false)).ToNot(HaveOccurred())
|
||||||
|
|
||||||
artifact2, err := compiler2.Compile(false, spec2)
|
artifact2, err := compiler2.Compile(false, spec2)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(fileHelper.Exists(artifact2.Path)).To(BeTrue())
|
Expect(fileHelper.Exists(artifact2.Path)).To(BeTrue())
|
||||||
Expect(helpers.Untar(artifact2.Path, tmpdir, false)).ToNot(HaveOccurred())
|
Expect(artifact2.Unpack(ctx, tmpdir, false)).ToNot(HaveOccurred())
|
||||||
|
|
||||||
Expect(fileHelper.Exists(spec.Rel("test5"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("test5"))).To(BeTrue())
|
||||||
Expect(fileHelper.Exists(spec.Rel("test6"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("test6"))).To(BeTrue())
|
||||||
@@ -505,7 +504,7 @@ urls:
|
|||||||
a, err := localcompiler.Compile(false, spec)
|
a, err := localcompiler.Compile(false, spec)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(fileHelper.Exists(a.Path)).To(BeTrue())
|
Expect(fileHelper.Exists(a.Path)).To(BeTrue())
|
||||||
Expect(helpers.Untar(a.Path, tmpdir, false)).ToNot(HaveOccurred())
|
Expect(a.Unpack(ctx, tmpdir, false)).ToNot(HaveOccurred())
|
||||||
|
|
||||||
Expect(fileHelper.Exists(spec.Rel("test5"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("test5"))).To(BeTrue())
|
||||||
Expect(fileHelper.Exists(spec.Rel("test6"))).To(BeTrue())
|
Expect(fileHelper.Exists(spec.Rel("test6"))).To(BeTrue())
|
||||||
@@ -580,7 +579,7 @@ urls:
|
|||||||
a, err := localcompiler.Compile(false, spec)
|
a, err := localcompiler.Compile(false, spec)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(fileHelper.Exists(a.Path)).To(BeTrue())
|
Expect(fileHelper.Exists(a.Path)).To(BeTrue())
|
||||||
Expect(helpers.Untar(a.Path, tmpdir, false)).ToNot(HaveOccurred())
|
Expect(a.Unpack(ctx, tmpdir, false)).ToNot(HaveOccurred())
|
||||||
|
|
||||||
repo, err := dockerStubRepo(tmpdir, "../../tests/fixtures/virtuals", repoImage, true, true)
|
repo, err := dockerStubRepo(tmpdir, "../../tests/fixtures/virtuals", repoImage, true, true)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
Reference in New Issue
Block a user