internal/rosa: export etc native artifact
Test / Create distribution (push) Successful in 52s
Test / Sandbox (push) Successful in 2m49s
Test / ShareFS (push) Successful in 3m59s
Test / Hakurei (push) Successful in 4m3s
Test / Sandbox (race detector) (push) Successful in 5m35s
Test / Hakurei (race detector) (push) Successful in 6m38s
Test / Flake checks (push) Successful in 1m12s

This is useful for external container tooling.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-06-10 13:20:55 +09:00
parent f333b8fbd6
commit df0bb877db
3 changed files with 26 additions and 27 deletions
+21 -22
View File
@@ -15,8 +15,13 @@ import (
// [Toolchain]. This silences test suites expecting certain standard files to be // [Toolchain]. This silences test suites expecting certain standard files to be
// available in /etc. // available in /etc.
type cureEtc struct { type cureEtc struct {
// Optional via newIANAEtc. // Whether to exclude ianaEtc.
iana pkg.Artifact minimal bool
}
// NewEtc returns a [pkg.Artifact] containing deterministic elements of /etc.
func NewEtc(minimal bool) pkg.Artifact {
return cureEtc{minimal}
} }
// Cure writes hardcoded configuration to files under etc. // Cure writes hardcoded configuration to files under etc.
@@ -45,8 +50,8 @@ nobody:x:65534:
} }
} }
if a.iana != nil { if !a.minimal {
iana, _ := t.GetArtifact(a.iana) iana, _ := t.GetArtifact(ianaEtc)
buf := make([]byte, syscall.Getpagesize()<<3) buf := make([]byte, syscall.Getpagesize()<<3)
for _, name := range []string{ for _, name := range []string{
@@ -90,7 +95,7 @@ func (cureEtc) Kind() pkg.Kind { return kindEtc }
// Params writes whether iana-etc is populated. // Params writes whether iana-etc is populated.
func (a cureEtc) Params(ctx *pkg.IContext) { func (a cureEtc) Params(ctx *pkg.IContext) {
if a.iana != nil { if !a.minimal {
ctx.WriteUint32(1) ctx.WriteUint32(1)
} else { } else {
ctx.WriteUint32(0) ctx.WriteUint32(0)
@@ -100,8 +105,8 @@ func (a cureEtc) Params(ctx *pkg.IContext) {
func init() { func init() {
pkg.Register(kindEtc, func(r *pkg.IRReader) pkg.Artifact { pkg.Register(kindEtc, func(r *pkg.IRReader) pkg.Artifact {
a := cureEtc{} a := cureEtc{}
if r.ReadUint32() != 0 { if r.ReadUint32() == 0 {
a.iana = r.Next() a.minimal = true
} }
if _, ok := r.Finalise(); ok { if _, ok := r.Finalise(); ok {
panic(pkg.ErrUnexpectedChecksum) panic(pkg.ErrUnexpectedChecksum)
@@ -115,34 +120,28 @@ func (cureEtc) IsExclusive() bool { return false }
// Dependencies returns a slice containing the backing iana-etc release. // Dependencies returns a slice containing the backing iana-etc release.
func (a cureEtc) Dependencies() []pkg.Artifact { func (a cureEtc) Dependencies() []pkg.Artifact {
if a.iana != nil { if !a.minimal {
return []pkg.Artifact{a.iana} return []pkg.Artifact{ianaEtc}
} }
return nil return nil
} }
// String returns a hardcoded reporting name. // String returns a hardcoded reporting name.
func (a cureEtc) String() string { func (a cureEtc) String() string {
if a.iana == nil { if a.minimal {
return "cure-etc-minimal" return "cure-etc-minimal"
} }
return "cure-etc" return "cure-etc"
} }
// newIANAEtc returns an unpacked iana-etc release. // ianaEtc is an unpacked iana-etc release.
func newIANAEtc() pkg.Artifact { var ianaEtc = newFromGitHubRelease(
const (
version = "20251215"
checksum = "kvKz0gW_rGG5QaNK9ZWmWu1IEgYAdmhj_wR7DYrh3axDfIql_clGRHmelP7525NJ"
)
return newFromGitHubRelease(
"Mic92/iana-etc", "Mic92/iana-etc",
version, "20251215",
"iana-etc-"+version+".tar.gz", "iana-etc-20251215.tar.gz",
checksum, "kvKz0gW_rGG5QaNK9ZWmWu1IEgYAdmhj_wR7DYrh3axDfIql_clGRHmelP7525NJ",
pkg.Gzip, pkg.Gzip,
) )
}
var ( var (
resolvconfPath pkg.ExecPath resolvconfPath pkg.ExecPath
+1 -1
View File
@@ -8,7 +8,7 @@ import (
) )
func TestLLVMInputs(t *testing.T) { func TestLLVMInputs(t *testing.T) {
const wantInputCount = 857 const wantInputCount = 553
_, llvm := rosa.Native().Std().MustLoad(rosa.H("llvm")) _, llvm := rosa.Native().Std().MustLoad(rosa.H("llvm"))
var n int var n int
+2 -2
View File
@@ -243,7 +243,7 @@ func (t Toolchain) New(
case stageGentoo, stageEarly: case stageGentoo, stageEarly:
name += "-boot" name += "-boot"
support = append(support, extra...) support = append(support, extra...)
support = append(support, cureEtc{}) support = append(support, NewEtc(true))
if t.stage == stageEarly { if t.stage == stageEarly {
_, a := t.MustLoad(_stage0Dist) _, a := t.MustLoad(_stage0Dist)
support = append(support, a) support = append(support, a)
@@ -289,7 +289,7 @@ mkdir -vp /work/system/bin
} }
support = slices.Concat(extra, t.S.New(t.stage-1).Append([]pkg.Artifact{ support = slices.Concat(extra, t.S.New(t.stage-1).Append([]pkg.Artifact{
cureEtc{newIANAEtc()}, NewEtc(false),
}, },
base, base,
_mksh, _mksh,