From 8d72b9e5bd8d99cbd32ce0ebe2f5da8e9b1d88ce Mon Sep 17 00:00:00 2001 From: Ophestra Date: Thu, 7 May 2026 18:04:59 +0900 Subject: internal/pkg: optionally register binfmt This transparently supports curing foreign exec artifacts. Signed-off-by: Ophestra --- internal/rosa/all.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'internal/rosa/all.go') diff --git a/internal/rosa/all.go b/internal/rosa/all.go index 8fee7867..c8eddd7f 100644 --- a/internal/rosa/all.go +++ b/internal/rosa/all.go @@ -6,6 +6,7 @@ import ( "errors" "fmt" "net/http" + "runtime" "strconv" "sync" @@ -347,6 +348,9 @@ var ( // artifactsOnce is for lazy initialisation of artifacts. artifactsOnce [_toolchainEnd][len(artifactsM)]sync.Once + // arch is the target architecture. + arch = runtime.GOARCH + // presetOpts globally modifies behaviour of presets. presetOpts int ) @@ -358,6 +362,9 @@ const ( OptLLVMNoLTO ) +// Arch returns the target architecture. +func Arch() string { return arch } + // Flags returns the current preset flags func Flags() int { return presetOpts } @@ -367,7 +374,12 @@ func zero[T any](p *T) { var v T; *p = v } // DropCaches arranges for all cached [pkg.Artifact] to be freed some time after // it returns. Must not be used concurrently with any other function from this // package. -func DropCaches(flags int) { +func DropCaches(targetArch string, flags int) { + if targetArch == "" { + targetArch = runtime.GOARCH + } + + arch = targetArch presetOpts = flags zero(&artifacts) zero(&artifactsOnce) -- cgit v1.3.1