aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/rosa/builtins.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/rosa/builtins.go')
-rw-r--r--internal/rosa/builtins.go42
1 files changed, 41 insertions, 1 deletions
diff --git a/internal/rosa/builtins.go b/internal/rosa/builtins.go
index 8c46779f..6d457dbd 100644
--- a/internal/rosa/builtins.go
+++ b/internal/rosa/builtins.go
@@ -25,7 +25,7 @@ const (
loadFlagE = `"-l$` + pkg.EnvLoad + `"`
)
-// newTar wraps [pkg.NewHTTPGetTar] with a simpler function signature.
+// newTar is a helper for downloading compressed tarballs.
func newTar(url, checksum string, compress uint32) pkg.Artifact {
return pkg.NewTar(
pkg.NewDecompress(
@@ -114,3 +114,43 @@ func skipGNUTests(tests ...int64) string {
}
return buf.String()
}
+
+// builtin contains native and embedded [Artifact] registrations.
+var builtin S
+
+// New returns the address of a newly populated [S] derived from built-ins.
+func New() *S { return builtin.Clone() }
+
+// Collect returns all built-in non-excluded [ArtifactH].
+func Collect() (handles P) { return builtin.Collect() }
+
+// CollectAll returns all built-in [ArtifactH].
+func CollectAll() (handles P) { return builtin.CollectAll() }
+
+// builtinStd is the [Std] toolchain stage on builtin.
+var builtinStd = builtin.Std()
+
+// Load satisfies an [Artifact] referred to by an [ArtifactH].
+func Load(handle ArtifactH) (*Metadata, pkg.Artifact) {
+ return builtinStd.Load(handle)
+}
+
+// LoadAt satisfies an [Artifact] referred to by an [ArtifactH] at the
+// specified stage.
+func LoadAt(stage Stage, handle ArtifactH) (*Metadata, pkg.Artifact) {
+ return builtin.New(stage).Load(handle)
+}
+
+// MustLoad is like Load, but panics if the named [Artifact] is not registered.
+func MustLoad(handle ArtifactH) (*Metadata, pkg.Artifact) {
+ return builtinStd.MustLoad(handle)
+}
+
+// MustLoadAt is like LoadAt, but panics if the named [Artifact] is not
+// registered.
+func MustLoadAt(stage Stage, handle ArtifactH) (*Metadata, pkg.Artifact) {
+ return builtin.New(stage).MustLoad(handle)
+}
+
+// HasStageEarly returns whether a stage0 distribution is available.
+func HasStageEarly() (ok bool) { return builtin.HasStageEarly() }