diff --git a/.gitignore b/.gitignore index f5f8575e..f380af57 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ *.swp *.stacker -stacker -stacker-dynamic +/stacker +/stacker-dynamic .build # IDEs diff --git a/Makefile b/Makefile index c025a32a..bb4cb95d 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ BUILD_TAGS = exclude_graphdriver_btrfs exclude_graphdriver_devicemapper containe STACKER_OPTS=--oci-dir=.build/oci --roots-dir=.build/roots --stacker-dir=.build/stacker --storage-type=overlay -build_stacker = go build -tags "$(BUILD_TAGS) $1" -ldflags "-X main.version=$(VERSION_FULL) -X main.lxc_version=$(LXC_VERSION) $2" -o $3 ./cmd +build_stacker = go build -tags "$(BUILD_TAGS) $1" -ldflags "-X main.version=$(VERSION_FULL) -X main.lxc_version=$(LXC_VERSION) $2" -o $3 ./cmd/stacker STACKER_DOCKER_BASE?=docker:// STACKER_BUILD_BASE_IMAGE?=$(STACKER_DOCKER_BASE)alpine:edge @@ -24,19 +24,19 @@ stacker: stacker-dynamic --substitute LXC_CLONE_URL=$(LXC_CLONE_URL) \ --substitute LXC_BRANCH=$(LXC_BRANCH) -stacker-static: $(GO_SRC) go.mod go.sum cmd/lxc-wrapper/lxc-wrapper +stacker-static: $(GO_SRC) go.mod go.sum cmd/stacker/lxc-wrapper/lxc-wrapper $(call build_stacker,static_build,-extldflags '-static',stacker) # TODO: because we clean lxc-wrapper in the nested build, this always rebuilds. # Could find a better way to do this. -stacker-dynamic: $(GO_SRC) go.mod go.sum cmd/lxc-wrapper/lxc-wrapper +stacker-dynamic: $(GO_SRC) go.mod go.sum cmd/stacker/lxc-wrapper/lxc-wrapper $(call build_stacker,,,stacker-dynamic) -cmd/lxc-wrapper/lxc-wrapper: cmd/lxc-wrapper/lxc-wrapper.c - make -C cmd/lxc-wrapper LDFLAGS=-static LDLIBS="$(shell pkg-config --static --libs lxc) -lpthread -ldl" lxc-wrapper +cmd/stacker/lxc-wrapper/lxc-wrapper: cmd/stacker/lxc-wrapper/lxc-wrapper.c + make -C cmd/stacker/lxc-wrapper LDFLAGS=-static LDLIBS="$(shell pkg-config --static --libs lxc) -lpthread -ldl" lxc-wrapper .PHONY: lint -lint: cmd/lxc-wrapper/lxc-wrapper $(GO_SRC) +lint: cmd/stacker/lxc-wrapper/lxc-wrapper $(GO_SRC) go mod tidy go fmt ./... && ([ -z $(CI) ] || git diff --exit-code) bash test/static-analysis.sh @@ -69,4 +69,4 @@ vendorup: clean: -unshare -Urm rm -rf stacker stacker-dynamic .build -rm -r ./test/centos ./test/ubuntu - -make -C cmd/lxc-wrapper clean + -make -C cmd/stacker/lxc-wrapper clean diff --git a/build.yaml b/build.yaml index 1ea09c48..56ad9b7c 100644 --- a/build.yaml +++ b/build.yaml @@ -86,5 +86,5 @@ build: export GOPATH=/stacker-tree/.build/gopath export LXC_VERSION=$(git -C /lxc rev-parse HEAD) - make -C /stacker-tree/cmd/lxc-wrapper clean + make -C /stacker-tree/cmd/stacker/lxc-wrapper clean make -C /stacker-tree stacker-static diff --git a/cmd/build.go b/cmd/stacker/build.go similarity index 96% rename from cmd/build.go rename to cmd/stacker/build.go index 6d633283..89f848bc 100644 --- a/cmd/build.go +++ b/cmd/stacker/build.go @@ -4,9 +4,9 @@ import ( "fmt" "github.com/urfave/cli" - "stackerbuild.io/stacker" - "stackerbuild.io/stacker/squashfs" - "stackerbuild.io/stacker/types" + "stackerbuild.io/stacker/pkg/squashfs" + "stackerbuild.io/stacker/pkg/stacker" + "stackerbuild.io/stacker/pkg/types" ) var buildCmd = cli.Command{ diff --git a/cmd/check.go b/cmd/stacker/check.go similarity index 97% rename from cmd/check.go rename to cmd/stacker/check.go index e12ff54b..855e24ba 100644 --- a/cmd/check.go +++ b/cmd/stacker/check.go @@ -8,7 +8,7 @@ import ( "github.com/pkg/errors" "github.com/pkg/xattr" "github.com/urfave/cli" - "stackerbuild.io/stacker/overlay" + "stackerbuild.io/stacker/pkg/overlay" ) var checkCmd = cli.Command{ diff --git a/cmd/chroot.go b/cmd/stacker/chroot.go similarity index 93% rename from cmd/chroot.go rename to cmd/stacker/chroot.go index 30bd8df9..f330d1be 100644 --- a/cmd/chroot.go +++ b/cmd/stacker/chroot.go @@ -6,10 +6,10 @@ import ( "github.com/pkg/errors" "github.com/urfave/cli" - "stackerbuild.io/stacker" - "stackerbuild.io/stacker/container" - "stackerbuild.io/stacker/log" - "stackerbuild.io/stacker/types" + "stackerbuild.io/stacker/pkg/container" + "stackerbuild.io/stacker/pkg/log" + "stackerbuild.io/stacker/pkg/stacker" + "stackerbuild.io/stacker/pkg/types" ) var chrootCmd = cli.Command{ diff --git a/cmd/clean.go b/cmd/stacker/clean.go similarity index 93% rename from cmd/clean.go rename to cmd/stacker/clean.go index b997ec34..9292a52f 100644 --- a/cmd/clean.go +++ b/cmd/stacker/clean.go @@ -5,8 +5,8 @@ import ( "github.com/pkg/errors" "github.com/urfave/cli" - "stackerbuild.io/stacker" - "stackerbuild.io/stacker/log" + "stackerbuild.io/stacker/pkg/log" + "stackerbuild.io/stacker/pkg/stacker" ) var cleanCmd = cli.Command{ diff --git a/cmd/gc.go b/cmd/stacker/gc.go similarity index 88% rename from cmd/gc.go rename to cmd/stacker/gc.go index abf091db..8e9a9808 100644 --- a/cmd/gc.go +++ b/cmd/stacker/gc.go @@ -2,7 +2,7 @@ package main import ( "github.com/urfave/cli" - "stackerbuild.io/stacker" + "stackerbuild.io/stacker/pkg/stacker" ) var gcCmd = cli.Command{ diff --git a/cmd/grab.go b/cmd/stacker/grab.go similarity index 95% rename from cmd/grab.go rename to cmd/stacker/grab.go index 44b9ddf9..c8a6b7d6 100644 --- a/cmd/grab.go +++ b/cmd/stacker/grab.go @@ -6,7 +6,7 @@ import ( "github.com/pkg/errors" "github.com/urfave/cli" - "stackerbuild.io/stacker" + "stackerbuild.io/stacker/pkg/stacker" ) var grabCmd = cli.Command{ diff --git a/cmd/inspect.go b/cmd/stacker/inspect.go similarity index 97% rename from cmd/inspect.go rename to cmd/stacker/inspect.go index ab1184bd..05f278cf 100644 --- a/cmd/inspect.go +++ b/cmd/stacker/inspect.go @@ -11,7 +11,7 @@ import ( "github.com/opencontainers/umoci/oci/casext" "github.com/pkg/errors" "github.com/urfave/cli" - stackeroci "stackerbuild.io/stacker/oci" + stackeroci "stackerbuild.io/stacker/pkg/oci" ) var inspectCmd = cli.Command{ diff --git a/cmd/internal_go.go b/cmd/stacker/internal_go.go similarity index 96% rename from cmd/internal_go.go rename to cmd/stacker/internal_go.go index a3c9b457..976cfc30 100644 --- a/cmd/internal_go.go +++ b/cmd/stacker/internal_go.go @@ -10,10 +10,10 @@ import ( "github.com/pkg/errors" "github.com/urfave/cli" "golang.org/x/sys/unix" - "stackerbuild.io/stacker/atomfs" - "stackerbuild.io/stacker/lib" - "stackerbuild.io/stacker/log" - "stackerbuild.io/stacker/overlay" + "stackerbuild.io/stacker/pkg/atomfs" + "stackerbuild.io/stacker/pkg/lib" + "stackerbuild.io/stacker/pkg/log" + "stackerbuild.io/stacker/pkg/overlay" ) var internalGoCmd = cli.Command{ diff --git a/cmd/lxc-wrapper/.gitignore b/cmd/stacker/lxc-wrapper/.gitignore similarity index 100% rename from cmd/lxc-wrapper/.gitignore rename to cmd/stacker/lxc-wrapper/.gitignore diff --git a/cmd/lxc-wrapper/Makefile b/cmd/stacker/lxc-wrapper/Makefile similarity index 100% rename from cmd/lxc-wrapper/Makefile rename to cmd/stacker/lxc-wrapper/Makefile diff --git a/cmd/lxc-wrapper/lxc-wrapper.c b/cmd/stacker/lxc-wrapper/lxc-wrapper.c similarity index 100% rename from cmd/lxc-wrapper/lxc-wrapper.c rename to cmd/stacker/lxc-wrapper/lxc-wrapper.c diff --git a/cmd/main.go b/cmd/stacker/main.go similarity index 98% rename from cmd/main.go rename to cmd/stacker/main.go index 0a77066f..ae9727fb 100644 --- a/cmd/main.go +++ b/cmd/stacker/main.go @@ -17,9 +17,9 @@ import ( "github.com/urfave/cli" "golang.org/x/term" "gopkg.in/yaml.v2" - "stackerbuild.io/stacker/container" - stackerlog "stackerbuild.io/stacker/log" - "stackerbuild.io/stacker/types" + "stackerbuild.io/stacker/pkg/container" + stackerlog "stackerbuild.io/stacker/pkg/log" + "stackerbuild.io/stacker/pkg/types" ) var ( diff --git a/cmd/publish.go b/cmd/stacker/publish.go similarity index 95% rename from cmd/publish.go rename to cmd/stacker/publish.go index 28784928..1cfed357 100644 --- a/cmd/publish.go +++ b/cmd/stacker/publish.go @@ -3,10 +3,10 @@ package main import ( "github.com/pkg/errors" "github.com/urfave/cli" - "stackerbuild.io/stacker" - "stackerbuild.io/stacker/lib" - "stackerbuild.io/stacker/squashfs" - "stackerbuild.io/stacker/types" + "stackerbuild.io/stacker/pkg/lib" + "stackerbuild.io/stacker/pkg/squashfs" + "stackerbuild.io/stacker/pkg/stacker" + "stackerbuild.io/stacker/pkg/types" ) var publishCmd = cli.Command{ diff --git a/cmd/recursive-build.go b/cmd/stacker/recursive-build.go similarity index 95% rename from cmd/recursive-build.go rename to cmd/stacker/recursive-build.go index 4315b808..d288e7aa 100644 --- a/cmd/recursive-build.go +++ b/cmd/stacker/recursive-build.go @@ -2,8 +2,8 @@ package main import ( "github.com/urfave/cli" - "stackerbuild.io/stacker" - "stackerbuild.io/stacker/lib" + "stackerbuild.io/stacker/pkg/lib" + "stackerbuild.io/stacker/pkg/stacker" ) const stackerFilePathRegex = "\\/stacker.yaml$" diff --git a/cmd/unpriv-setup.go b/cmd/stacker/unpriv-setup.go similarity index 98% rename from cmd/unpriv-setup.go rename to cmd/stacker/unpriv-setup.go index 6a90482e..b2c3eb39 100644 --- a/cmd/unpriv-setup.go +++ b/cmd/stacker/unpriv-setup.go @@ -7,7 +7,7 @@ import ( "github.com/pkg/errors" "github.com/urfave/cli" - "stackerbuild.io/stacker" + "stackerbuild.io/stacker/pkg/stacker" ) var unprivSetupCmd = cli.Command{ diff --git a/cmd/validate.go b/cmd/stacker/validate.go similarity index 97% rename from cmd/validate.go rename to cmd/stacker/validate.go index e3d66f36..b0bf8b4c 100644 --- a/cmd/validate.go +++ b/cmd/stacker/validate.go @@ -7,7 +7,7 @@ import ( "github.com/pkg/errors" "github.com/urfave/cli" - "stackerbuild.io/stacker" + "stackerbuild.io/stacker/pkg/stacker" ) /* diff --git a/atomfs/molecule.go b/pkg/atomfs/molecule.go similarity index 98% rename from atomfs/molecule.go rename to pkg/atomfs/molecule.go index 71b21175..8a941ae9 100644 --- a/atomfs/molecule.go +++ b/pkg/atomfs/molecule.go @@ -9,8 +9,8 @@ import ( ispec "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" "golang.org/x/sys/unix" - "stackerbuild.io/stacker/mount" - "stackerbuild.io/stacker/squashfs" + "stackerbuild.io/stacker/pkg/mount" + "stackerbuild.io/stacker/pkg/squashfs" ) type Molecule struct { diff --git a/atomfs/molecule_test.go b/pkg/atomfs/molecule_test.go similarity index 100% rename from atomfs/molecule_test.go rename to pkg/atomfs/molecule_test.go diff --git a/atomfs/oci.go b/pkg/atomfs/oci.go similarity index 97% rename from atomfs/oci.go rename to pkg/atomfs/oci.go index 2b5334a9..c3acbbc4 100644 --- a/atomfs/oci.go +++ b/pkg/atomfs/oci.go @@ -5,7 +5,7 @@ import ( ispec "github.com/opencontainers/image-spec/specs-go/v1" "github.com/opencontainers/umoci" - stackeroci "stackerbuild.io/stacker/oci" + stackeroci "stackerbuild.io/stacker/pkg/oci" ) type MountOCIOpts struct { diff --git a/container/container.go b/pkg/container/container.go similarity index 97% rename from container/container.go rename to pkg/container/container.go index 4f27b8ef..123d6714 100644 --- a/container/container.go +++ b/pkg/container/container.go @@ -12,9 +12,9 @@ import ( "github.com/lxc/go-lxc" "github.com/pkg/errors" - embed_exec "stackerbuild.io/stacker/embed-exec" - "stackerbuild.io/stacker/log" - "stackerbuild.io/stacker/types" + embed_exec "stackerbuild.io/stacker/pkg/embed-exec" + "stackerbuild.io/stacker/pkg/log" + "stackerbuild.io/stacker/pkg/types" ) const ( diff --git a/container/idmap/idmap.go b/pkg/container/idmap/idmap.go similarity index 100% rename from container/idmap/idmap.go rename to pkg/container/idmap/idmap.go diff --git a/container/userns.go b/pkg/container/userns.go similarity index 91% rename from container/userns.go rename to pkg/container/userns.go index 36429919..25c4ce76 100644 --- a/container/userns.go +++ b/pkg/container/userns.go @@ -6,10 +6,10 @@ import ( "os/exec" "github.com/pkg/errors" - stackeridmap "stackerbuild.io/stacker/container/idmap" - embed_exec "stackerbuild.io/stacker/embed-exec" - "stackerbuild.io/stacker/log" - "stackerbuild.io/stacker/types" + stackeridmap "stackerbuild.io/stacker/pkg/container/idmap" + embed_exec "stackerbuild.io/stacker/pkg/embed-exec" + "stackerbuild.io/stacker/pkg/log" + "stackerbuild.io/stacker/pkg/types" ) // A wrapper which executes userCmd in a namespace if stacker has not already diff --git a/embed-exec/embed-exec.go b/pkg/embed-exec/embed-exec.go similarity index 100% rename from embed-exec/embed-exec.go rename to pkg/embed-exec/embed-exec.go diff --git a/lib/containers_storage/lib.go b/pkg/lib/containers_storage/lib.go similarity index 92% rename from lib/containers_storage/lib.go rename to pkg/lib/containers_storage/lib.go index 993c5dab..b2705ca8 100644 --- a/lib/containers_storage/lib.go +++ b/pkg/lib/containers_storage/lib.go @@ -6,7 +6,7 @@ package containers_storage import ( "github.com/containers/image/v5/storage" - "stackerbuild.io/stacker/lib" + "stackerbuild.io/stacker/pkg/lib" ) func init() { diff --git a/lib/dag.go b/pkg/lib/dag.go similarity index 100% rename from lib/dag.go rename to pkg/lib/dag.go diff --git a/lib/dag_test.go b/pkg/lib/dag_test.go similarity index 100% rename from lib/dag_test.go rename to pkg/lib/dag_test.go diff --git a/lib/dir.go b/pkg/lib/dir.go similarity index 100% rename from lib/dir.go rename to pkg/lib/dir.go diff --git a/lib/file.go b/pkg/lib/file.go similarity index 100% rename from lib/file.go rename to pkg/lib/file.go diff --git a/lib/hash.go b/pkg/lib/hash.go similarity index 100% rename from lib/hash.go rename to pkg/lib/hash.go diff --git a/lib/image.go b/pkg/lib/image.go similarity index 100% rename from lib/image.go rename to pkg/lib/image.go diff --git a/lib/image_test.go b/pkg/lib/image_test.go similarity index 98% rename from lib/image_test.go rename to pkg/lib/image_test.go index 99acdbd0..8d620fef 100644 --- a/lib/image_test.go +++ b/pkg/lib/image_test.go @@ -13,7 +13,7 @@ import ( "github.com/opencontainers/umoci/mutate" "github.com/opencontainers/umoci/oci/casext" "github.com/stretchr/testify/assert" - "stackerbuild.io/stacker/squashfs" + "stackerbuild.io/stacker/pkg/squashfs" ) func createImage(dir string, tag string) error { diff --git a/log/log.go b/pkg/log/log.go similarity index 100% rename from log/log.go rename to pkg/log/log.go diff --git a/mount/mountinfo.go b/pkg/mount/mountinfo.go similarity index 100% rename from mount/mountinfo.go rename to pkg/mount/mountinfo.go diff --git a/mtree/filter.go b/pkg/mtree/filter.go similarity index 100% rename from mtree/filter.go rename to pkg/mtree/filter.go diff --git a/oci/oci.go b/pkg/oci/oci.go similarity index 100% rename from oci/oci.go rename to pkg/oci/oci.go diff --git a/overlay/metadata.go b/pkg/overlay/metadata.go similarity index 97% rename from overlay/metadata.go rename to pkg/overlay/metadata.go index 9c7187d7..2d5cbff7 100644 --- a/overlay/metadata.go +++ b/pkg/overlay/metadata.go @@ -10,9 +10,9 @@ import ( ispec "github.com/opencontainers/image-spec/specs-go/v1" "github.com/opencontainers/umoci/oci/casext" "github.com/pkg/errors" - "stackerbuild.io/stacker/log" - stackeroci "stackerbuild.io/stacker/oci" - "stackerbuild.io/stacker/types" + "stackerbuild.io/stacker/pkg/log" + stackeroci "stackerbuild.io/stacker/pkg/oci" + "stackerbuild.io/stacker/pkg/types" ) type overlayMetadata struct { diff --git a/overlay/metadata_test.go b/pkg/overlay/metadata_test.go similarity index 100% rename from overlay/metadata_test.go rename to pkg/overlay/metadata_test.go diff --git a/overlay/overlay-dirs.go b/pkg/overlay/overlay-dirs.go similarity index 97% rename from overlay/overlay-dirs.go rename to pkg/overlay/overlay-dirs.go index 30524228..4270d1fd 100644 --- a/overlay/overlay-dirs.go +++ b/pkg/overlay/overlay-dirs.go @@ -7,8 +7,8 @@ import ( ispec "github.com/opencontainers/image-spec/specs-go/v1" "github.com/opencontainers/umoci" "github.com/pkg/errors" - "stackerbuild.io/stacker/lib" - "stackerbuild.io/stacker/types" + "stackerbuild.io/stacker/pkg/lib" + "stackerbuild.io/stacker/pkg/types" ) // generateOverlayDirsLayers generates oci layers from all overlay_dirs of this image diff --git a/overlay/overlay.go b/pkg/overlay/overlay.go similarity index 99% rename from overlay/overlay.go rename to pkg/overlay/overlay.go index aa7d0458..2b153c3c 100644 --- a/overlay/overlay.go +++ b/pkg/overlay/overlay.go @@ -13,7 +13,7 @@ import ( "github.com/pkg/errors" "golang.org/x/sys/unix" - "stackerbuild.io/stacker/types" + "stackerbuild.io/stacker/pkg/types" ) var _ types.Storage = &overlay{} diff --git a/overlay/pack.go b/pkg/overlay/pack.go similarity index 98% rename from overlay/pack.go rename to pkg/overlay/pack.go index dee7f152..dad09720 100644 --- a/overlay/pack.go +++ b/pkg/overlay/pack.go @@ -21,12 +21,12 @@ import ( "github.com/opencontainers/umoci/oci/layer" "github.com/pkg/errors" "github.com/pkg/xattr" - "stackerbuild.io/stacker/lib" - "stackerbuild.io/stacker/log" - stackeroci "stackerbuild.io/stacker/oci" - "stackerbuild.io/stacker/squashfs" - "stackerbuild.io/stacker/storage" - "stackerbuild.io/stacker/types" + "stackerbuild.io/stacker/pkg/lib" + "stackerbuild.io/stacker/pkg/log" + stackeroci "stackerbuild.io/stacker/pkg/oci" + "stackerbuild.io/stacker/pkg/squashfs" + "stackerbuild.io/stacker/pkg/storage" + "stackerbuild.io/stacker/pkg/types" ) func safeOverlayName(d digest.Digest) string { diff --git a/overlay/pool.go b/pkg/overlay/pool.go similarity index 100% rename from overlay/pool.go rename to pkg/overlay/pool.go diff --git a/overlay/unpriv-setup.go b/pkg/overlay/unpriv-setup.go similarity index 76% rename from overlay/unpriv-setup.go rename to pkg/overlay/unpriv-setup.go index ac1f9b40..13f747fd 100644 --- a/overlay/unpriv-setup.go +++ b/pkg/overlay/unpriv-setup.go @@ -1,7 +1,7 @@ package overlay import ( - "stackerbuild.io/stacker/types" + "stackerbuild.io/stacker/pkg/types" ) func UnprivSetup(config types.StackerConfig, uid, gid int) error { diff --git a/squashfs/mediatype.go b/pkg/squashfs/mediatype.go similarity index 100% rename from squashfs/mediatype.go rename to pkg/squashfs/mediatype.go diff --git a/squashfs/squashfs.go b/pkg/squashfs/squashfs.go similarity index 99% rename from squashfs/squashfs.go rename to pkg/squashfs/squashfs.go index 52497bea..aa710d9f 100644 --- a/squashfs/squashfs.go +++ b/pkg/squashfs/squashfs.go @@ -15,7 +15,7 @@ import ( "github.com/pkg/errors" "golang.org/x/sys/unix" - "stackerbuild.io/stacker/log" + "stackerbuild.io/stacker/pkg/log" ) var checkZstdSupported sync.Once diff --git a/squashfs/verity.go b/pkg/squashfs/verity.go similarity index 99% rename from squashfs/verity.go rename to pkg/squashfs/verity.go index 8b91b1c6..59411832 100644 --- a/squashfs/verity.go +++ b/pkg/squashfs/verity.go @@ -78,7 +78,7 @@ import ( "github.com/martinjungblut/go-cryptsetup" "github.com/pkg/errors" "golang.org/x/sys/unix" - "stackerbuild.io/stacker/mount" + "stackerbuild.io/stacker/pkg/mount" ) const VerityRootHashAnnotation = "io.stackeroci.stacker.squashfs_verity_root_hash" diff --git a/squashfs/verity_static.go b/pkg/squashfs/verity_static.go similarity index 100% rename from squashfs/verity_static.go rename to pkg/squashfs/verity_static.go diff --git a/squashfs/verity_test.go b/pkg/squashfs/verity_test.go similarity index 100% rename from squashfs/verity_test.go rename to pkg/squashfs/verity_test.go diff --git a/api.go b/pkg/stacker/api.go similarity index 100% rename from api.go rename to pkg/stacker/api.go diff --git a/base.go b/pkg/stacker/base.go similarity index 97% rename from base.go rename to pkg/stacker/base.go index 8515a1cf..20c5e63b 100644 --- a/base.go +++ b/pkg/stacker/base.go @@ -11,9 +11,9 @@ import ( "github.com/opencontainers/umoci/oci/casext" "github.com/opencontainers/umoci/oci/layer" "github.com/pkg/errors" - "stackerbuild.io/stacker/lib" - "stackerbuild.io/stacker/log" - "stackerbuild.io/stacker/types" + "stackerbuild.io/stacker/pkg/lib" + "stackerbuild.io/stacker/pkg/log" + "stackerbuild.io/stacker/pkg/types" ) type BaseLayerOpts struct { diff --git a/build.go b/pkg/stacker/build.go similarity index 99% rename from build.go rename to pkg/stacker/build.go index 3fa8f9b3..3429effd 100644 --- a/build.go +++ b/pkg/stacker/build.go @@ -16,9 +16,9 @@ import ( "github.com/opencontainers/umoci/oci/casext" "github.com/pkg/errors" "gopkg.in/yaml.v2" - "stackerbuild.io/stacker/container" - "stackerbuild.io/stacker/log" - "stackerbuild.io/stacker/types" + "stackerbuild.io/stacker/pkg/container" + "stackerbuild.io/stacker/pkg/log" + "stackerbuild.io/stacker/pkg/types" ) const DefaultShell = "/bin/sh" diff --git a/cache.go b/pkg/stacker/cache.go similarity index 99% rename from cache.go rename to pkg/stacker/cache.go index e7d31233..417f4f46 100644 --- a/cache.go +++ b/pkg/stacker/cache.go @@ -17,9 +17,9 @@ import ( "github.com/opencontainers/umoci/oci/casext" "github.com/pkg/errors" "github.com/vbatts/go-mtree" - "stackerbuild.io/stacker/lib" - "stackerbuild.io/stacker/log" - "stackerbuild.io/stacker/types" + "stackerbuild.io/stacker/pkg/lib" + "stackerbuild.io/stacker/pkg/log" + "stackerbuild.io/stacker/pkg/types" ) const currentCacheVersion = 12 diff --git a/cache_test.go b/pkg/stacker/cache_test.go similarity index 98% rename from cache_test.go rename to pkg/stacker/cache_test.go index 998c403c..f5ce86d2 100644 --- a/cache_test.go +++ b/pkg/stacker/cache_test.go @@ -10,7 +10,7 @@ import ( "github.com/opencontainers/umoci" "github.com/opencontainers/umoci/oci/casext" "github.com/stretchr/testify/assert" - "stackerbuild.io/stacker/types" + "stackerbuild.io/stacker/pkg/types" ) func TestLayerHashing(t *testing.T) { diff --git a/deps.go b/pkg/stacker/deps.go similarity index 96% rename from deps.go rename to pkg/stacker/deps.go index 9b64e5ed..9d6284a6 100644 --- a/deps.go +++ b/pkg/stacker/deps.go @@ -2,8 +2,8 @@ package stacker import ( "sort" - "stackerbuild.io/stacker/lib" - "stackerbuild.io/stacker/types" + "stackerbuild.io/stacker/pkg/lib" + "stackerbuild.io/stacker/pkg/types" ) // StackerDepsDAG processes the dependencies between different stacker recipes diff --git a/git.go b/pkg/stacker/git.go similarity index 100% rename from git.go rename to pkg/stacker/git.go diff --git a/grab.go b/pkg/stacker/grab.go similarity index 94% rename from grab.go rename to pkg/stacker/grab.go index b7fc2956..dd06a1ba 100644 --- a/grab.go +++ b/pkg/stacker/grab.go @@ -7,8 +7,8 @@ import ( "path" "github.com/pkg/errors" - "stackerbuild.io/stacker/container" - "stackerbuild.io/stacker/types" + "stackerbuild.io/stacker/pkg/container" + "stackerbuild.io/stacker/pkg/types" ) func Grab(sc types.StackerConfig, storage types.Storage, name string, source string, targetDir string, diff --git a/import.go b/pkg/stacker/import.go similarity index 98% rename from import.go rename to pkg/stacker/import.go index 326fe98e..ea7ce877 100644 --- a/import.go +++ b/pkg/stacker/import.go @@ -11,9 +11,9 @@ import ( "github.com/pkg/errors" "github.com/udhos/equalfile" "github.com/vbatts/go-mtree" - "stackerbuild.io/stacker/lib" - "stackerbuild.io/stacker/log" - "stackerbuild.io/stacker/types" + "stackerbuild.io/stacker/pkg/lib" + "stackerbuild.io/stacker/pkg/log" + "stackerbuild.io/stacker/pkg/types" ) // filesDiffer returns true if the files are different, false if they are the same. diff --git a/lock.go b/pkg/stacker/lock.go similarity index 98% rename from lock.go rename to pkg/stacker/lock.go index 8d5bf365..4fd5f299 100644 --- a/lock.go +++ b/pkg/stacker/lock.go @@ -9,7 +9,7 @@ import ( "syscall" "github.com/pkg/errors" - "stackerbuild.io/stacker/types" + "stackerbuild.io/stacker/pkg/types" ) func findLock(st *syscall.Stat_t) error { diff --git a/network.go b/pkg/stacker/network.go similarity index 98% rename from network.go rename to pkg/stacker/network.go index b60a039b..878a2b56 100644 --- a/network.go +++ b/pkg/stacker/network.go @@ -12,8 +12,8 @@ import ( "github.com/cheggaaa/pb/v3" "github.com/pkg/errors" - "stackerbuild.io/stacker/lib" - "stackerbuild.io/stacker/log" + "stackerbuild.io/stacker/pkg/lib" + "stackerbuild.io/stacker/pkg/log" ) // download with caching support in the specified cache dir. diff --git a/publisher.go b/pkg/stacker/publisher.go similarity index 98% rename from publisher.go rename to pkg/stacker/publisher.go index 52dad739..856ea129 100644 --- a/publisher.go +++ b/pkg/stacker/publisher.go @@ -11,9 +11,9 @@ import ( "github.com/opencontainers/umoci" "github.com/opencontainers/umoci/oci/casext" "github.com/pkg/errors" - "stackerbuild.io/stacker/lib" - "stackerbuild.io/stacker/log" - "stackerbuild.io/stacker/types" + "stackerbuild.io/stacker/pkg/lib" + "stackerbuild.io/stacker/pkg/log" + "stackerbuild.io/stacker/pkg/types" ) type PublishArgs struct { diff --git a/storage.go b/pkg/stacker/storage.go similarity index 96% rename from storage.go rename to pkg/stacker/storage.go index 8524ba93..a047cef9 100644 --- a/storage.go +++ b/pkg/stacker/storage.go @@ -5,10 +5,10 @@ import ( "path" "github.com/pkg/errors" - "stackerbuild.io/stacker/log" - "stackerbuild.io/stacker/overlay" - "stackerbuild.io/stacker/storage" - "stackerbuild.io/stacker/types" + "stackerbuild.io/stacker/pkg/log" + "stackerbuild.io/stacker/pkg/overlay" + "stackerbuild.io/stacker/pkg/storage" + "stackerbuild.io/stacker/pkg/types" ) var storageTypeFile = "storage.type" diff --git a/storage/storage.go b/pkg/storage/storage.go similarity index 97% rename from storage/storage.go rename to pkg/storage/storage.go index 6a543ff7..d5c975bb 100644 --- a/storage/storage.go +++ b/pkg/storage/storage.go @@ -3,7 +3,7 @@ package storage import ( "github.com/pkg/errors" - "stackerbuild.io/stacker/types" + "stackerbuild.io/stacker/pkg/types" ) // FindFirstBaseInOutput finds the highest base in the dependency tree that is diff --git a/storage/unpriv-setup.go b/pkg/storage/unpriv-setup.go similarity index 98% rename from storage/unpriv-setup.go rename to pkg/storage/unpriv-setup.go index 0052dcd9..0efdde15 100644 --- a/storage/unpriv-setup.go +++ b/pkg/storage/unpriv-setup.go @@ -8,7 +8,7 @@ import ( "strings" "github.com/pkg/errors" - "stackerbuild.io/stacker/log" + "stackerbuild.io/stacker/pkg/log" ) func warnAboutNewuidmap() { diff --git a/types/config.go b/pkg/types/config.go similarity index 100% rename from types/config.go rename to pkg/types/config.go diff --git a/types/imagesource.go b/pkg/types/imagesource.go similarity index 100% rename from types/imagesource.go rename to pkg/types/imagesource.go diff --git a/types/layer.go b/pkg/types/layer.go similarity index 100% rename from types/layer.go rename to pkg/types/layer.go diff --git a/types/layer_type.go b/pkg/types/layer_type.go similarity index 98% rename from types/layer_type.go rename to pkg/types/layer_type.go index 7f819932..6d1a1353 100644 --- a/types/layer_type.go +++ b/pkg/types/layer_type.go @@ -7,7 +7,7 @@ import ( ispec "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" - "stackerbuild.io/stacker/squashfs" + "stackerbuild.io/stacker/pkg/squashfs" ) type LayerType struct { diff --git a/types/stackerfile.go b/pkg/types/stackerfile.go similarity index 99% rename from types/stackerfile.go rename to pkg/types/stackerfile.go index e82386b1..7f703fe2 100644 --- a/types/stackerfile.go +++ b/pkg/types/stackerfile.go @@ -12,7 +12,7 @@ import ( "github.com/pkg/errors" "gopkg.in/yaml.v2" - "stackerbuild.io/stacker/log" + "stackerbuild.io/stacker/pkg/log" ) type BuildConfig struct { diff --git a/types/stackerfiles.go b/pkg/types/stackerfiles.go similarity index 98% rename from types/stackerfiles.go rename to pkg/types/stackerfiles.go index d9acaf88..c7055752 100644 --- a/types/stackerfiles.go +++ b/pkg/types/stackerfiles.go @@ -4,7 +4,7 @@ import ( "path/filepath" "github.com/pkg/errors" - "stackerbuild.io/stacker/log" + "stackerbuild.io/stacker/pkg/log" ) // Logic for working with multiple StackerFiles diff --git a/types/storage.go b/pkg/types/storage.go similarity index 100% rename from types/storage.go rename to pkg/types/storage.go diff --git a/types/types_test.go b/pkg/types/types_test.go similarity index 100% rename from types/types_test.go rename to pkg/types/types_test.go diff --git a/test/static-analysis.sh b/test/static-analysis.sh index 8722973a..bbf9d299 100644 --- a/test/static-analysis.sh +++ b/test/static-analysis.sh @@ -3,7 +3,7 @@ # allow fmt.Print in inspect.go, since it is supposed to print output to # stdout. disallow it everywhere else, since this stuff often sneaks into # commits as debug statements (and we should be using log anyway). -[ "$(git grep "fmt.Print" | grep -c -v -e "cmd/inspect.go" -e "test/static-analysis.sh")" -gt 0 ] && { +[ "$(git grep "fmt.Print" | grep -c -v -e "cmd/stacker/inspect.go" -e "test/static-analysis.sh")" -gt 0 ] && { RED='\033[0;31m' NC='\033[0m' printf "${RED}using fmt.Print* directive outside of inspect${NC}\n"