diff --git a/vendor.mod b/vendor.mod index 23e0dff17b..dd1dcb953d 100644 --- a/vendor.mod +++ b/vendor.mod @@ -39,7 +39,7 @@ require ( github.com/spf13/cobra v1.8.1 github.com/spf13/pflag v1.0.5 github.com/theupdateframework/notary v0.7.1-0.20210315103452-bf96a202a09a - github.com/tonistiigi/go-rosetta v0.0.0-20200727161949-f79598599c5d + github.com/tonistiigi/go-rosetta v0.0.0-20220804170347-3f4430f2d346 github.com/xeipuuv/gojsonschema v1.2.0 go.opentelemetry.io/otel v1.28.0 go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.28.0 diff --git a/vendor.sum b/vendor.sum index d30731ca6c..76536520a0 100644 --- a/vendor.sum +++ b/vendor.sum @@ -266,8 +266,8 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/theupdateframework/notary v0.7.1-0.20210315103452-bf96a202a09a h1:tlJ7tGUHvcvL1v3yR6NcCc9nOqh2L+CG6HWrYQtwzQ0= github.com/theupdateframework/notary v0.7.1-0.20210315103452-bf96a202a09a/go.mod h1:Y94A6rPp2OwNfP/7vmf8O2xx2IykP8pPXQ1DLouGnEw= -github.com/tonistiigi/go-rosetta v0.0.0-20200727161949-f79598599c5d h1:wvQZpqy8p0D/FUia6ipKDhXrzPzBVJE4PZyPc5+5Ay0= -github.com/tonistiigi/go-rosetta v0.0.0-20200727161949-f79598599c5d/go.mod h1:xKQhd7snlzKFuUi1taTGWjpRE8iFTA06DeacYi3CVFQ= +github.com/tonistiigi/go-rosetta v0.0.0-20220804170347-3f4430f2d346 h1:TvtdmeYsYEij78hS4oxnwikoiLdIrgav3BA+CbhaDAI= +github.com/tonistiigi/go-rosetta v0.0.0-20220804170347-3f4430f2d346/go.mod h1:xKQhd7snlzKFuUi1taTGWjpRE8iFTA06DeacYi3CVFQ= github.com/weppos/publicsuffix-go v0.15.1-0.20210511084619-b1f36a2d6c0b h1:FsyNrX12e5BkplJq7wKOLk0+C6LZ+KGXvuEcKUYm5ss= github.com/weppos/publicsuffix-go v0.15.1-0.20210511084619-b1f36a2d6c0b/go.mod h1:HYux0V0Zi04bHNwOHy4cXJVz/TQjYonnF6aoYhj+3QE= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= diff --git a/vendor/github.com/tonistiigi/go-rosetta/README.md b/vendor/github.com/tonistiigi/go-rosetta/README.md new file mode 100644 index 0000000000..4a70dc4a89 --- /dev/null +++ b/vendor/github.com/tonistiigi/go-rosetta/README.md @@ -0,0 +1,8 @@ +go-rosetta +========== + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/tonistiigi/go-rosetta)](https://pkg.go.dev/github.com/tonistiigi/go-rosetta) + +`go-rosetta` provides utilities to detect if an application is running as a +[Rosetta](https://developer.apple.com/documentation/apple_silicon/about_the_rosetta_translation_environment) translated binary, and +to determine the native architecture. diff --git a/vendor/github.com/tonistiigi/go-rosetta/rosetta.go b/vendor/github.com/tonistiigi/go-rosetta/rosetta.go index c44ff011e6..cc278dbc18 100644 --- a/vendor/github.com/tonistiigi/go-rosetta/rosetta.go +++ b/vendor/github.com/tonistiigi/go-rosetta/rosetta.go @@ -1,17 +1,28 @@ +//go:build darwin // +build darwin package rosetta import ( + "os" "runtime" "syscall" ) +// Available returns true if Rosetta is installed/available +func Available() bool { + _, err := os.Stat("/Library/Apple/usr/share/rosetta") + return err == nil +} + +// Enabled returns true if running in a Rosetta Translated Binary, false otherwise. func Enabled() bool { v, err := syscall.SysctlUint32("sysctl.proc_translated") return err == nil && v == 1 } +// NativeArch returns the native architecture, even if binary architecture +// is emulated by Rosetta. func NativeArch() string { if Enabled() && runtime.GOARCH == "amd64" { return "arm64" diff --git a/vendor/github.com/tonistiigi/go-rosetta/rosetta_unsupported.go b/vendor/github.com/tonistiigi/go-rosetta/rosetta_unsupported.go index f8781cea26..808890e7b0 100644 --- a/vendor/github.com/tonistiigi/go-rosetta/rosetta_unsupported.go +++ b/vendor/github.com/tonistiigi/go-rosetta/rosetta_unsupported.go @@ -1,3 +1,4 @@ +//go:build !darwin // +build !darwin package rosetta @@ -6,10 +7,18 @@ import ( "runtime" ) +// Available returns true if Rosetta is installed/available +func Available() bool { + return false +} + +// Enabled returns true if running in a Rosetta Translated Binary, false otherwise. func Enabled() bool { return false } +// NativeArch returns the native architecture, even if binary architecture +// is emulated by Rosetta. func NativeArch() string { return runtime.GOARCH } diff --git a/vendor/modules.txt b/vendor/modules.txt index 430194d842..eae4e25beb 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -293,7 +293,7 @@ github.com/theupdateframework/notary/tuf/data github.com/theupdateframework/notary/tuf/signed github.com/theupdateframework/notary/tuf/utils github.com/theupdateframework/notary/tuf/validation -# github.com/tonistiigi/go-rosetta v0.0.0-20200727161949-f79598599c5d +# github.com/tonistiigi/go-rosetta v0.0.0-20220804170347-3f4430f2d346 ## explicit; go 1.13 github.com/tonistiigi/go-rosetta # github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb