mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-25 20:58:03 +08:00
vendor: github.com/moby/buildkit v0.21.0-rc1
Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
This commit is contained in:
4
vendor/github.com/tonistiigi/dchapes-mode/mode.go
generated
vendored
4
vendor/github.com/tonistiigi/dchapes-mode/mode.go
generated
vendored
@@ -262,8 +262,10 @@ func ParseWithUmask(s string, umask uint) (Set, error) {
|
||||
case 'w':
|
||||
perm |= iWUser | iWGroup | iWOther
|
||||
case 'X':
|
||||
if op == '+' {
|
||||
if op != '-' {
|
||||
permX = iXUser | iXGroup | iXOther
|
||||
} else {
|
||||
perm |= iXUser | iXGroup | iXOther
|
||||
}
|
||||
case 'x':
|
||||
perm |= iXUser | iXGroup | iXOther
|
||||
|
36
vendor/github.com/tonistiigi/fsutil/copy/copy.go
generated
vendored
36
vendor/github.com/tonistiigi/fsutil/copy/copy.go
generated
vendored
@@ -18,6 +18,8 @@ import (
|
||||
"github.com/tonistiigi/fsutil"
|
||||
)
|
||||
|
||||
const defaultDirectoryMode = 0755
|
||||
|
||||
var bufferPool = &sync.Pool{
|
||||
New: func() interface{} {
|
||||
buffer := make([]byte, 32*1024)
|
||||
@@ -80,7 +82,11 @@ func Copy(ctx context.Context, srcRoot, src, dstRoot, dst string, opts ...Opt) e
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if createdDirs, err := MkdirAll(ensureDstPath, 0755, ci.Chown, ci.Utime); err != nil {
|
||||
perm := defaultDirectoryMode
|
||||
if ci.Mode != nil {
|
||||
perm = *ci.Mode
|
||||
}
|
||||
if createdDirs, err := MkdirAll(ensureDstPath, os.FileMode(perm), ci.Chown, ci.Utime); err != nil {
|
||||
return err
|
||||
} else {
|
||||
defer fixCreatedParentDirs(createdDirs, ci.Utime)
|
||||
@@ -159,7 +165,11 @@ func (c *copier) prepareTargetDir(srcFollowed, src, destPath string, copyDirCont
|
||||
target = destPath
|
||||
}
|
||||
var createdDirs []string
|
||||
if dirs, err := MkdirAll(target, 0755, c.chown, c.utime); err != nil {
|
||||
mode := defaultDirectoryMode
|
||||
if c.mode != nil {
|
||||
mode = *c.mode
|
||||
}
|
||||
if dirs, err := MkdirAll(target, os.FileMode(mode), c.chown, c.utime); err != nil {
|
||||
return "", nil, err
|
||||
} else {
|
||||
createdDirs = dirs
|
||||
@@ -335,13 +345,13 @@ func (c *copier) copy(ctx context.Context, src, srcComponents, target string, ov
|
||||
if srcComponents != "" {
|
||||
matchesIncludePattern := false
|
||||
matchesExcludePattern := false
|
||||
matchesIncludePattern, includeMatchInfo, err = c.include(srcComponents, fi, parentIncludeMatchInfo)
|
||||
matchesIncludePattern, includeMatchInfo, err = c.include(srcComponents, parentIncludeMatchInfo)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
include = matchesIncludePattern
|
||||
|
||||
matchesExcludePattern, excludeMatchInfo, err = c.exclude(srcComponents, fi, parentExcludeMatchInfo)
|
||||
matchesExcludePattern, excludeMatchInfo, err = c.exclude(srcComponents, parentExcludeMatchInfo)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -351,11 +361,11 @@ func (c *copier) copy(ctx context.Context, src, srcComponents, target string, ov
|
||||
}
|
||||
|
||||
if include {
|
||||
if err := c.removeTargetIfNeeded(src, target, fi, targetFi); err != nil {
|
||||
if err := c.removeTargetIfNeeded(target, fi, targetFi); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := c.createParentDirs(src, srcComponents, target, overwriteTargetMetadata); err != nil {
|
||||
if err := c.createParentDirs(src, overwriteTargetMetadata); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@@ -447,7 +457,7 @@ func (c *copier) notifyChange(target string, fi os.FileInfo) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *copier) include(path string, fi os.FileInfo, parentIncludeMatchInfo patternmatcher.MatchInfo) (bool, patternmatcher.MatchInfo, error) {
|
||||
func (c *copier) include(path string, parentIncludeMatchInfo patternmatcher.MatchInfo) (bool, patternmatcher.MatchInfo, error) {
|
||||
if c.includePatternMatcher == nil {
|
||||
return true, patternmatcher.MatchInfo{}, nil
|
||||
}
|
||||
@@ -459,7 +469,7 @@ func (c *copier) include(path string, fi os.FileInfo, parentIncludeMatchInfo pat
|
||||
return m, matchInfo, nil
|
||||
}
|
||||
|
||||
func (c *copier) exclude(path string, fi os.FileInfo, parentExcludeMatchInfo patternmatcher.MatchInfo) (bool, patternmatcher.MatchInfo, error) {
|
||||
func (c *copier) exclude(path string, parentExcludeMatchInfo patternmatcher.MatchInfo) (bool, patternmatcher.MatchInfo, error) {
|
||||
if c.excludePatternMatcher == nil {
|
||||
return false, patternmatcher.MatchInfo{}, nil
|
||||
}
|
||||
@@ -471,7 +481,7 @@ func (c *copier) exclude(path string, fi os.FileInfo, parentExcludeMatchInfo pat
|
||||
return m, matchInfo, nil
|
||||
}
|
||||
|
||||
func (c *copier) removeTargetIfNeeded(src, target string, srcFi, targetFi os.FileInfo) error {
|
||||
func (c *copier) removeTargetIfNeeded(target string, srcFi, targetFi os.FileInfo) error {
|
||||
if !c.alwaysReplaceExistingDestPaths {
|
||||
return nil
|
||||
}
|
||||
@@ -488,7 +498,7 @@ func (c *copier) removeTargetIfNeeded(src, target string, srcFi, targetFi os.Fil
|
||||
|
||||
// Delayed creation of parent directories when a file or dir matches an include
|
||||
// pattern.
|
||||
func (c *copier) createParentDirs(src, srcComponents, target string, overwriteTargetMetadata bool) error {
|
||||
func (c *copier) createParentDirs(src string, overwriteTargetMetadata bool) error {
|
||||
for i, parentDir := range c.parentDirs {
|
||||
if parentDir.copied {
|
||||
continue
|
||||
@@ -502,7 +512,7 @@ func (c *copier) createParentDirs(src, srcComponents, target string, overwriteTa
|
||||
return errors.Errorf("%s is not a directory", parentDir.srcPath)
|
||||
}
|
||||
|
||||
created, err := copyDirectoryOnly(parentDir.srcPath, parentDir.dstPath, fi, overwriteTargetMetadata)
|
||||
created, err := copyDirectoryOnly(parentDir.dstPath, fi, overwriteTargetMetadata)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -549,7 +559,7 @@ func (c *copier) copyDirectory(
|
||||
// encounter a/b/c.
|
||||
if include {
|
||||
var err error
|
||||
created, err = copyDirectoryOnly(src, dst, stat, overwriteTargetMetadata)
|
||||
created, err = copyDirectoryOnly(dst, stat, overwriteTargetMetadata)
|
||||
if err != nil {
|
||||
return created, err
|
||||
}
|
||||
@@ -586,7 +596,7 @@ func (c *copier) copyDirectory(
|
||||
return created, nil
|
||||
}
|
||||
|
||||
func copyDirectoryOnly(src, dst string, stat os.FileInfo, overwriteTargetMetadata bool) (bool, error) {
|
||||
func copyDirectoryOnly(dst string, stat os.FileInfo, overwriteTargetMetadata bool) (bool, error) {
|
||||
if st, err := os.Lstat(dst); err != nil {
|
||||
if !os.IsNotExist(err) {
|
||||
return false, err
|
||||
|
2
vendor/github.com/tonistiigi/fsutil/copy/copy_linux.go
generated
vendored
2
vendor/github.com/tonistiigi/fsutil/copy/copy_linux.go
generated
vendored
@@ -15,7 +15,7 @@ func getUIDGID(fi os.FileInfo) (uid, gid int) {
|
||||
return int(st.Uid), int(st.Gid)
|
||||
}
|
||||
|
||||
func (c *copier) copyFileInfo(fi os.FileInfo, src, name string) error {
|
||||
func (c *copier) copyFileInfo(fi os.FileInfo, _, name string) error {
|
||||
chown := c.chown
|
||||
uid, gid := getUIDGID(fi)
|
||||
old := &User{UID: uid, GID: gid}
|
||||
|
2
vendor/github.com/tonistiigi/fsutil/copy/copy_unix.go
generated
vendored
2
vendor/github.com/tonistiigi/fsutil/copy/copy_unix.go
generated
vendored
@@ -16,7 +16,7 @@ func getUIDGID(fi os.FileInfo) (uid, gid int) {
|
||||
return int(st.Uid), int(st.Gid)
|
||||
}
|
||||
|
||||
func (c *copier) copyFileInfo(fi os.FileInfo, src, name string) error {
|
||||
func (c *copier) copyFileInfo(fi os.FileInfo, _, name string) error {
|
||||
chown := c.chown
|
||||
uid, gid := getUIDGID(fi)
|
||||
old := &User{UID: uid, GID: gid}
|
||||
|
6
vendor/github.com/tonistiigi/fsutil/copy/copy_windows.go
generated
vendored
6
vendor/github.com/tonistiigi/fsutil/copy/copy_windows.go
generated
vendored
@@ -13,7 +13,7 @@ const (
|
||||
seTakeOwnershipPrivilege = "SeTakeOwnershipPrivilege"
|
||||
)
|
||||
|
||||
func getUIDGID(fi os.FileInfo) (uid, gid int) {
|
||||
func getUIDGID(_ os.FileInfo) (uid, gid int) {
|
||||
return 0, 0
|
||||
}
|
||||
|
||||
@@ -119,10 +119,10 @@ func copyFileContent(dst, src *os.File) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func copyXAttrs(dst, src string, xeh XAttrErrorHandler) error {
|
||||
func copyXAttrs(_, _ string, _ XAttrErrorHandler) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func copyDevice(dst string, fi os.FileInfo) error {
|
||||
func copyDevice(_ string, _ os.FileInfo) error {
|
||||
return errors.New("device copy not supported")
|
||||
}
|
||||
|
2
vendor/github.com/tonistiigi/fsutil/copy/hardlink_windows.go
generated
vendored
2
vendor/github.com/tonistiigi/fsutil/copy/hardlink_windows.go
generated
vendored
@@ -2,6 +2,6 @@ package fs
|
||||
|
||||
import "os"
|
||||
|
||||
func getLinkInfo(fi os.FileInfo) (uint64, bool) {
|
||||
func getLinkInfo(_ os.FileInfo) (uint64, bool) {
|
||||
return 0, false
|
||||
}
|
||||
|
2
vendor/github.com/tonistiigi/fsutil/diskwriter_windows.go
generated
vendored
2
vendor/github.com/tonistiigi/fsutil/diskwriter_windows.go
generated
vendored
@@ -20,7 +20,7 @@ func rewriteMetadata(p string, stat *types.Stat) error {
|
||||
|
||||
// handleTarTypeBlockCharFifo is an OS-specific helper function used by
|
||||
// createTarFile to handle the following types of header: Block; Char; Fifo
|
||||
func handleTarTypeBlockCharFifo(path string, stat *types.Stat) error {
|
||||
func handleTarTypeBlockCharFifo(_ string, _ *types.Stat) error {
|
||||
return errors.New("Not implemented on windows")
|
||||
}
|
||||
|
||||
|
23
vendor/github.com/tonistiigi/fsutil/docker-bake.hcl
generated
vendored
23
vendor/github.com/tonistiigi/fsutil/docker-bake.hcl
generated
vendored
@@ -60,7 +60,15 @@ target "test-noroot" {
|
||||
output = ["${DESTDIR}/coverage"]
|
||||
}
|
||||
|
||||
target "lint" {
|
||||
group "lint" {
|
||||
targets = ["lint-golangci", "lint-gopls"]
|
||||
}
|
||||
|
||||
group "lint-cross" {
|
||||
targets = ["lint-golangci-cross", "lint-gopls-cross"]
|
||||
}
|
||||
|
||||
target "lint-golangci" {
|
||||
inherits = ["_common"]
|
||||
dockerfile = "./hack/dockerfiles/lint.Dockerfile"
|
||||
output = ["type=cacheonly"]
|
||||
@@ -69,8 +77,17 @@ target "lint" {
|
||||
}
|
||||
}
|
||||
|
||||
target "lint-cross" {
|
||||
inherits = ["lint", "_platforms"]
|
||||
target "lint-gopls" {
|
||||
inherits = ["lint-golangci"]
|
||||
target = "gopls-analyze"
|
||||
}
|
||||
|
||||
target "lint-golangci-cross" {
|
||||
inherits = ["lint-golangci", "_platforms"]
|
||||
}
|
||||
|
||||
target "lint-gopls-cross" {
|
||||
inherits = ["lint-gopls", "_platforms"]
|
||||
}
|
||||
|
||||
target "validate-generated-files" {
|
||||
|
Reference in New Issue
Block a user