build: fix add from remote url

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 2981667e11e24e9e1e61252a40ceb11fd7cb9811
Component: engine
This commit is contained in:
Tonis Tiigi
2017-06-27 10:38:01 -07:00
parent e2c85453e0
commit 4c52cfc0fb
2 changed files with 52 additions and 5 deletions
+8 -5
View File
@@ -32,9 +32,10 @@ type pathCache interface {
// copyInfo is a data object which stores the metadata about each source file in
// a copyInstruction
type copyInfo struct {
root string
path string
hash string
root string
path string
hash string
noDecompress bool
}
func (c copyInfo) fullPath() (string, error) {
@@ -124,7 +125,9 @@ func (o *copier) getCopyInfoForSourcePath(orig string) ([]copyInfo, error) {
o.tmpPaths = append(o.tmpPaths, remote.Root())
hash, err := remote.Hash(path)
return newCopyInfos(newCopyInfoFromSource(remote, path, hash)), err
ci := newCopyInfoFromSource(remote, path, hash)
ci.noDecompress = true // data from http shouldn't be extracted even on ADD
return newCopyInfos(ci), err
}
// Cleanup removes any temporary directories created as part of downloading
@@ -387,7 +390,7 @@ func performCopyForInfo(dest copyInfo, source copyInfo, options copyFileOptions)
if src.IsDir() {
return copyDirectory(archiver, srcPath, destPath)
}
if options.decompress && archive.IsArchivePath(srcPath) {
if options.decompress && archive.IsArchivePath(srcPath) && !source.noDecompress {
return archiver.UntarPath(srcPath, destPath)
}