internal/rosa: optionally block packages from early stages
Test / Create distribution (push) Successful in 53s
Test / Sandbox (push) Successful in 2m54s
Test / Hakurei (push) Successful in 4m46s
Test / Sandbox (race detector) (push) Successful in 5m49s
Test / Hakurei (race detector) (push) Successful in 7m6s
Test / ShareFS (push) Successful in 7m33s
Test / Flake checks (push) Successful in 1m13s

This helps avoid inadvertently increasing bootstrap input count.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
cat
2026-08-10 17:50:36 +09:00
parent 7f690145e3
commit f1ffb180bc
3 changed files with 21 additions and 0 deletions
+3
View File
@@ -3,6 +3,9 @@ package python {
website = "https://www.python.org"; website = "https://www.python.org";
anitya = 13254; anitya = 13254;
// too many inputs; early variant available
bootstrap = false;
version# = "3.14.7"; version# = "3.14.7";
source = remoteTar { source = remoteTar {
url = "https://www.python.org/ftp/python/"+version+ url = "https://www.python.org/ftp/python/"+version+
+14
View File
@@ -320,6 +320,8 @@ type PackageAttr struct {
// Whether to replace /usr/bin/ with a symlink to /bin/. // Whether to replace /usr/bin/ with a symlink to /bin/.
PopulateUsrBin bool PopulateUsrBin bool
// Whether this package is disallowed from bootstrap stages.
Std bool
// Hint for an early variant of toybox to be used when available. // Hint for an early variant of toybox to be used when available.
Early bool Early bool
// Whether to omit output colour environment variables. // Whether to omit output colour environment variables.
@@ -375,6 +377,14 @@ func (t Toolchain) Append(a []pkg.Artifact, handles ...ArtifactH) []pkg.Artifact
return a 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. // New constructs a [pkg.Artifact] via a build system helper.
func (t Toolchain) New( func (t Toolchain) New(
name, version string, name, version string,
@@ -387,6 +397,10 @@ func (t Toolchain) New(
attr = new(PackageAttr) attr = new(PackageAttr)
} }
if attr.Std && !t.stage.isStd() {
panic(BootstrapError(name))
}
if name == "" || version == "" { if name == "" || version == "" {
panic("name must be non-empty") panic("name must be non-empty")
} }
+4
View File
@@ -998,6 +998,8 @@ func (ctx *evalContext) pf(
overlay string overlay string
inputs, runtimes, extra azalea.Array inputs, runtimes, extra azalea.Array
bootstrap = true
) )
if err = args.Apply(map[unique.Handle[azalea.Ident]]any{ if err = args.Apply(map[unique.Handle[azalea.Ident]]any{
k("description"): &meta.Description, k("description"): &meta.Description,
@@ -1020,6 +1022,7 @@ func (ctx *evalContext) pf(
k("exclusive"): &attr.Exclusive, k("exclusive"): &attr.Exclusive,
k("toyboxEarly"): &attr.Early, k("toyboxEarly"): &attr.Early,
k("minimal"): &attr.NoToolchain, k("minimal"): &attr.NoToolchain,
k("bootstrap"): &bootstrap,
k("checksum"): &kc, k("checksum"): &kc,
k("output"): &output, k("output"): &output,
@@ -1032,6 +1035,7 @@ func (ctx *evalContext) pf(
}); err != nil { }); err != nil {
return return
} }
attr.Std = !bootstrap
var inputsH, extraH P var inputsH, extraH P
if inputsH, err = toHandles(inputs); err != nil { if inputsH, err = toHandles(inputs); err != nil {
return return