Просмотр исходного кода

Merge pull request #8906 from dqminh/remove-copy-directory

change util.CopyDirectory to archive.CopyWithTar
Arnaud Porterie 10 лет назад
Родитель
Сommit
edae8830a9
1 измененных файлов с 2 добавлено и 9 удалено
  1. 2 9
      utils/utils.go

+ 2 - 9
utils/utils.go

@@ -22,6 +22,7 @@ import (
 
 
 	log "github.com/Sirupsen/logrus"
 	log "github.com/Sirupsen/logrus"
 	"github.com/docker/docker/dockerversion"
 	"github.com/docker/docker/dockerversion"
+	"github.com/docker/docker/pkg/archive"
 	"github.com/docker/docker/pkg/fileutils"
 	"github.com/docker/docker/pkg/fileutils"
 	"github.com/docker/docker/pkg/ioutils"
 	"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
 	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 {
 type WriteFlusher struct {
 	sync.Mutex
 	sync.Mutex
 	w       io.Writer
 	w       io.Writer
@@ -381,7 +374,7 @@ func TestDirectory(templateDir string) (dir string, err error) {
 		return
 		return
 	}
 	}
 	if templateDir != "" {
 	if templateDir != "" {
-		if err = CopyDirectory(templateDir, dir); err != nil {
+		if err = archive.CopyWithTar(templateDir, dir); err != nil {
 			return
 			return
 		}
 		}
 	}
 	}