change util.CopyDirectory to archive.CopyWithTar

Docker-DCO-1.1-Signed-off-by: Daniel, Dao Quang Minh <dqminh89@gmail.com> (github: dqminh)
This commit is contained in:
Daniel, Dao Quang Minh 2014-11-01 12:23:08 -04:00
parent 4d4a7b81bf
commit e5ecfd3b17

View file

@ -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
}
}