Переглянути джерело

builder/dockerfile: make containsWildcards() platform-specific again

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn 4 роки тому
батько
коміт
337500f374

+ 0 - 13
builder/dockerfile/copy.go

@@ -251,19 +251,6 @@ func (o *copier) calcCopyInfo(origPath string, allowWildcards bool) ([]copyInfo,
 	return newCopyInfos(newCopyInfoFromSource(o.source, origPath, hash)), nil
 }
 
-func containsWildcards(name string) bool {
-	isWindows := runtime.GOOS == "windows"
-	for i := 0; i < len(name); i++ {
-		ch := name[i]
-		if ch == '\\' && !isWindows {
-			i++
-		} else if ch == '*' || ch == '?' || ch == '[' {
-			return true
-		}
-	}
-	return false
-}
-
 func (o *copier) storeInPathCache(im *imageMount, path string, hash string) {
 	if im != nil {
 		o.pathCache.Store(im.ImageID()+path, hash)

+ 12 - 0
builder/dockerfile/copy_unix.go

@@ -43,6 +43,18 @@ func fixPermissions(source, destination string, identity idtools.Identity, overr
 	})
 }
 
+func containsWildcards(name string) bool {
+	for i := 0; i < len(name); i++ {
+		ch := name[i]
+		if ch == '\\' {
+			i++
+		} else if ch == '*' || ch == '?' || ch == '[' {
+			return true
+		}
+	}
+	return false
+}
+
 func validateCopySourcePath(imageSource *imageMount, origPath string) error {
 	return nil
 }

+ 10 - 0
builder/dockerfile/copy_windows.go

@@ -79,6 +79,16 @@ func fixPermissionsWindows(source, destination, SID string) error {
 	return windows.SetNamedSecurityInfo(destination, windows.SE_FILE_OBJECT, windows.OWNER_SECURITY_INFORMATION|windows.DACL_SECURITY_INFORMATION, sid, nil, dacl, nil)
 }
 
+func containsWildcards(name string) bool {
+	for i := 0; i < len(name); i++ {
+		ch := name[i]
+		if ch == '*' || ch == '?' || ch == '[' {
+			return true
+		}
+	}
+	return false
+}
+
 func validateCopySourcePath(imageSource *imageMount, origPath string) error {
 	if imageSource == nil {
 		return nil