Merge pull request #5637 from thaJeztah/bump_rosetta

vendor: github.com/tonistiigi/go-rosetta v0.0.0-20220804170347-3f4430f2d346
This commit is contained in:
Sebastiaan van Stijn 2024-11-21 17:53:16 +01:00 committed by GitHub
commit 6c76914532
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 32 additions and 4 deletions

View File

@ -39,7 +39,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/theupdateframework/notary v0.7.1-0.20210315103452-bf96a202a09a 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 github.com/xeipuuv/gojsonschema v1.2.0
go.opentelemetry.io/otel v1.28.0 go.opentelemetry.io/otel v1.28.0
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.28.0 go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.28.0

View File

@ -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/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 h1:tlJ7tGUHvcvL1v3yR6NcCc9nOqh2L+CG6HWrYQtwzQ0=
github.com/theupdateframework/notary v0.7.1-0.20210315103452-bf96a202a09a/go.mod h1:Y94A6rPp2OwNfP/7vmf8O2xx2IykP8pPXQ1DLouGnEw= 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-20220804170347-3f4430f2d346 h1:TvtdmeYsYEij78hS4oxnwikoiLdIrgav3BA+CbhaDAI=
github.com/tonistiigi/go-rosetta v0.0.0-20200727161949-f79598599c5d/go.mod h1:xKQhd7snlzKFuUi1taTGWjpRE8iFTA06DeacYi3CVFQ= 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 h1:FsyNrX12e5BkplJq7wKOLk0+C6LZ+KGXvuEcKUYm5ss=
github.com/weppos/publicsuffix-go v0.15.1-0.20210511084619-b1f36a2d6c0b/go.mod h1:HYux0V0Zi04bHNwOHy4cXJVz/TQjYonnF6aoYhj+3QE= 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= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=

8
vendor/github.com/tonistiigi/go-rosetta/README.md generated vendored Normal file
View File

@ -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.

View File

@ -1,17 +1,28 @@
//go:build darwin
// +build darwin // +build darwin
package rosetta package rosetta
import ( import (
"os"
"runtime" "runtime"
"syscall" "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 { func Enabled() bool {
v, err := syscall.SysctlUint32("sysctl.proc_translated") v, err := syscall.SysctlUint32("sysctl.proc_translated")
return err == nil && v == 1 return err == nil && v == 1
} }
// NativeArch returns the native architecture, even if binary architecture
// is emulated by Rosetta.
func NativeArch() string { func NativeArch() string {
if Enabled() && runtime.GOARCH == "amd64" { if Enabled() && runtime.GOARCH == "amd64" {
return "arm64" return "arm64"

View File

@ -1,3 +1,4 @@
//go:build !darwin
// +build !darwin // +build !darwin
package rosetta package rosetta
@ -6,10 +7,18 @@ import (
"runtime" "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 { func Enabled() bool {
return false return false
} }
// NativeArch returns the native architecture, even if binary architecture
// is emulated by Rosetta.
func NativeArch() string { func NativeArch() string {
return runtime.GOARCH return runtime.GOARCH
} }

2
vendor/modules.txt vendored
View File

@ -293,7 +293,7 @@ github.com/theupdateframework/notary/tuf/data
github.com/theupdateframework/notary/tuf/signed github.com/theupdateframework/notary/tuf/signed
github.com/theupdateframework/notary/tuf/utils github.com/theupdateframework/notary/tuf/utils
github.com/theupdateframework/notary/tuf/validation 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 ## explicit; go 1.13
github.com/tonistiigi/go-rosetta github.com/tonistiigi/go-rosetta
# github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb # github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb