mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-17 00:47:10 +08:00
vendor: update buildkit to v0.14.0-rc1
Update buildkit dependency to v0.14.0-rc1. Update the tracing infrastructure to use the new detect API which updates how the delegated exporter is configured. Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
This commit is contained in:
68
vendor/github.com/tonistiigi/fsutil/hardlinks.go
generated
vendored
68
vendor/github.com/tonistiigi/fsutil/hardlinks.go
generated
vendored
@ -1,6 +1,9 @@
|
||||
package fsutil
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
gofs "io/fs"
|
||||
"os"
|
||||
"syscall"
|
||||
|
||||
@ -46,3 +49,68 @@ func (v *Hardlinks) HandleChange(kind ChangeKind, p string, fi os.FileInfo, err
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// WithHardlinkReset returns a FS that fixes hardlinks for FS that has been filtered
|
||||
// so that original hardlink sources might be missing
|
||||
func WithHardlinkReset(fs FS) FS {
|
||||
return &hardlinkFilter{fs: fs}
|
||||
}
|
||||
|
||||
type hardlinkFilter struct {
|
||||
fs FS
|
||||
}
|
||||
|
||||
var _ FS = &hardlinkFilter{}
|
||||
|
||||
func (r *hardlinkFilter) Walk(ctx context.Context, target string, fn gofs.WalkDirFunc) error {
|
||||
seenFiles := make(map[string]string)
|
||||
return r.fs.Walk(ctx, target, func(path string, entry gofs.DirEntry, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fi, err := entry.Info()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if fi.IsDir() || fi.Mode()&os.ModeSymlink != 0 {
|
||||
return fn(path, entry, nil)
|
||||
}
|
||||
|
||||
stat, ok := fi.Sys().(*types.Stat)
|
||||
if !ok {
|
||||
return errors.WithStack(&os.PathError{Path: path, Err: syscall.EBADMSG, Op: "fileinfo without stat info"})
|
||||
}
|
||||
|
||||
if stat.Linkname != "" {
|
||||
if v, ok := seenFiles[stat.Linkname]; !ok {
|
||||
seenFiles[stat.Linkname] = stat.Path
|
||||
stat.Linkname = ""
|
||||
entry = &dirEntryWithStat{DirEntry: entry, stat: stat}
|
||||
} else {
|
||||
if v != stat.Path {
|
||||
stat.Linkname = v
|
||||
entry = &dirEntryWithStat{DirEntry: entry, stat: stat}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
seenFiles[path] = stat.Path
|
||||
|
||||
return fn(path, entry, nil)
|
||||
})
|
||||
}
|
||||
|
||||
func (r *hardlinkFilter) Open(p string) (io.ReadCloser, error) {
|
||||
return r.fs.Open(p)
|
||||
}
|
||||
|
||||
type dirEntryWithStat struct {
|
||||
gofs.DirEntry
|
||||
stat *types.Stat
|
||||
}
|
||||
|
||||
func (d *dirEntryWithStat) Info() (gofs.FileInfo, error) {
|
||||
return &StatInfo{d.stat}, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user