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
+23 -24
View File
@@ -15,8 +15,13 @@ import (
// [Toolchain]. This silences test suites expecting certain standard files to be
// available in /etc.
type cureEtc struct {
// Optional via newIANAEtc.
iana pkg.Artifact
// Whether to exclude ianaEtc.
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.
@@ -45,8 +50,8 @@ nobody:x:65534:
}
}
if a.iana != nil {
iana, _ := t.GetArtifact(a.iana)
if !a.minimal {
iana, _ := t.GetArtifact(ianaEtc)
buf := make([]byte, syscall.Getpagesize()<<3)
for _, name := range []string{
@@ -90,7 +95,7 @@ func (cureEtc) Kind() pkg.Kind { return kindEtc }
// Params writes whether iana-etc is populated.
func (a cureEtc) Params(ctx *pkg.IContext) {
if a.iana != nil {
if !a.minimal {
ctx.WriteUint32(1)
} else {
ctx.WriteUint32(0)
@@ -100,8 +105,8 @@ func (a cureEtc) Params(ctx *pkg.IContext) {
func init() {
pkg.Register(kindEtc, func(r *pkg.IRReader) pkg.Artifact {
a := cureEtc{}
if r.ReadUint32() != 0 {
a.iana = r.Next()
if r.ReadUint32() == 0 {
a.minimal = true
}
if _, ok := r.Finalise(); ok {
panic(pkg.ErrUnexpectedChecksum)
@@ -115,34 +120,28 @@ func (cureEtc) IsExclusive() bool { return false }
// Dependencies returns a slice containing the backing iana-etc release.
func (a cureEtc) Dependencies() []pkg.Artifact {
if a.iana != nil {
return []pkg.Artifact{a.iana}
if !a.minimal {
return []pkg.Artifact{ianaEtc}
}
return nil
}
// String returns a hardcoded reporting name.
func (a cureEtc) String() string {
if a.iana == nil {
if a.minimal {
return "cure-etc-minimal"
}
return "cure-etc"
}
// newIANAEtc returns an unpacked iana-etc release.
func newIANAEtc() pkg.Artifact {
const (
version = "20251215"
checksum = "kvKz0gW_rGG5QaNK9ZWmWu1IEgYAdmhj_wR7DYrh3axDfIql_clGRHmelP7525NJ"
)
return newFromGitHubRelease(
"Mic92/iana-etc",
version,
"iana-etc-"+version+".tar.gz",
checksum,
pkg.Gzip,
)
}
// ianaEtc is an unpacked iana-etc release.
var ianaEtc = newFromGitHubRelease(
"Mic92/iana-etc",
"20251215",
"iana-etc-20251215.tar.gz",
"kvKz0gW_rGG5QaNK9ZWmWu1IEgYAdmhj_wR7DYrh3axDfIql_clGRHmelP7525NJ",
pkg.Gzip,
)
var (
resolvconfPath pkg.ExecPath
+1 -1
View File
@@ -8,7 +8,7 @@ import (
)
func TestLLVMInputs(t *testing.T) {
const wantInputCount = 857
const wantInputCount = 553
_, llvm := rosa.Native().Std().MustLoad(rosa.H("llvm"))
var n int
+2 -2
View File
@@ -243,7 +243,7 @@ func (t Toolchain) New(
case stageGentoo, stageEarly:
name += "-boot"
support = append(support, extra...)
support = append(support, cureEtc{})
support = append(support, NewEtc(true))
if t.stage == stageEarly {
_, a := t.MustLoad(_stage0Dist)
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{
cureEtc{newIANAEtc()},
NewEtc(false),
},
base,
_mksh,