vendor: update moby/buildkit

Update modules:

  go mod edit -require github.com/moby/buildkit@master
  go mod tidy -compat=1.17 && ./hack/update-vendor

Signed-off-by: Justin Chadwell <me@jedevc.com>
This commit is contained in:
Justin Chadwell
2022-05-17 16:11:41 +01:00
parent 66a764f9c1
commit 22ac3271d2
113 changed files with 2667 additions and 662 deletions

View File

@ -1,29 +1,30 @@
#syntax=docker/dockerfile:1.2
ARG GO_VERSION=1.16
#syntax=docker/dockerfile:1.4
ARG GO_VERSION=1.18
FROM --platform=amd64 tonistiigi/xx:golang AS goxx
FROM --platform=$BUILDPLATFORM tonistiigi/xx:1.1.0 AS xx
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine AS base
RUN apk add --no-cache gcc musl-dev
COPY --from=goxx / /
RUN apk add --no-cache git
COPY --from=xx / /
WORKDIR /src
FROM base AS build
ARG TARGETPLATFORM
RUN --mount=target=. \
RUN --mount=target=. --mount=target=/go/pkg/mod,type=cache \
--mount=target=/root/.cache,type=cache \
go build ./...
xx-go build ./...
FROM base AS test
RUN --mount=target=. \
ARG TESTFLAGS
RUN --mount=target=. --mount=target=/go/pkg/mod,type=cache \
--mount=target=/root/.cache,type=cache \
go test -test.v ./...
CGO_ENABLED=0 xx-go test -test.v ${TESTFLAGS} ./...
FROM base AS test-noroot
RUN mkdir /go/pkg && chmod 0777 /go/pkg
USER 1000:1000
RUN --mount=target=. \
--mount=target=/tmp/.cache,type=cache \
GOCACHE=/tmp/gocache go test -test.v ./...
CGO_ENABLED=0 GOCACHE=/tmp/gocache xx-go test -test.v ./...
FROM build

View File

@ -1,3 +1,4 @@
//go:build linux
// +build linux
package fsutil

View File

@ -323,10 +323,6 @@ func (lfw *lazyFileWriter) Close() error {
return err
}
func mkdev(major int64, minor int64) uint32 {
return uint32(((minor & 0xfff00) << 12) | ((major & 0xfff) << 8) | (minor & 0xff))
}
// Random number state.
// We generate random temporary file names so that there's a good
// chance the file doesn't exist yet - keeps the number of tries in

View File

@ -1,3 +1,4 @@
//go:build freebsd
// +build freebsd
package fsutil
@ -8,7 +9,9 @@ import (
)
func createSpecialFile(path string, mode uint32, stat *types.Stat) error {
dev := unix.Mkdev(uint32(stat.Devmajor), uint32(stat.Devminor))
return unix.Mknod(path, mode, dev)
return unix.Mknod(path, mode, mkdev(stat.Devmajor, stat.Devminor))
}
func mkdev(major int64, minor int64) uint64 {
return unix.Mkdev(uint32(major), uint32(minor))
}

View File

@ -1,3 +1,4 @@
//go:build !windows
// +build !windows
package fsutil

View File

@ -1,13 +1,17 @@
//go:build !windows && !freebsd
// +build !windows,!freebsd
package fsutil
import (
"syscall"
"github.com/tonistiigi/fsutil/types"
"golang.org/x/sys/unix"
)
func createSpecialFile(path string, mode uint32, stat *types.Stat) error {
return syscall.Mknod(path, mode, int(mkdev(stat.Devmajor, stat.Devminor)))
return unix.Mknod(path, mode, mkdev(stat.Devmajor, stat.Devminor))
}
func mkdev(major int64, minor int64) int {
return int(unix.Mkdev(uint32(major), uint32(minor)))
}

View File

@ -1,5 +1,5 @@
variable "GO_VERSION" {
default = "1.16"
default = "1.18"
}
group "default" {
@ -63,5 +63,5 @@ target "shfmt" {
target "cross" {
inherits = ["build"]
platforms = ["linux/amd64", "linux/386", "linux/arm64", "linux/arm", "linux/ppc64le", "linux/s390x", "darwin/amd64", "darwin/arm64", "windows/amd64", "freebsd/amd64", "freebsd/arm64"]
platforms = ["linux/amd64", "linux/386", "linux/arm64", "linux/arm", "linux/ppc64le", "linux/s390x", "darwin/amd64", "darwin/arm64", "windows/amd64", "windows/arm64", "freebsd/amd64", "freebsd/arm64"]
}

View File

@ -1,3 +1,4 @@
//go:build !windows
// +build !windows
package fsutil

View File

@ -19,9 +19,29 @@ type WalkOpt struct {
// FollowPaths contains symlinks that are resolved into include patterns
// before performing the fs walk
FollowPaths []string
Map FilterFunc
Map MapFunc
}
type MapFunc func(string, *types.Stat) MapResult
// The result of the walk function controls
// both how WalkDir continues and whether the path is kept.
type MapResult int
const (
// Keep the current path and continue.
MapResultKeep MapResult = iota
// Exclude the current path and continue.
MapResultExclude
// Exclude the current path, and skip the rest of the dir.
// If path is a dir, skip the current directory.
// If path is a file, skip the rest of the parent directory.
// (This matches the semantics of fs.SkipDir.)
MapResultSkipDir
)
func Walk(ctx context.Context, p string, opt *WalkOpt, fn filepath.WalkFunc) error {
root, err := filepath.EvalSymlinks(p)
if err != nil {
@ -258,7 +278,10 @@ func Walk(ctx context.Context, p string, opt *WalkOpt, fn filepath.WalkFunc) err
return ctx.Err()
default:
if opt != nil && opt.Map != nil {
if allowed := opt.Map(stat.Path, stat); !allowed {
result := opt.Map(stat.Path, stat)
if result == MapResultSkipDir {
return filepath.SkipDir
} else if result == MapResultExclude {
return nil
}
}
@ -277,7 +300,8 @@ func Walk(ctx context.Context, p string, opt *WalkOpt, fn filepath.WalkFunc) err
default:
}
if opt != nil && opt.Map != nil {
if allowed := opt.Map(parentStat.Path, parentStat); !allowed {
result := opt.Map(parentStat.Path, parentStat)
if result == MapResultSkipDir || result == MapResultExclude {
continue
}
}