From 30d5a42c1f24e26f681b7330249f04fec891aee9 Mon Sep 17 00:00:00 2001 From: Rafe Colton Date: Mon, 29 Sep 2014 23:23:36 -0700 Subject: [PATCH] Move archive package into pkg/archive Now that the archive package does not depend on any docker-specific packages, only those in pkg and vendor, it can be safely moved into pkg. Signed-off-by: Rafe Colton --- api/client/commands.go | 2 +- archive/README.md | 3 --- builder/internals.go | 2 +- builder/job.go | 2 +- daemon/container.go | 2 +- daemon/daemon.go | 2 +- daemon/graphdriver/aufs/aufs.go | 2 +- daemon/graphdriver/aufs/aufs_test.go | 2 +- daemon/graphdriver/driver.go | 2 +- daemon/graphdriver/fsdiff.go | 2 +- daemon/volumes.go | 2 +- graph/export.go | 2 +- graph/graph.go | 2 +- graph/import.go | 2 +- graph/load.go | 2 +- graph/push.go | 2 +- image/image.go | 2 +- integration-cli/docker_cli_build_test.go | 2 +- integration/graph_test.go | 2 +- {archive => pkg/archive}/MAINTAINERS | 0 pkg/archive/README.md | 1 + {archive => pkg/archive}/archive.go | 7 ++++--- {archive => pkg/archive}/archive_test.go | 0 {archive => pkg/archive}/changes.go | 0 {archive => pkg/archive}/changes_test.go | 0 {archive => pkg/archive}/diff.go | 0 {archive => pkg/archive}/testdata/broken.tar | Bin {archive => pkg/archive}/time_linux.go | 0 {archive => pkg/archive}/time_unsupported.go | 0 {archive => pkg/archive}/wrap.go | 0 30 files changed, 23 insertions(+), 24 deletions(-) delete mode 100644 archive/README.md rename {archive => pkg/archive}/MAINTAINERS (100%) create mode 100644 pkg/archive/README.md rename {archive => pkg/archive}/archive.go (98%) rename {archive => pkg/archive}/archive_test.go (100%) rename {archive => pkg/archive}/changes.go (100%) rename {archive => pkg/archive}/changes_test.go (100%) rename {archive => pkg/archive}/diff.go (100%) rename {archive => pkg/archive}/testdata/broken.tar (100%) rename {archive => pkg/archive}/time_linux.go (100%) rename {archive => pkg/archive}/time_unsupported.go (100%) rename {archive => pkg/archive}/wrap.go (100%) diff --git a/api/client/commands.go b/api/client/commands.go index 901e992a8c..2694bd919c 100644 --- a/api/client/commands.go +++ b/api/client/commands.go @@ -23,12 +23,12 @@ import ( "time" "github.com/docker/docker/api" - "github.com/docker/docker/archive" "github.com/docker/docker/dockerversion" "github.com/docker/docker/engine" "github.com/docker/docker/graph" "github.com/docker/docker/nat" "github.com/docker/docker/opts" + "github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/log" flag "github.com/docker/docker/pkg/mflag" "github.com/docker/docker/pkg/parsers" diff --git a/archive/README.md b/archive/README.md deleted file mode 100644 index 4eb0c04181..0000000000 --- a/archive/README.md +++ /dev/null @@ -1,3 +0,0 @@ -This code provides helper functions for dealing with archive files. - -**TODO**: Move this to either `pkg` or (if not possible) to `utils`. diff --git a/builder/internals.go b/builder/internals.go index 1d05b60ee6..9f49ccf9ee 100644 --- a/builder/internals.go +++ b/builder/internals.go @@ -18,9 +18,9 @@ import ( "syscall" "time" - "github.com/docker/docker/archive" "github.com/docker/docker/daemon" imagepkg "github.com/docker/docker/image" + "github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/log" "github.com/docker/docker/pkg/parsers" "github.com/docker/docker/pkg/promise" diff --git a/builder/job.go b/builder/job.go index 1aa2c3b6b9..1558fa3dab 100644 --- a/builder/job.go +++ b/builder/job.go @@ -7,9 +7,9 @@ import ( "os/exec" "strings" - "github.com/docker/docker/archive" "github.com/docker/docker/daemon" "github.com/docker/docker/engine" + "github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/parsers" "github.com/docker/docker/registry" "github.com/docker/docker/utils" diff --git a/daemon/container.go b/daemon/container.go index c39428c266..e0c44e043f 100644 --- a/daemon/container.go +++ b/daemon/container.go @@ -16,12 +16,12 @@ import ( "github.com/docker/libcontainer/devices" "github.com/docker/libcontainer/label" - "github.com/docker/docker/archive" "github.com/docker/docker/daemon/execdriver" "github.com/docker/docker/engine" "github.com/docker/docker/image" "github.com/docker/docker/links" "github.com/docker/docker/nat" + "github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/broadcastwriter" "github.com/docker/docker/pkg/ioutils" "github.com/docker/docker/pkg/log" diff --git a/daemon/daemon.go b/daemon/daemon.go index 8f8cff7282..f04820efd9 100644 --- a/daemon/daemon.go +++ b/daemon/daemon.go @@ -15,7 +15,6 @@ import ( "github.com/docker/libcontainer/label" - "github.com/docker/docker/archive" "github.com/docker/docker/daemon/execdriver" "github.com/docker/docker/daemon/execdriver/execdrivers" "github.com/docker/docker/daemon/execdriver/lxc" @@ -27,6 +26,7 @@ import ( "github.com/docker/docker/engine" "github.com/docker/docker/graph" "github.com/docker/docker/image" + "github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/broadcastwriter" "github.com/docker/docker/pkg/graphdb" "github.com/docker/docker/pkg/ioutils" diff --git a/daemon/graphdriver/aufs/aufs.go b/daemon/graphdriver/aufs/aufs.go index 8dc0f0de1b..8e3ae0b181 100644 --- a/daemon/graphdriver/aufs/aufs.go +++ b/daemon/graphdriver/aufs/aufs.go @@ -30,8 +30,8 @@ import ( "sync" "syscall" - "github.com/docker/docker/archive" "github.com/docker/docker/daemon/graphdriver" + "github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/log" mountpk "github.com/docker/docker/pkg/mount" "github.com/docker/docker/utils" diff --git a/daemon/graphdriver/aufs/aufs_test.go b/daemon/graphdriver/aufs/aufs_test.go index a5ea8579e5..cc5b3a2030 100644 --- a/daemon/graphdriver/aufs/aufs_test.go +++ b/daemon/graphdriver/aufs/aufs_test.go @@ -4,8 +4,8 @@ import ( "crypto/sha256" "encoding/hex" "fmt" - "github.com/docker/docker/archive" "github.com/docker/docker/daemon/graphdriver" + "github.com/docker/docker/pkg/archive" "io/ioutil" "os" "path" diff --git a/daemon/graphdriver/driver.go b/daemon/graphdriver/driver.go index 677a1d7e18..91040db97a 100644 --- a/daemon/graphdriver/driver.go +++ b/daemon/graphdriver/driver.go @@ -6,7 +6,7 @@ import ( "os" "path" - "github.com/docker/docker/archive" + "github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/mount" ) diff --git a/daemon/graphdriver/fsdiff.go b/daemon/graphdriver/fsdiff.go index d9d4434aec..5e9d32c1c8 100644 --- a/daemon/graphdriver/fsdiff.go +++ b/daemon/graphdriver/fsdiff.go @@ -4,7 +4,7 @@ import ( "fmt" "time" - "github.com/docker/docker/archive" + "github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/ioutils" "github.com/docker/docker/pkg/log" "github.com/docker/docker/utils" diff --git a/daemon/volumes.go b/daemon/volumes.go index 4f83f6c513..1ee2df4cef 100644 --- a/daemon/volumes.go +++ b/daemon/volumes.go @@ -9,8 +9,8 @@ import ( "strings" "syscall" - "github.com/docker/docker/archive" "github.com/docker/docker/daemon/execdriver" + "github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/log" "github.com/docker/docker/pkg/symlink" "github.com/docker/docker/volumes" diff --git a/graph/export.go b/graph/export.go index 3f095e796c..86dc5a342a 100644 --- a/graph/export.go +++ b/graph/export.go @@ -7,8 +7,8 @@ import ( "os" "path" - "github.com/docker/docker/archive" "github.com/docker/docker/engine" + "github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/log" "github.com/docker/docker/pkg/parsers" ) diff --git a/graph/graph.go b/graph/graph.go index f5e1bdbbcd..00c0324ea8 100644 --- a/graph/graph.go +++ b/graph/graph.go @@ -12,10 +12,10 @@ import ( "syscall" "time" - "github.com/docker/docker/archive" "github.com/docker/docker/daemon/graphdriver" "github.com/docker/docker/dockerversion" "github.com/docker/docker/image" + "github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/log" "github.com/docker/docker/pkg/truncindex" "github.com/docker/docker/runconfig" diff --git a/graph/import.go b/graph/import.go index 049742af45..36d0d3fe10 100644 --- a/graph/import.go +++ b/graph/import.go @@ -4,8 +4,8 @@ import ( "net/http" "net/url" - "github.com/docker/docker/archive" "github.com/docker/docker/engine" + "github.com/docker/docker/pkg/archive" "github.com/docker/docker/utils" ) diff --git a/graph/load.go b/graph/load.go index b7fb62ba98..753f31d2c9 100644 --- a/graph/load.go +++ b/graph/load.go @@ -7,9 +7,9 @@ import ( "os" "path" - "github.com/docker/docker/archive" "github.com/docker/docker/engine" "github.com/docker/docker/image" + "github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/log" ) diff --git a/graph/push.go b/graph/push.go index 47cd4342c5..657e147d10 100644 --- a/graph/push.go +++ b/graph/push.go @@ -7,8 +7,8 @@ import ( "os" "path" - "github.com/docker/docker/archive" "github.com/docker/docker/engine" + "github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/log" "github.com/docker/docker/registry" "github.com/docker/docker/utils" diff --git a/image/image.go b/image/image.go index 9e58cfe724..fabd897d29 100644 --- a/image/image.go +++ b/image/image.go @@ -9,7 +9,7 @@ import ( "strconv" "time" - "github.com/docker/docker/archive" + "github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/log" "github.com/docker/docker/runconfig" "github.com/docker/docker/utils" diff --git a/integration-cli/docker_cli_build_test.go b/integration-cli/docker_cli_build_test.go index 46c52c64c9..26df48fb46 100644 --- a/integration-cli/docker_cli_build_test.go +++ b/integration-cli/docker_cli_build_test.go @@ -11,7 +11,7 @@ import ( "testing" "time" - "github.com/docker/docker/archive" + "github.com/docker/docker/pkg/archive" ) func TestBuildCacheADD(t *testing.T) { diff --git a/integration/graph_test.go b/integration/graph_test.go index 4b59a5dbf9..203476cbb2 100644 --- a/integration/graph_test.go +++ b/integration/graph_test.go @@ -2,11 +2,11 @@ package docker import ( "errors" - "github.com/docker/docker/archive" "github.com/docker/docker/daemon/graphdriver" "github.com/docker/docker/dockerversion" "github.com/docker/docker/graph" "github.com/docker/docker/image" + "github.com/docker/docker/pkg/archive" "github.com/docker/docker/utils" "io" "io/ioutil" diff --git a/archive/MAINTAINERS b/pkg/archive/MAINTAINERS similarity index 100% rename from archive/MAINTAINERS rename to pkg/archive/MAINTAINERS diff --git a/pkg/archive/README.md b/pkg/archive/README.md new file mode 100644 index 0000000000..7307d9694f --- /dev/null +++ b/pkg/archive/README.md @@ -0,0 +1 @@ +This code provides helper functions for dealing with archive files. diff --git a/archive/archive.go b/pkg/archive/archive.go similarity index 98% rename from archive/archive.go rename to pkg/archive/archive.go index 59163f84af..7d9103e103 100644 --- a/archive/archive.go +++ b/pkg/archive/archive.go @@ -18,10 +18,11 @@ import ( "github.com/docker/docker/vendor/src/code.google.com/p/go/src/pkg/archive/tar" + "github.com/docker/docker/pkg/fileutils" "github.com/docker/docker/pkg/log" "github.com/docker/docker/pkg/pools" + "github.com/docker/docker/pkg/promise" "github.com/docker/docker/pkg/system" - "github.com/docker/docker/utils" ) type ( @@ -370,7 +371,7 @@ func TarWithOptions(srcPath string, options *TarOptions) (io.ReadCloser, error) return nil } - skip, err := utils.Matches(relFilePath, options.Excludes) + skip, err := fileutils.Matches(relFilePath, options.Excludes) if err != nil { log.Debugf("Error matching %s", relFilePath, err) return err @@ -581,7 +582,7 @@ func CopyFileWithTar(src, dst string) (err error) { } r, w := io.Pipe() - errC := utils.Go(func() error { + errC := promise.Go(func() error { defer w.Close() srcF, err := os.Open(src) diff --git a/archive/archive_test.go b/pkg/archive/archive_test.go similarity index 100% rename from archive/archive_test.go rename to pkg/archive/archive_test.go diff --git a/archive/changes.go b/pkg/archive/changes.go similarity index 100% rename from archive/changes.go rename to pkg/archive/changes.go diff --git a/archive/changes_test.go b/pkg/archive/changes_test.go similarity index 100% rename from archive/changes_test.go rename to pkg/archive/changes_test.go diff --git a/archive/diff.go b/pkg/archive/diff.go similarity index 100% rename from archive/diff.go rename to pkg/archive/diff.go diff --git a/archive/testdata/broken.tar b/pkg/archive/testdata/broken.tar similarity index 100% rename from archive/testdata/broken.tar rename to pkg/archive/testdata/broken.tar diff --git a/archive/time_linux.go b/pkg/archive/time_linux.go similarity index 100% rename from archive/time_linux.go rename to pkg/archive/time_linux.go diff --git a/archive/time_unsupported.go b/pkg/archive/time_unsupported.go similarity index 100% rename from archive/time_unsupported.go rename to pkg/archive/time_unsupported.go diff --git a/archive/wrap.go b/pkg/archive/wrap.go similarity index 100% rename from archive/wrap.go rename to pkg/archive/wrap.go