Browse code

change util.CopyDirectory to archive.CopyWithTar

Docker-DCO-1.1-Signed-off-by: Daniel, Dao Quang Minh <dqminh89@gmail.com> (github: dqminh)

Daniel, Dao Quang Minh authored on 2014/11/02 01:23:08
Showing 1 changed files
... ...
@@ -22,6 +22,7 @@ import (
22 22
 
23 23
 	log "github.com/Sirupsen/logrus"
24 24
 	"github.com/docker/docker/dockerversion"
25
+	"github.com/docker/docker/pkg/archive"
25 26
 	"github.com/docker/docker/pkg/fileutils"
26 27
 	"github.com/docker/docker/pkg/ioutils"
27 28
 )
... ...
@@ -250,14 +251,6 @@ func HashData(src io.Reader) (string, error) {
250 250
 	return "sha256:" + hex.EncodeToString(h.Sum(nil)), nil
251 251
 }
252 252
 
253
-// FIXME: this is deprecated by CopyWithTar in archive.go
254
-func CopyDirectory(source, dest string) error {
255
-	if output, err := exec.Command("cp", "-ra", source, dest).CombinedOutput(); err != nil {
256
-		return fmt.Errorf("Error copy: %s (%s)", err, output)
257
-	}
258
-	return nil
259
-}
260
-
261 253
 type WriteFlusher struct {
262 254
 	sync.Mutex
263 255
 	w       io.Writer
... ...
@@ -381,7 +374,7 @@ func TestDirectory(templateDir string) (dir string, err error) {
381 381
 		return
382 382
 	}
383 383
 	if templateDir != "" {
384
-		if err = CopyDirectory(templateDir, dir); err != nil {
384
+		if err = archive.CopyWithTar(templateDir, dir); err != nil {
385 385
 			return
386 386
 		}
387 387
 	}