diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-08-10 17:50:36 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-08-10 17:50:36 +0900 |
| commit | f1ffb180bc34e16648fa2e83378244dabc60af7d (patch) | |
| tree | 611c1cc51bdee3b44f27f34f5cd41ef61ede42f5 /internal/rosa/rosa.go | |
| parent | 7f690145e30bb249c1b03ffe4f33e58472ef5fef (diff) | |
internal/rosa: optionally block packages from early stages
This helps avoid inadvertently increasing bootstrap input count.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/rosa/rosa.go')
| -rw-r--r-- | internal/rosa/rosa.go | 14 |
1 files changed, 14 insertions, 0 deletions
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") } |
