mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-10 13:37:08 +08:00
vendor: update buildkit to v0.19.0-rc1
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
74
vendor/github.com/moby/buildkit/client/llb/fileop.go
generated
vendored
74
vendor/github.com/moby/buildkit/client/llb/fileop.go
generated
vendored
@ -85,6 +85,13 @@ func (fa *FileAction) Mkfile(p string, m os.FileMode, dt []byte, opt ...MkfileOp
|
||||
return a
|
||||
}
|
||||
|
||||
// Symlink creates a symlink at `newpath` that points to `oldpath`
|
||||
func (fa *FileAction) Symlink(oldpath, newpath string, opt ...SymlinkOption) *FileAction {
|
||||
a := Symlink(oldpath, newpath, opt...)
|
||||
a.prev = fa
|
||||
return a
|
||||
}
|
||||
|
||||
func (fa *FileAction) Rm(p string, opt ...RmOption) *FileAction {
|
||||
a := Rm(p, opt...)
|
||||
a.prev = fa
|
||||
@ -193,6 +200,7 @@ type ChownOption interface {
|
||||
MkdirOption
|
||||
MkfileOption
|
||||
CopyOption
|
||||
SymlinkOption
|
||||
}
|
||||
|
||||
type mkdirOptionFunc func(*MkdirInfo)
|
||||
@ -290,6 +298,10 @@ func (co ChownOpt) SetCopyOption(mi *CopyInfo) {
|
||||
mi.ChownOpt = &co
|
||||
}
|
||||
|
||||
func (co ChownOpt) SetSymlinkOption(si *SymlinkInfo) {
|
||||
si.ChownOpt = &co
|
||||
}
|
||||
|
||||
func (co *ChownOpt) marshal(base pb.InputIndex) *pb.ChownOpt {
|
||||
if co == nil {
|
||||
return nil
|
||||
@ -337,6 +349,57 @@ func Mkfile(p string, m os.FileMode, dt []byte, opts ...MkfileOption) *FileActio
|
||||
}
|
||||
}
|
||||
|
||||
// SymlinkInfo is the modifiable options used to create symlinks
|
||||
type SymlinkInfo struct {
|
||||
ChownOpt *ChownOpt
|
||||
CreatedTime *time.Time
|
||||
}
|
||||
|
||||
func (si *SymlinkInfo) SetSymlinkOption(si2 *SymlinkInfo) {
|
||||
*si2 = *si
|
||||
}
|
||||
|
||||
type SymlinkOption interface {
|
||||
SetSymlinkOption(*SymlinkInfo)
|
||||
}
|
||||
|
||||
// Symlink creates a symlink at `newpath` that points to `oldpath`
|
||||
func Symlink(oldpath, newpath string, opts ...SymlinkOption) *FileAction {
|
||||
var si SymlinkInfo
|
||||
for _, o := range opts {
|
||||
o.SetSymlinkOption(&si)
|
||||
}
|
||||
|
||||
return &FileAction{
|
||||
action: &fileActionSymlink{
|
||||
oldpath: oldpath,
|
||||
newpath: newpath,
|
||||
info: si,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
type fileActionSymlink struct {
|
||||
oldpath string
|
||||
newpath string
|
||||
info SymlinkInfo
|
||||
}
|
||||
|
||||
func (s *fileActionSymlink) addCaps(f *FileOp) {
|
||||
addCap(&f.constraints, pb.CapFileSymlinkCreate)
|
||||
}
|
||||
|
||||
func (s *fileActionSymlink) toProtoAction(_ context.Context, _ string, base pb.InputIndex) (pb.IsFileAction, error) {
|
||||
return &pb.FileAction_Symlink{
|
||||
Symlink: &pb.FileActionSymlink{
|
||||
Oldpath: s.oldpath,
|
||||
Newpath: s.newpath,
|
||||
Owner: s.info.ChownOpt.marshal(base),
|
||||
Timestamp: marshalTime(s.info.CreatedTime),
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
type MkfileOption interface {
|
||||
SetMkfileOption(*MkfileInfo)
|
||||
}
|
||||
@ -606,6 +669,10 @@ func (c CreatedTime) SetMkfileOption(mi *MkfileInfo) {
|
||||
mi.CreatedTime = (*time.Time)(&c)
|
||||
}
|
||||
|
||||
func (c CreatedTime) SetSymlinkOption(si *SymlinkInfo) {
|
||||
si.CreatedTime = (*time.Time)(&c)
|
||||
}
|
||||
|
||||
func (c CreatedTime) SetCopyOption(mi *CopyInfo) {
|
||||
mi.CreatedTime = (*time.Time)(&c)
|
||||
}
|
||||
@ -746,7 +813,10 @@ func (ms *marshalState) add(fa *FileAction, c *Constraints) (*fileActionState, e
|
||||
}
|
||||
|
||||
func (f *FileOp) Marshal(ctx context.Context, c *Constraints) (digest.Digest, []byte, *pb.OpMetadata, []*SourceLocation, error) {
|
||||
if dgst, dt, md, srcs, err := f.Load(c); err == nil {
|
||||
cache := f.Acquire()
|
||||
defer cache.Release()
|
||||
|
||||
if dgst, dt, md, srcs, err := cache.Load(c); err == nil {
|
||||
return dgst, dt, md, srcs, nil
|
||||
}
|
||||
|
||||
@ -816,7 +886,7 @@ func (f *FileOp) Marshal(ctx context.Context, c *Constraints) (digest.Digest, []
|
||||
if err != nil {
|
||||
return "", nil, nil, nil, err
|
||||
}
|
||||
return f.Store(dt, md, f.constraints.SourceLocations, c)
|
||||
return cache.Store(dt, md, f.constraints.SourceLocations, c)
|
||||
}
|
||||
|
||||
func normalizePath(parent, p string, keepSlash bool) string {
|
||||
|
Reference in New Issue
Block a user