Merge pull request #2781 from crazy-max/update-fsutil

vendor: github.com/tonistiigi/fsutil 8d32dbdd27d3
This commit is contained in:
Tõnis Tiigi 2024-11-10 20:21:13 -08:00 committed by GitHub
commit 7855f8324b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 98 additions and 15 deletions

2
go.mod
View File

@ -41,7 +41,7 @@ require (
github.com/spf13/cobra v1.8.1 github.com/spf13/cobra v1.8.1
github.com/spf13/pflag v1.0.5 github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.9.0 github.com/stretchr/testify v1.9.0
github.com/tonistiigi/fsutil v0.0.0-20241028165955-397af5306b5c github.com/tonistiigi/fsutil v0.0.0-20241104203517-8d32dbdd27d3
github.com/tonistiigi/go-csvvalue v0.0.0-20240710180619-ddb21b71c0b4 github.com/tonistiigi/go-csvvalue v0.0.0-20240710180619-ddb21b71c0b4
github.com/zclconf/go-cty v1.14.4 github.com/zclconf/go-cty v1.14.4
go.opentelemetry.io/otel v1.21.0 go.opentelemetry.io/otel v1.21.0

4
go.sum
View File

@ -443,8 +443,8 @@ github.com/theupdateframework/notary v0.7.0 h1:QyagRZ7wlSpjT5N2qQAh/pN+DVqgekv4D
github.com/theupdateframework/notary v0.7.0/go.mod h1:c9DRxcmhHmVLDay4/2fUYdISnHqbFDGRSlXPO0AhYWw= github.com/theupdateframework/notary v0.7.0/go.mod h1:c9DRxcmhHmVLDay4/2fUYdISnHqbFDGRSlXPO0AhYWw=
github.com/tonistiigi/dchapes-mode v0.0.0-20241001053921-ca0759fec205 h1:eUk79E1w8yMtXeHSzjKorxuC8qJOnyXQnLaJehxpJaI= github.com/tonistiigi/dchapes-mode v0.0.0-20241001053921-ca0759fec205 h1:eUk79E1w8yMtXeHSzjKorxuC8qJOnyXQnLaJehxpJaI=
github.com/tonistiigi/dchapes-mode v0.0.0-20241001053921-ca0759fec205/go.mod h1:3Iuxbr0P7D3zUzBMAZB+ois3h/et0shEz0qApgHYGpY= github.com/tonistiigi/dchapes-mode v0.0.0-20241001053921-ca0759fec205/go.mod h1:3Iuxbr0P7D3zUzBMAZB+ois3h/et0shEz0qApgHYGpY=
github.com/tonistiigi/fsutil v0.0.0-20241028165955-397af5306b5c h1:bQLsfX+uEPZUjyR2qmoJs5F8Z57bPVmF3IsUf22Xo9Y= github.com/tonistiigi/fsutil v0.0.0-20241104203517-8d32dbdd27d3 h1:Ce6i+wvnQ0dV5ZPLGYYu/kVYFXEJI+QPy5tJKfU+Q7c=
github.com/tonistiigi/fsutil v0.0.0-20241028165955-397af5306b5c/go.mod h1:Dl/9oEjK7IqnjAm21Okx/XIxUCFJzvh+XdVHUlBwXTw= github.com/tonistiigi/fsutil v0.0.0-20241104203517-8d32dbdd27d3/go.mod h1:Dl/9oEjK7IqnjAm21Okx/XIxUCFJzvh+XdVHUlBwXTw=
github.com/tonistiigi/go-csvvalue v0.0.0-20240710180619-ddb21b71c0b4 h1:7I5c2Ig/5FgqkYOh/N87NzoyI9U15qUPXhDD8uCupv8= github.com/tonistiigi/go-csvvalue v0.0.0-20240710180619-ddb21b71c0b4 h1:7I5c2Ig/5FgqkYOh/N87NzoyI9U15qUPXhDD8uCupv8=
github.com/tonistiigi/go-csvvalue v0.0.0-20240710180619-ddb21b71c0b4/go.mod h1:278M4p8WsNh3n4a1eqiFcV2FGk7wE5fwUpUom9mK9lE= github.com/tonistiigi/go-csvvalue v0.0.0-20240710180619-ddb21b71c0b4/go.mod h1:278M4p8WsNh3n4a1eqiFcV2FGk7wE5fwUpUom9mK9lE=
github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea h1:SXhTLE6pb6eld/v/cCndK0AMpt1wiVFb/YYmqB3/QG0= github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea h1:SXhTLE6pb6eld/v/cCndK0AMpt1wiVFb/YYmqB3/QG0=

View File

@ -1,7 +1,5 @@
run: run:
timeout: 10m timeout: 30m
skip-files:
- ".*\\.pb\\.go$"
linters: linters:
enable: enable:
@ -25,6 +23,10 @@ linters-settings:
- pkg: "io/ioutil" - pkg: "io/ioutil"
desc: The io/ioutil package has been deprecated. desc: The io/ioutil package has been deprecated.
issues:
exclude-files:
- ".*\\.pb\\.go$"
# show all # show all
max-issues-per-linter: 0 max-issues-per-linter: 0
max-same-issues: 0 max-same-issues: 0

View File

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

View File

@ -0,0 +1,38 @@
//go:build openbsd
// +build openbsd
package fs
import (
"io"
"os"
"github.com/pkg/errors"
"golang.org/x/sys/unix"
)
func copyFile(source, target string) error {
src, err := os.Open(source)
if err != nil {
return errors.Wrapf(err, "failed to open source %s", source)
}
defer src.Close()
tgt, err := os.Create(target)
if err != nil {
return errors.Wrapf(err, "failed to open target %s", target)
}
defer tgt.Close()
return copyFileContent(tgt, src)
}
func copyFileContent(dst, src *os.File) error {
buf := bufferPool.Get().(*[]byte)
_, err := io.CopyBuffer(dst, src, *buf)
bufferPool.Put(buf)
return err
}
func mknod(dst string, mode uint32, rDev int) error {
return unix.Mknod(dst, uint32(mode), rDev)
}

View File

@ -1,5 +1,5 @@
//go:build solaris || darwin || freebsd //go:build solaris || darwin || freebsd || openbsd
// +build solaris darwin freebsd // +build solaris darwin freebsd openbsd
package fs package fs

View File

@ -1,4 +1,5 @@
// +build darwin freebsd netbsd openbsd //go:build darwin || freebsd || netbsd
// +build darwin freebsd netbsd
package fs package fs

View File

@ -0,0 +1,18 @@
//go:build openbsd
// +build openbsd
package fs
import (
"syscall"
)
// Returns the last-accessed time
func StatAtime(st *syscall.Stat_t) syscall.Timespec {
return st.Atim
}
// Returns the last-modified time
func StatMtime(st *syscall.Stat_t) syscall.Timespec {
return st.Mtim
}

View File

@ -6,6 +6,25 @@ variable "DESTDIR" {
default = "./bin" default = "./bin"
} }
target "_platforms" {
platforms = [
"darwin/amd64",
"darwin/arm64",
"freebsd/amd64",
"freebsd/arm64",
"linux/386",
"linux/amd64",
"linux/arm",
"linux/arm64",
"linux/ppc64le",
"linux/s390x",
"openbsd/amd64",
"openbsd/arm64",
"windows/amd64",
"windows/arm64"
]
}
group "default" { group "default" {
targets = ["build"] targets = ["build"]
} }
@ -40,6 +59,10 @@ target "lint" {
} }
} }
target "lint-cross" {
inherits = ["lint", "_platforms"]
}
target "validate-generated-files" { target "validate-generated-files" {
dockerfile = "./hack/dockerfiles/generated-files.Dockerfile" dockerfile = "./hack/dockerfiles/generated-files.Dockerfile"
output = ["type=cacheonly"] output = ["type=cacheonly"]
@ -86,6 +109,5 @@ target "shfmt" {
} }
target "cross" { target "cross" {
inherits = ["build"] inherits = ["build", "_platforms"]
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 // +build windows
package fsutil package fsutil

2
vendor/modules.txt vendored
View File

@ -715,7 +715,7 @@ github.com/theupdateframework/notary/tuf/validation
# github.com/tonistiigi/dchapes-mode v0.0.0-20241001053921-ca0759fec205 # github.com/tonistiigi/dchapes-mode v0.0.0-20241001053921-ca0759fec205
## explicit; go 1.21 ## explicit; go 1.21
github.com/tonistiigi/dchapes-mode github.com/tonistiigi/dchapes-mode
# github.com/tonistiigi/fsutil v0.0.0-20241028165955-397af5306b5c # github.com/tonistiigi/fsutil v0.0.0-20241104203517-8d32dbdd27d3
## explicit; go 1.21 ## explicit; go 1.21
github.com/tonistiigi/fsutil github.com/tonistiigi/fsutil
github.com/tonistiigi/fsutil/copy github.com/tonistiigi/fsutil/copy