From f1ffb180bc34e16648fa2e83378244dabc60af7d Mon Sep 17 00:00:00 2001 From: Ophestra Date: Mon, 10 Aug 2026 17:50:36 +0900 Subject: internal/rosa: optionally block packages from early stages This helps avoid inadvertently increasing bootstrap input count. Signed-off-by: Ophestra --- internal/rosa/rosa.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'internal/rosa/rosa.go') diff --git a/internal/rosa/rosa.go b/internal/rosa/rosa.go index f5a67a98..32c1bd00 100644 --- a/internal/rosa/rosa.go +++ b/internal/rosa/rosa.go @@ -320,6 +320,8 @@ type PackageAttr struct { // Whether to replace /usr/bin/ with a symlink to /bin/. PopulateUsrBin bool + // Whether this package is disallowed from bootstrap stages. + Std bool // Hint for an early variant of toybox to be used when available. Early bool // Whether to omit output colour environment variables. @@ -375,6 +377,14 @@ func (t Toolchain) Append(a []pkg.Artifact, handles ...ArtifactH) []pkg.Artifact return a } +// A BootstrapError describes a package disallowed from bootstrap stages. +type BootstrapError string + +func (e BootstrapError) Error() string { + return "package " + strconv.Quote(string(e)) + + " must not be built by bootstrap stages" +} + // New constructs a [pkg.Artifact] via a build system helper. func (t Toolchain) New( name, version string, @@ -387,6 +397,10 @@ func (t Toolchain) New( attr = new(PackageAttr) } + if attr.Std && !t.stage.isStd() { + panic(BootstrapError(name)) + } + if name == "" || version == "" { panic("name must be non-empty") } -- cgit v1.3.1