From eaa70c2db57011782c22bcbd769b33c514122d8c Mon Sep 17 00:00:00 2001 From: "Daniel, Dao Quang Minh" Date: Sat, 1 Nov 2014 12:23:08 -0400 Subject: [PATCH] change util.CopyDirectory to archive.CopyWithTar Docker-DCO-1.1-Signed-off-by: Daniel, Dao Quang Minh (github: dqminh) Upstream-commit: e5ecfd3b178bbc399de344635606d82e147276ff Component: engine --- components/engine/utils/utils.go | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/components/engine/utils/utils.go b/components/engine/utils/utils.go index ef587bb77c..e2254b8bab 100644 --- a/components/engine/utils/utils.go +++ b/components/engine/utils/utils.go @@ -22,6 +22,7 @@ import ( log "github.com/Sirupsen/logrus" "github.com/docker/docker/dockerversion" + "github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/fileutils" "github.com/docker/docker/pkg/ioutils" ) @@ -250,14 +251,6 @@ func HashData(src io.Reader) (string, error) { return "sha256:" + hex.EncodeToString(h.Sum(nil)), nil } -// FIXME: this is deprecated by CopyWithTar in archive.go -func CopyDirectory(source, dest string) error { - if output, err := exec.Command("cp", "-ra", source, dest).CombinedOutput(); err != nil { - return fmt.Errorf("Error copy: %s (%s)", err, output) - } - return nil -} - type WriteFlusher struct { sync.Mutex w io.Writer @@ -381,7 +374,7 @@ func TestDirectory(templateDir string) (dir string, err error) { return } if templateDir != "" { - if err = CopyDirectory(templateDir, dir); err != nil { + if err = archive.CopyWithTar(templateDir, dir); err != nil { return } }