mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
builder/dockerfile: make containsWildcards() platform-specific again
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
131fac6eb4
commit
337500f374
3 changed files with 22 additions and 13 deletions
|
@ -251,19 +251,6 @@ func (o *copier) calcCopyInfo(origPath string, allowWildcards bool) ([]copyInfo,
|
||||||
return newCopyInfos(newCopyInfoFromSource(o.source, origPath, hash)), nil
|
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) {
|
func (o *copier) storeInPathCache(im *imageMount, path string, hash string) {
|
||||||
if im != nil {
|
if im != nil {
|
||||||
o.pathCache.Store(im.ImageID()+path, hash)
|
o.pathCache.Store(im.ImageID()+path, hash)
|
||||||
|
|
|
@ -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 {
|
func validateCopySourcePath(imageSource *imageMount, origPath string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)
|
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 {
|
func validateCopySourcePath(imageSource *imageMount, origPath string) error {
|
||||||
if imageSource == nil {
|
if imageSource == nil {
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Add table
Reference in a new issue