10 Commits
Author SHA1 Message Date
cat cfede152c8 internal/rosa/package/go: added PMULL gate on carryless multiply test
Test / Create distribution (push) Successful in 56s
Test / Sandbox (push) Successful in 2m46s
Test / Hakurei (push) Successful in 4m26s
Test / Sandbox (race detector) (push) Successful in 5m53s
Test / Hakurei (race detector) (push) Successful in 7m9s
Test / ShareFS (push) Successful in 7m17s
Test / Flake checks (push) Successful in 1m5s
Fixes go.dev/issues/80991.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-08-25 16:27:05 +09:00
cat ce53fa9249 internal/rosa/llvm: early-runtimes for gentoo stage only
Test / Create distribution (push) Successful in 59s
Test / Sandbox (push) Successful in 3m7s
Test / Hakurei (push) Successful in 4m34s
Test / Sandbox (race detector) (push) Successful in 5m50s
Test / Hakurei (race detector) (push) Successful in 7m4s
Test / ShareFS (push) Successful in 7m21s
Test / Flake checks (push) Successful in 1m5s
This bootstrap step is not required for a native Rosa OS stage0 distribution.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-08-25 15:26:35 +09:00
cat 18ba73c957 internal/rosa: optionally load built-ins from filesystem
Test / Create distribution (push) Successful in 57s
Test / Sandbox (push) Successful in 3m15s
Test / Hakurei (push) Successful in 5m8s
Test / Sandbox (race detector) (push) Successful in 6m12s
Test / Hakurei (race detector) (push) Successful in 7m30s
Test / ShareFS (push) Successful in 7m51s
Test / Flake checks (push) Successful in 1m8s
This avoids having to rebuild cmd/mbf over and over.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-08-25 14:55:17 +09:00
cat 1c3761bb53 container: enter init path early
Test / Create distribution (push) Successful in 59s
Test / Sandbox (push) Successful in 3m0s
Test / Hakurei (push) Successful in 4m48s
Test / Sandbox (race detector) (push) Successful in 6m6s
Test / Hakurei (race detector) (push) Successful in 7m32s
Test / ShareFS (push) Successful in 7m54s
Test / Flake checks (push) Successful in 1m19s
There is generally no use case where any setup is required before init, and requiring the explicit function call is error-prone and unnecessary. It also causes trouble with packages using a similar trick. This change moves argv0 check early and makes it an import side effect. The stub will be removed in v0.5.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-08-25 14:53:29 +09:00
cat ac7abbbe3f internal/rosa: read-only access to built-ins
Test / Create distribution (push) Successful in 30s
Test / ShareFS (push) Successful in 36s
Test / Sandbox (race detector) (push) Successful in 39s
Test / Hakurei (push) Successful in 43s
Test / Sandbox (push) Successful in 44s
Test / Hakurei (race detector) (push) Successful in 49s
Test / Flake checks (push) Successful in 1m20s
This removes potential footguns caused by mutable builtins without requiring unnecessary clones.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-08-25 14:00:42 +09:00
cat 7ee5d5368d internal/rosa/package/netfilter: update git URLs
Test / Create distribution (push) Successful in 53s
Test / Sandbox (push) Successful in 2m54s
Test / Hakurei (push) Successful in 4m34s
Test / Sandbox (race detector) (push) Successful in 6m1s
Test / Hakurei (race detector) (push) Successful in 6m58s
Test / ShareFS (push) Successful in 7m20s
Test / Flake checks (push) Successful in 1m7s
These were changed for some reason, and the git protocol is no longer reachable.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-08-25 01:11:52 +09:00
cat e36f73feff internal/rosa/package/kernel: 6.18.45 to 6.18.46
Test / Create distribution (push) Successful in 1m0s
Test / Sandbox (push) Successful in 3m7s
Test / Hakurei (push) Successful in 4m57s
Test / Sandbox (race detector) (push) Successful in 6m43s
Test / Hakurei (race detector) (push) Successful in 7m55s
Test / ShareFS (push) Successful in 8m32s
Test / Flake checks (push) Successful in 1m11s
Headers bumped due to addition of IP_VS_DEST_F_AVAILABLE and IP_VS_DEST_F_OVERLOAD.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-08-24 23:23:38 +09:00
cat e9435398d0 internal/rosa/package/pkgconf: 3.0.5 to 3.0.6
Test / Create distribution (push) Successful in 54s
Test / Sandbox (push) Successful in 3m11s
Test / Hakurei (push) Successful in 5m22s
Test / Sandbox (race detector) (push) Successful in 6m25s
Test / Hakurei (race detector) (push) Successful in 7m43s
Test / ShareFS (push) Successful in 8m13s
Test / Flake checks (push) Successful in 1m7s
Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-08-24 16:49:58 +09:00
cat 7fd3e78ccb internal/rosa/package/glib: 2.89.3 to 2.89.4
Test / Create distribution (push) Successful in 55s
Test / Sandbox (push) Successful in 2m57s
Test / Hakurei (push) Successful in 5m3s
Test / Sandbox (race detector) (push) Successful in 6m26s
Test / Hakurei (race detector) (push) Successful in 7m50s
Test / ShareFS (push) Successful in 7m56s
Test / Flake checks (push) Successful in 1m10s
Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-08-24 16:49:33 +09:00
cat 1b7d7de9e7 internal/rosa/package/hakurei: 0.4.6 to 0.4.7
Test / Create distribution (push) Successful in 52s
Test / Sandbox (push) Successful in 3m14s
Test / Hakurei (push) Successful in 4m45s
Test / Sandbox (race detector) (push) Successful in 5m38s
Test / Hakurei (race detector) (push) Successful in 7m10s
Test / ShareFS (push) Successful in 6m23s
Test / Flake checks (push) Successful in 1m7s
Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-08-21 18:49:01 +09:00
49 changed files with 264 additions and 210 deletions
-4
View File
@@ -46,7 +46,6 @@ import (
"os/signal"
"syscall"
"hakurei.app/container"
"hakurei.app/ext"
"hakurei.app/message"
)
@@ -59,9 +58,6 @@ var license string
type earlyHardeningErrs struct{ yamaLSM, dumpable error }
func main() {
// early init path, skips root check and duplicate PR_SET_DUMPABLE
container.TryArgv0(nil)
log.SetFlags(0)
log.SetPrefix("hakurei: ")
msg := message.New(log.Default())
+3 -4
View File
@@ -21,7 +21,7 @@ func commandInfo(
r *rosa.Report,
) (err error) {
if len(args) == 0 {
for _, h := range rosa.Native().CollectAll() {
for _, h := range rosa.CollectAll() {
fmt.Println(h)
}
return nil
@@ -39,10 +39,9 @@ func commandInfo(
}
}
t := rosa.Native().Std()
for i, name := range args {
handle := rosa.ArtifactH(unique.Make(name))
if meta, a := t.Load(handle); meta == nil {
if meta, a := rosa.Load(handle); meta == nil {
return fmt.Errorf("unknown artifact %q", name)
} else {
var suffix string
@@ -60,7 +59,7 @@ func commandInfo(
if len(meta.Dependencies) > 0 {
mustPrint("depends on :")
for _, d := range meta.Dependencies {
_meta, _ := rosa.Native().Std().MustLoad(d)
_meta, _ := rosa.MustLoad(d)
s := _meta.Name
if _meta.Version != rosa.Unversioned {
s += "-" + _meta.Version
+7 -8
View File
@@ -21,13 +21,12 @@ import (
func TestInfo(t *testing.T) {
t.Parallel()
_t := rosa.Native().Std()
qemuMeta, _ := _t.Load(rosa.H("qemu"))
glibMeta, _ := _t.Load(rosa.H("glib"))
zlibMeta, zlib := _t.Load(rosa.H("zlib"))
zstdMeta, _ := _t.Load(rosa.H("zstd"))
hakureiMeta, _ := _t.Load(rosa.H("hakurei"))
hakureiDistMeta, _ := _t.Load(rosa.H("hakurei-dist"))
qemuMeta, _ := rosa.MustLoad(rosa.H("qemu"))
glibMeta, _ := rosa.MustLoad(rosa.H("glib"))
zlibMeta, zlib := rosa.MustLoad(rosa.H("zlib"))
zstdMeta, _ := rosa.MustLoad(rosa.H("zstd"))
hakureiMeta, _ := rosa.MustLoad(rosa.H("hakurei"))
hakureiDistMeta, _ := rosa.MustLoad(rosa.H("hakurei-dist"))
testCases := []struct {
name string
@@ -140,7 +139,7 @@ status : not in report
if tc.status != nil {
for name, status := range tc.status {
_, a := _t.Load(rosa.ArtifactH(unique.Make(name)))
_, a := rosa.Load(rosa.ArtifactH(unique.Make(name)))
if a == nil {
t.Fatalf("invalid name %q", name)
}
+1 -1
View File
@@ -30,7 +30,7 @@ var (
// handleInfo writes constant system information.
func handleInfo(w http.ResponseWriter, _ *http.Request) {
infoPayloadOnce.Do(func() {
infoPayload.Count = len(rosa.Native().Collect())
infoPayload.Count = len(rosa.Collect())
infoPayload.HakureiVersion = info.Version()
})
// TODO(mae): cache entire response if no additional fields are planned
+2 -2
View File
@@ -31,7 +31,7 @@ func TestAPIInfo(t *testing.T) {
checkPayload(t, resp, struct {
Count int `json:"count"`
HakureiVersion string `json:"hakurei_version"`
}{len(rosa.Native().Collect()), info.Version()})
}{len(rosa.Collect()), info.Version()})
}
func TestAPIGet(t *testing.T) {
@@ -92,7 +92,7 @@ func TestAPIGet(t *testing.T) {
)
})
count := len(rosa.Native().Collect())
count := len(rosa.Collect())
t.Run("index", func(t *testing.T) {
t.Parallel()
checkValidate(
+2 -2
View File
@@ -56,12 +56,12 @@ func (index *packageIndex) populate(report *rosa.Report) (err error) {
index.handleAccess = report.HandleAccess
}
handles := rosa.Native().Collect()
handles := rosa.Collect()
work := make([]*metadata, len(handles))
index.names = make(map[string]*metadata)
ir := pkg.NewIR()
for i, handle := range handles {
meta, a := rosa.Native().Std().MustLoad(handle)
meta, a := rosa.MustLoad(handle)
m := metadata{
handle: handle,
+32 -30
View File
@@ -37,7 +37,6 @@ import (
"hakurei.app/check"
"hakurei.app/command"
"hakurei.app/container"
"hakurei.app/ext"
"hakurei.app/fhs"
"hakurei.app/internal/pkg"
@@ -48,6 +47,11 @@ import (
"hakurei.app/cmd/mbf/internal/pkgserver/ui"
)
// builtin contains native and embedded [rosa.Artifact] registrations.
//
//go:linkname builtin hakurei.app/internal/rosa.builtin
var builtin rosa.S
// writeFileExcl is like [os.WriteFile], but sets [os.O_EXCL] instead.
func writeFileExcl(name string, data []byte, perm os.FileMode) error {
f, err := os.OpenFile(name, os.O_WRONLY|os.O_CREATE|os.O_EXCL, perm)
@@ -62,8 +66,6 @@ func writeFileExcl(name string, data []byte, perm os.FileMode) error {
}
func main() {
container.TryArgv0(nil)
log.SetFlags(0)
log.SetPrefix("mbf: ")
msg := message.New(log.Default())
@@ -114,7 +116,7 @@ func main() {
addr net.UnixAddr
)
c := command.New(os.Stderr, log.Printf, "mbf", func([]string) error {
if !rosa.Native().HasStageEarly() {
if !rosa.HasStageEarly() {
return pkg.UnsupportedArchError(runtime.GOARCH)
}
@@ -141,13 +143,13 @@ func main() {
if !flagCheck {
flags |= rosa.OptSkipCheck
}
if !flagLTO {
flags |= rosa.OptLLVMNoLTO
if flagLTO {
flags |= rosa.OptToolchainLTO
}
rosa.Native().DropCaches("", flags)
builtin.DropCaches("", flags)
cross := flagArch != "" && flagArch != runtime.GOARCH
if flagQEMU || cross {
_, cm.qemu = rosa.Native().Std().MustLoad(rosa.H("qemu"))
_, cm.qemu = rosa.MustLoad(rosa.H("qemu"))
}
if cross {
@@ -155,14 +157,14 @@ func main() {
flags = flagCrossOverride
}
rosa.Native().DropCaches(flagArch, flags)
if !rosa.Native().HasStageEarly() {
builtin.DropCaches(flagArch, flags)
if !rosa.HasStageEarly() {
return pkg.UnsupportedArchError(flagArch)
}
}
if flagSourcePath != "" {
if err := rosa.Native().SetSource(os.DirFS(flagSourcePath)); err != nil {
if err := builtin.SetSource(os.DirFS(flagSourcePath)); err != nil {
return err
}
}
@@ -173,7 +175,7 @@ func main() {
return err
} else if root, err = os.OpenRoot(a.String()); err != nil {
return err
} else if err = rosa.Native().RegisterFS(root.FS()); err != nil {
} else if err = builtin.RegisterFS(root.FS()); err != nil {
return err
}
}
@@ -432,7 +434,7 @@ func main() {
for range max(flagJobs, 1) {
wg.Go(func() {
for p := range w {
meta, _ := rosa.Native().Std().MustLoad(p)
meta, _ := rosa.MustLoad(p)
if meta.ID == 0 {
continue
}
@@ -462,7 +464,7 @@ func main() {
}
done:
for _, p := range rosa.Native().CollectAll() {
for _, p := range rosa.CollectAll() {
select {
case w <- p:
break
@@ -490,8 +492,8 @@ func main() {
}
c.NewCommand("blocked", command.UsageInternal, func([]string) error {
for _, p := range rosa.Native().CollectAll() {
meta, _ := rosa.Native().Std().Load(p)
for _, p := range rosa.CollectAll() {
meta, _ := rosa.Load(p)
if meta.Blocked != "" {
fmt.Printf("%s: %s\n", meta.Name, meta.Blocked)
}
@@ -631,7 +633,7 @@ func main() {
_llvm := rosa.H("llvm")
if err = cm.Do(func(cache *pkg.Cache) (err error) {
_, llvm := rosa.Native().New(rosa.Std - 2).Load(_llvm)
_, llvm := rosa.MustLoadAt(rosa.Std-2, _llvm)
pathname, _, err = cache.Cure(llvm)
return
}); err != nil {
@@ -640,7 +642,7 @@ func main() {
log.Println("stage1:", pathname)
if err = cm.Do(func(cache *pkg.Cache) (err error) {
_, llvm := rosa.Native().New(rosa.Std - 1).Load(_llvm)
_, llvm := rosa.MustLoadAt(rosa.Std-1, _llvm)
pathname, _, err = cache.Cure(llvm)
return
}); err != nil {
@@ -649,7 +651,7 @@ func main() {
log.Println("stage2:", pathname)
if err = cm.Do(func(cache *pkg.Cache) (err error) {
_, llvm := rosa.Native().New(rosa.Std).Load(_llvm)
_, llvm := rosa.MustLoadAt(rosa.Std, _llvm)
pathname, checksum[0], err = cache.Cure(llvm)
return
}); err != nil {
@@ -658,7 +660,7 @@ func main() {
log.Println("stage3:", pathname)
if err = cm.Do(func(cache *pkg.Cache) (err error) {
_, llvm := rosa.Native().New(rosa.Stage3).Load(_llvm)
_, llvm := rosa.MustLoadAt(rosa.Stage3, _llvm)
pathname, checksum[1], err = cache.Cure(llvm)
return
}); err != nil {
@@ -686,10 +688,10 @@ func main() {
"all",
command.UsageInternal,
func([]string) error {
all := rosa.Native().CollectAll()
all := rosa.CollectAll()
a := make(pkg.Collect, len(all))
for i, h := range all {
_, a[i] = rosa.Native().Std().Load(h)
_, a[i] = rosa.Load(h)
}
return cm.Do(func(cache *pkg.Cache) (err error) {
_, _, err = cache.Cure(&a)
@@ -740,12 +742,12 @@ func main() {
return err
}
}
rosa.Native().SetGentooStage3(flagGentoo, checksum)
builtin.SetGentooStage3(flagGentoo, checksum)
t -= 3 // magic number to discourage misuse
}
_, a := rosa.Native().New(t).Load(rosa.ArtifactH(unique.Make(args[0])))
_, a := rosa.LoadAt(t, rosa.ArtifactH(unique.Make(args[0])))
if a == nil {
return fmt.Errorf("unknown artifact %q", args[0])
}
@@ -965,7 +967,7 @@ func main() {
return errors.New("validate must rebuild at least twice")
}
_, a := rosa.Native().New(stage).Load(rosa.ArtifactH(unique.Make(args[1])))
_, a := rosa.LoadAt(stage, rosa.ArtifactH(unique.Make(args[1])))
if a == nil {
return fmt.Errorf("unknown artifact %q", args[1])
}
@@ -1051,7 +1053,7 @@ func main() {
"Remove identifiers not reachable by loaded packages",
func([]string) error {
return cm.Do(func(cache *pkg.Cache) error {
t := rosa.Native().Clone().Std()
t := rosa.New().Std()
handles := t.CollectAll()
flags := t.Flags()
@@ -1061,7 +1063,7 @@ func main() {
continue
}
t.DropCaches(arch, rosa.OptLLVMNoLTO|rosa.OptSkipCheck)
t.DropCaches(arch, rosa.OptSkipCheck)
a = t.Append(a, handles...)
t.DropCaches(arch, flags)
a = t.Append(a, handles...)
@@ -1117,7 +1119,7 @@ func main() {
handles := make([]rosa.ArtifactH, len(args), len(args)+3)
for i, arg := range args {
handles[i] = rosa.ArtifactH(unique.Make(arg))
if meta, _ := rosa.Native().Std().Load(handles[i]); meta == nil {
if meta, _ := rosa.Load(handles[i]); meta == nil {
return fmt.Errorf("unknown artifact %q", arg)
}
}
@@ -1134,14 +1136,14 @@ func main() {
root := make(pkg.Collect, 0, 6+len(args))
root = append(root, rosa.NewEtc(false))
root = rosa.Native().Std().Append(root, handles...)
root = builtin.Std().Append(root, handles...)
return cm.Do(func(cache *pkg.Cache) error {
return cache.EnterExec(
ctx,
pkg.NewExec(
"",
rosa.Native().Arch(),
builtin.Arch(),
new(pkg.Checksum),
1,
flagNet,
+2 -7
View File
@@ -8,11 +8,6 @@ import (
"hakurei.app/internal/rosa"
)
func TestMain(m *testing.M) {
rosa.Native().DropCaches("", rosa.OptLLVMNoLTO)
os.Exit(m.Run())
}
func TestCureAll(t *testing.T) {
t.Parallel()
const env = "ROSA_TEST_DAEMON"
@@ -35,8 +30,8 @@ func TestCureAll(t *testing.T) {
}
})
for _, handle := range rosa.Native().Collect() {
_, a := rosa.Native().Std().MustLoad(handle)
for _, handle := range rosa.Collect() {
_, a := rosa.MustLoad(handle)
t.Run(handle.String(), func(t *testing.T) {
_, err := cureRemote(t.Context(), &addr, a, 0)
if err != nil {
-1
View File
@@ -287,7 +287,6 @@ func unsafeAddArgument(args *fuseArgs, arg string) {
func _main(s ...string) (exitCode int) {
msg := message.New(log.Default())
container.TryArgv0(msg)
runtime.LockOSThread()
// don't mask creation mode, kernel already did that
-3
View File
@@ -1,15 +1,12 @@
package container
import (
"encoding/gob"
"fmt"
"hakurei.app/check"
"hakurei.app/fhs"
)
func init() { gob.Register(new(AutoEtcOp)) }
// Etc is a helper for appending [AutoEtcOp] to [Ops].
func (f *Ops) Etc(host *check.Absolute, prefix string) *Ops {
e := &AutoEtcOp{prefix}
-3
View File
@@ -1,7 +1,6 @@
package container
import (
"encoding/gob"
"fmt"
"hakurei.app/check"
@@ -9,8 +8,6 @@ import (
"hakurei.app/message"
)
func init() { gob.Register(new(AutoRootOp)) }
// Root is a helper for appending [AutoRootOp] to [Ops].
func (f *Ops) Root(host *check.Absolute, flags int) *Ops {
*f = append(*f, &AutoRootOp{host, flags, nil})
-5
View File
@@ -37,9 +37,6 @@ import (
// Note: this package requires cgo, which is unavailable in the Go playground.
func Example() {
// Must be called early if the current process starts containers.
container.TryArgv0(nil)
// Configure the container.
z := container.New(context.Background(), nil)
z.Hostname = "hakurei-example"
@@ -876,8 +873,6 @@ var (
var helperCommands []func(c command.Command)
func TestMain(m *testing.M) {
container.TryArgv0(nil)
if os.Getenv(envDoCheck) == "1" {
c := command.New(os.Stderr, log.Printf, "helper", func(args []string) error {
log.SetFlags(0)
+30 -10
View File
@@ -2,6 +2,7 @@ package container
import (
"context"
"encoding/gob"
"errors"
"fmt"
"log"
@@ -130,7 +131,7 @@ type initParams struct {
Verbose bool
}
// Init is called by [TryArgv0] if the current process is the container init.
// Init is called if the current process is the container init.
func Init(msg message.Msg) { initEntrypoint(direct{}, msg) }
func initEntrypoint(k syscallDispatcher, msg message.Msg) {
@@ -642,18 +643,37 @@ func initEntrypoint(k syscallDispatcher, msg message.Msg) {
// initName is the prefix used by log.std in the init process.
const initName = "init"
// TryArgv0 calls [Init] if the last element of argv0 is "init".
// If a nil msg is passed, the system logger is used instead.
func TryArgv0(msg message.Msg) {
if msg == nil {
log.SetPrefix(initName + ": ")
log.SetFlags(0)
msg = message.New(log.Default())
var _ = func() struct{} {
for _, v := range []any{
(*AutoEtcOp)(nil),
(*AutoRootOp)(nil),
(*BindMountOp)(nil),
(*DaemonOp)(nil),
(*MkdirOp)(nil),
(*MountDevOp)(nil),
(*MountOverlayOp)(nil),
(*MountProcOp)(nil),
(*MountTmpfsOp)(nil),
(*RemountOp)(nil),
(*SymlinkOp)(nil),
(*TmpfileOp)(nil),
} {
gob.Register(v)
}
if len(os.Args) > 0 && filepath.Base(os.Args[0]) == initName {
if len(os.Args) == 1 && filepath.Base(os.Args[0]) == initName {
log.SetPrefix(initName + ": ")
log.SetFlags(0)
msg := message.New(log.Default())
Init(msg)
msg.BeforeExit()
os.Exit(0)
}
}
return struct{}{}
}()
// TryArgv0 is a noop.
//
// Deprecated: init is now implemented as an import side effect.
func TryArgv0(_ message.Msg) {}
-3
View File
@@ -1,7 +1,6 @@
package container
import (
"encoding/gob"
"fmt"
"os"
"syscall"
@@ -10,8 +9,6 @@ import (
"hakurei.app/container/std"
)
func init() { gob.Register(new(BindMountOp)) }
// Bind is a helper for appending [BindMountOp] to [Ops].
func (f *Ops) Bind(source, target *check.Absolute, flags int) *Ops {
*f = append(*f, &BindMountOp{nil, source, target, flags})
-3
View File
@@ -2,7 +2,6 @@ package container
import (
"context"
"encoding/gob"
"errors"
"fmt"
"os"
@@ -16,8 +15,6 @@ import (
"hakurei.app/fhs"
)
func init() { gob.Register(new(DaemonOp)) }
const (
// daemonTimeout is the duration a [DaemonOp] is allowed to block before the
// [DaemonOp.Target] marker becomes available.
-3
View File
@@ -1,7 +1,6 @@
package container
import (
"encoding/gob"
"fmt"
"path/filepath"
. "syscall"
@@ -10,8 +9,6 @@ import (
"hakurei.app/fhs"
)
func init() { gob.Register(new(MountDevOp)) }
// Dev appends an [Op] that mounts a subset of host /dev.
func (f *Ops) Dev(target *check.Absolute, mqueue bool) *Ops {
*f = append(*f, &MountDevOp{target, mqueue, false})
-3
View File
@@ -1,15 +1,12 @@
package container
import (
"encoding/gob"
"fmt"
"os"
"hakurei.app/check"
)
func init() { gob.Register(new(MkdirOp)) }
// Mkdir is a helper for appending [MkdirOp] to [Ops].
func (f *Ops) Mkdir(name *check.Absolute, perm os.FileMode) *Ops {
*f = append(*f, &MkdirOp{name, perm})
-3
View File
@@ -1,7 +1,6 @@
package container
import (
"encoding/gob"
"fmt"
"slices"
@@ -19,8 +18,6 @@ const (
intermediatePatternOverlayWork = "overlay.work.*"
)
func init() { gob.Register(new(MountOverlayOp)) }
const (
// OverlayEphemeralUnexpectedUpper is set when [MountOverlayOp.Work] is nil
// and [MountOverlayOp.Upper] holds an unexpected value.
-3
View File
@@ -1,7 +1,6 @@
package container
import (
"encoding/gob"
"fmt"
"syscall"
@@ -14,8 +13,6 @@ const (
intermediatePatternTmpfile = "tmp.*"
)
func init() { gob.Register(new(TmpfileOp)) }
// Place is a helper for appending [TmpfileOp] to [Ops].
func (f *Ops) Place(name *check.Absolute, data []byte) *Ops {
*f = append(*f, &TmpfileOp{name, data})
-3
View File
@@ -1,15 +1,12 @@
package container
import (
"encoding/gob"
"fmt"
. "syscall"
"hakurei.app/check"
)
func init() { gob.Register(new(MountProcOp)) }
// Proc is a helper for appending [MountProcOp] to [Ops].
func (f *Ops) Proc(target *check.Absolute) *Ops {
*f = append(*f, &MountProcOp{target})
-3
View File
@@ -1,14 +1,11 @@
package container
import (
"encoding/gob"
"fmt"
"hakurei.app/check"
)
func init() { gob.Register(new(RemountOp)) }
// Remount is a helper for appending [RemountOp] to [Ops].
func (f *Ops) Remount(target *check.Absolute, flags uintptr) *Ops {
*f = append(*f, &RemountOp{target, flags})
-3
View File
@@ -1,15 +1,12 @@
package container
import (
"encoding/gob"
"fmt"
"path/filepath"
"hakurei.app/check"
)
func init() { gob.Register(new(SymlinkOp)) }
// Link appends an [Op] that creates a symlink in the container filesystem.
func (f *Ops) Link(target *check.Absolute, linkName string, dereference bool) *Ops {
*f = append(*f, &SymlinkOp{target, linkName, dereference})
-3
View File
@@ -1,7 +1,6 @@
package container
import (
"encoding/gob"
"fmt"
"math"
"os"
@@ -11,8 +10,6 @@ import (
"hakurei.app/check"
)
func init() { gob.Register(new(MountTmpfsOp)) }
type TmpfsSizeError int
func (e TmpfsSizeError) Error() string {
+1 -2
View File
@@ -4,8 +4,7 @@ import (
"os"
"testing"
"hakurei.app/container"
"hakurei.app/internal/helper"
)
func TestMain(m *testing.M) { container.TryArgv0(nil); helper.InternalHelperStub(); os.Exit(m.Run()) }
func TestMain(m *testing.M) { helper.InternalHelperStub(); os.Exit(m.Run()) }
+1 -2
View File
@@ -4,8 +4,7 @@ import (
"os"
"testing"
"hakurei.app/container"
"hakurei.app/internal/helper"
)
func TestMain(m *testing.M) { container.TryArgv0(nil); helper.InternalHelperStub(); os.Exit(m.Run()) }
func TestMain(m *testing.M) { helper.InternalHelperStub(); os.Exit(m.Run()) }
-2
View File
@@ -85,8 +85,6 @@ func newRContext(tb testing.TB, c *pkg.Cache) *pkg.RContext {
return &r
}
func TestMain(m *testing.M) { container.TryArgv0(nil); os.Exit(m.Run()) }
// overrideIdent overrides the ID method of [Artifact].
type overrideIdent struct {
id pkg.ID
+65 -1
View File
@@ -1,10 +1,13 @@
package rosa
import (
"io/fs"
"os"
"path"
"slices"
"strconv"
"strings"
"time"
"hakurei.app/internal/pkg"
)
@@ -25,7 +28,7 @@ const (
loadFlagE = `"-l$` + pkg.EnvLoad + `"`
)
// newTar wraps [pkg.NewHTTPGetTar] with a simpler function signature.
// newTar is a helper for downloading compressed tarballs.
func newTar(url, checksum string, compress uint32) pkg.Artifact {
return pkg.NewTar(
pkg.NewDecompress(
@@ -114,3 +117,64 @@ func skipGNUTests(tests ...int64) string {
}
return buf.String()
}
var (
// builtin contains native and embedded [Artifact] registrations.
builtin S
// parseTime is the duration of early parsing of built-in azalea expressions.
parseTime time.Duration
)
// ParseTime returns the time taken by early parsing of built-in azalea expressions.
func ParseTime() time.Duration { return parseTime }
func init() {
sub, err := fs.Sub(builtinAzalea, "package")
if err != nil {
panic(err)
}
t := time.Now()
if err = builtin.RegisterFS(sub); err != nil {
println(err.Error())
os.Exit(1)
}
parseTime = time.Since(t)
}
// New returns the address of a newly populated [S] derived from built-ins.
func New() *S { return builtin.Clone() }
// Collect returns all built-in non-excluded [ArtifactH].
func Collect() (handles P) { return builtin.Collect() }
// CollectAll returns all built-in [ArtifactH].
func CollectAll() (handles P) { return builtin.CollectAll() }
// builtinStd is the [Std] toolchain stage on builtin.
var builtinStd = builtin.Std()
// Load satisfies an [Artifact] referred to by an [ArtifactH].
func Load(handle ArtifactH) (*Metadata, pkg.Artifact) {
return builtinStd.Load(handle)
}
// LoadAt satisfies an [Artifact] referred to by an [ArtifactH] at the
// specified stage.
func LoadAt(stage Stage, handle ArtifactH) (*Metadata, pkg.Artifact) {
return builtin.New(stage).Load(handle)
}
// MustLoad is like Load, but panics if the named [Artifact] is not registered.
func MustLoad(handle ArtifactH) (*Metadata, pkg.Artifact) {
return builtinStd.MustLoad(handle)
}
// MustLoadAt is like LoadAt, but panics if the named [Artifact] is not
// registered.
func MustLoadAt(stage Stage, handle ArtifactH) (*Metadata, pkg.Artifact) {
return builtin.New(stage).MustLoad(handle)
}
// HasStageEarly returns whether a stage0 distribution is available.
func HasStageEarly() (ok bool) { return builtin.HasStageEarly() }
+11
View File
@@ -0,0 +1,11 @@
//go:build !penv
package rosa
import "embed"
// builtinAzalea is the backing directory of built-in azalea-based [Artifact]
// implementations.
//
//go:embed package
var builtinAzalea embed.FS
+28
View File
@@ -0,0 +1,28 @@
//go:build penv
package rosa
import (
"io/fs"
"os"
)
// builtinAzalea is the backing directory of built-in azalea-based [Artifact]
// implementations.
var builtinAzalea = func() fs.FS {
const name = "ROSA_SOURCE"
pathname, ok := os.LookupEnv(name)
if !ok {
println(name + " not set")
os.Exit(1)
}
root, err := os.OpenRoot(pathname)
if err != nil {
println(err.Error())
os.Exit(1)
}
return root.FS()
}()
+1 -1
View File
@@ -66,7 +66,7 @@ func init() {
Version: version,
Exclude: true,
}
native.MustRegister(meta.Name, func(t Toolchain) (*Metadata, pkg.Artifact) {
builtin.MustRegister(meta.Name, func(t Toolchain) (*Metadata, pkg.Artifact) {
var (
bootstrapEnv []string
bootstrapEarly []pkg.Artifact
+3 -3
View File
@@ -48,7 +48,7 @@ func litArgs(verbose bool, skipChecks ...string) string {
}
func init() {
native.MustRegister("llvm", func(t Toolchain) (*Metadata, pkg.Artifact) {
builtin.MustRegister("llvm", func(t Toolchain) (*Metadata, pkg.Artifact) {
meta := Metadata{
Name: "llvm",
Description: "a collection of modular and reusable compiler and toolchain technologies",
@@ -64,7 +64,7 @@ func init() {
meta.Version = _meta.Version
early := _muslHeaders
if t.stage.isStage0() {
if t.stage.isStage0() && !t.stage.isRosa() {
// The LLVM build system uses the system installation when building with
// LLVM_LINK_LLVM_DYLIB, since it builds runtimes after the fact, using
// the just-built toolchain. This is unacceptable in stage0 due to the
@@ -168,7 +168,7 @@ func init() {
)
}
if t.opts&OptLLVMNoLTO == 0 {
if t.opts&OptToolchainLTO != 0 {
cache = append(cache, []KV{
// very expensive
{"LLVM_ENABLE_LTO", "Thin"},
+2 -2
View File
@@ -8,9 +8,9 @@ import (
)
func TestLLVMInputs(t *testing.T) {
const wantInputCount = 470
const wantInputCount = 466
_, llvm := rosa.Native().Std().MustLoad(rosa.H("llvm"))
_, llvm := rosa.MustLoad(rosa.H("llvm"))
var n int
for range pkg.Inputs(llvm) {
n++
+2 -2
View File
@@ -3,11 +3,11 @@ package glib {
website = "https://developer.gnome.org/glib";
anitya = 10024;
version# = "2.89.3";
version# = "2.89.4";
source = remoteGit {
url = "https://gitlab.gnome.org/GNOME/glib.git";
tag = version;
checksum = "eM9KrXwhwKiZferwrILKmDeq-IGnSjr0EKqV90EEVl0Ee82QVcyVSf2LDMROHcOF";
checksum = "I_nTEVp4rpOQ4VCmJpesjvq3VbFJ3oLRAUVvsdJEfFiY4XXsvi0ITTqCEWe9Lr47";
};
files = {
+24
View File
@@ -0,0 +1,24 @@
From fa10bbcce5635dd533ba933252e9dabd8a7f5e2a Mon Sep 17 00:00:00 2001
From: David Chase <drchase@google.com>
Date: Mon, 24 Aug 2026 15:20:40 -0400
Subject: [PATCH] simd/archsimd: added PMULL gate on carryless multiply test
Fixes #80991.
Change-Id: I637de72acbb338c4c3b0a47f4a5520c33fe81fd2
---
diff --git a/src/simd/archsimd/internal/simd_test/simd_arm64_test.go b/src/simd/archsimd/internal/simd_test/simd_arm64_test.go
index f009488..7836fc8 100644
--- a/src/simd/archsimd/internal/simd_test/simd_arm64_test.go
+++ b/src/simd/archsimd/internal/simd_test/simd_arm64_test.go
@@ -22,6 +22,9 @@
}
func TestClMul(t *testing.T) {
+ if !archsimd.ARM64.PMULL() {
+ t.Skip("no carryless multiply")
+ }
var x = archsimd.LoadUint64x2([]uint64{1, 5})
var y = archsimd.LoadUint64x2([]uint64{3, 9})
@@ -9,6 +9,7 @@ package go {
checksum = "Ookl2vP6KMfJuxaxX6nXZ1gnL43wZPl5GjpVsrI7IJiB4b3xr1PbnbYIOJ8v5jzG";
compress = gzip;
};
patches = [ "820480.patch" ];
env = [
"CC=cc",
+2 -2
View File
@@ -2,11 +2,11 @@ package hakurei-source {
description = "hakurei source tree";
exclude = true;
version# = "0.4.6";
version# = "0.4.7";
output = remoteTar {
url = "https://git.gensokyo.uk/rosa/hakurei/archive/"+
"v"+version+".tar.gz";
checksum = "2HxvdykuSSymAu-c1WIwQAy3qT4dDm8B--93iL4uomBlBC8wfSWldbvPF1noNkUC";
checksum = "yQd4LLMn16rYOVH2Dj6L_J64aB9aowDHPwoHHBIPeJK3m3stm5ienh0NzUCAWmed";
compress = gzip;
};
}
+1 -1
View File
@@ -1,6 +1,6 @@
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86 6.18.45 Kernel Configuration
# Linux/x86 6.18.46 Kernel Configuration
#
CONFIG_CC_VERSION_TEXT="clang version 22.1.8"
CONFIG_GCC_VERSION=0
+1 -1
View File
@@ -1,6 +1,6 @@
#
# Automatically generated file; DO NOT EDIT.
# Linux/arm64 6.18.45 Kernel Configuration
# Linux/arm64 6.18.46 Kernel Configuration
#
CONFIG_CC_VERSION_TEXT="clang version 22.1.8"
CONFIG_GCC_VERSION=0
+5 -5
View File
@@ -3,11 +3,11 @@ package kernel-source {
website = "https://kernel.org";
exclude = true;
version# = "6.18.45";
version# = "6.18.46";
output = remoteTar {
url = "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/"+
"snapshot/linux-"+version+".tar.gz";
checksum = "yI15OXBcDSWVnozq7ilLiiKMbn2xGIuZWa73luYAjcHK12e8R9n_n_am43hnhNAZ";
checksum = "C6uswsH1qZzKIeBOW6HjX-Ddp15SJPjNviSZjiTizwGrIK_5xahZpS_pC933G1y1";
compress = gzip;
};
}
@@ -46,9 +46,9 @@ cat \
checksum = arch {
default = "";
amd64 = "vN5Ts9yAlHTntcQcNGJSisY5guYsYfvGnQqI1NzTBzvhBMPD432WB3B0KFGYQntA";
arm64 = "FQtpqCA0tlz17RJP8a5t9YEM_6F9kGPqQ9Z60gFrkVP3v8_P-Vnf5S7wLlxyRlOe";
riscv64 = "U5yQ9TI5_7diyrCcm2Iqh3XCMl0P60oQGeDMWxt3OQ91zFWPQ5FCH-eoYG9tSTMT";
amd64 = "uwTZX3iLp6iPsR0-F0Jz2aUviLMMqv4xGQHoKeemo2HrNLD7fDlIDqqYT--i_5HJ";
arm64 = "A9EWzTGEChVLJVm5BP1GzpibdUddXUN2hIjAGkD-KQr5sc6RuEeIQle8VAiAYUqp";
riscv64 = "IB1oG3tEAN15wjYl8S5ekYXVFYN7-rb3m2f1Kdi58dGqnrIBTG2r1qb1utb5D1lb";
};
inputs = [ rsync ];
}
+1 -1
View File
@@ -1,6 +1,6 @@
#
# Automatically generated file; DO NOT EDIT.
# Linux/riscv 6.18.45 Kernel Configuration
# Linux/riscv 6.18.46 Kernel Configuration
#
CONFIG_CC_VERSION_TEXT="clang version 22.1.8"
CONFIG_GCC_VERSION=0
+2 -2
View File
@@ -1,5 +1,5 @@
#define LINUX_VERSION_CODE 397868
#define LINUX_VERSION_CODE 397870
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + ((c) > 255 ? 255 : (c)))
#define LINUX_VERSION_MAJOR 6
#define LINUX_VERSION_PATCHLEVEL 18
#define LINUX_VERSION_SUBLEVEL 44
#define LINUX_VERSION_SUBLEVEL 46
+2 -2
View File
@@ -31,7 +31,7 @@ package libnftnl {
version# = "1.3.1";
source = remoteGit {
url = "git://git.netfilter.org/libnftnl";
url = "https://git.netfilter.org/libnftnl.git";
tag = "libnftnl-"+version;
checksum = "91ou66K-I17iX6DB6hiQkhhC_v4DFW5iDGzwjVRNbJNEmKqowLZBlh3FY-ZDO0r9";
};
@@ -66,7 +66,7 @@ package iptables {
version# = "1.8.13";
source = remoteGit {
url = "git://git.netfilter.org/iptables";
url = "https://git.netfilter.org/iptables.git";
tag = "v"+version;
checksum = "TUA-cFIAsiMvtRR-XzQvXzoIhJUOc9J2gQDJCbBRjmgmVfGfPTCf58wL7e-cUKVQ";
};
+2 -2
View File
@@ -3,11 +3,11 @@ package pkgconf {
website = "https://github.com/pkgconf/pkgconf";
anitya = 12753;
version# = "3.0.5";
version# = "3.0.6";
source = remoteGitHub {
suffix = "pkgconf/pkgconf";
tag = "pkgconf-"+version;
checksum = "ZWak6fggXCzZkROSnSrl9twRRV9OJA7Q4DamFKEm094e2vgf_99gCxkmrZP3VFYH";
checksum = "2BY20A8o2LTp6qa5MNsH_UPwkN7OGI6DBXGLqpF0g5mOKazYaCVkslFjnI81B2NI";
};
exec = meson {
+2 -2
View File
@@ -42,8 +42,8 @@ func WriteReport(msg message.Msg, w io.Writer, c *pkg.Cache) error {
zero [wordSize]byte
buf [len(pkg.ID{}) + wordSize]byte
)
t := native.Std()
for _, p := range native.Collect() {
t := builtin.Std()
for _, p := range builtin.Collect() {
meta, a := t.MustLoad(p)
if meta == nil {
return errors.New("artifact " + p.String() + " in inconsistent state")
+5 -36
View File
@@ -2,14 +2,11 @@
package rosa
import (
"embed"
"io/fs"
"os"
"slices"
"strconv"
"strings"
"sync"
"time"
"unsafe"
"hakurei.app/fhs"
@@ -132,6 +129,11 @@ const (
_stageEnd
)
// isRosa returns whether t is derived from a Rosa OS stage0.
func (t Stage) isRosa() bool {
return t >= stageEarly
}
// isStage0 returns whether t is a stage0 toolchain.
func (t Stage) isStage0() bool {
switch t {
@@ -623,36 +625,3 @@ func (attr *GenericHelper) script(t Toolchain, _ string) string {
script += attr.Install
return script
}
// native contains natively-implemented and built-in azalea-based [Artifact].
// It is generally recommended to clone this instance for custom [Artifact]
// registrations.
var native S
// Native returns the global [S].
func Native() *S { return &native }
// parseTime is the duration of early parsing of built-in azalea expressions.
var parseTime time.Duration
// ParseTime returns the time taken by early parsing of built-in azalea expressions.
func ParseTime() time.Duration { return parseTime }
// nativeB is the backing directory of built-in azalea-based [Artifact]
// implementations.
//
//go:embed package
var nativeB embed.FS
func init() {
sub, err := fs.Sub(nativeB, "package")
if err != nil {
panic(err)
}
t := time.Now()
if err = native.RegisterFS(sub); err != nil {
println(err.Error())
os.Exit(1)
}
parseTime = time.Since(t)
}
+3 -7
View File
@@ -10,7 +10,6 @@ import (
"testing"
"hakurei.app/check"
"hakurei.app/container"
"hakurei.app/internal/pkg"
"hakurei.app/internal/rosa"
"hakurei.app/message"
@@ -28,9 +27,6 @@ var (
)
func TestMain(m *testing.M) {
rosa.Native().DropCaches("", rosa.OptLLVMNoLTO)
container.TryArgv0(nil)
code := m.Run()
if buildTestCache != nil {
buildTestCacheCancel()
@@ -79,8 +75,8 @@ func TestCureAll(t *testing.T) {
cache := getCache(t)
t.Parallel()
for _, p := range rosa.Native().CollectAll() {
_, a := rosa.Native().Std().MustLoad(p)
for _, p := range rosa.CollectAll() {
_, a := rosa.MustLoad(p)
t.Run(p.String(), func(t *testing.T) {
t.Parallel()
@@ -94,7 +90,7 @@ func TestCureAll(t *testing.T) {
}
func BenchmarkStage3(b *testing.B) {
t := rosa.Native().Clone().Std()
t := rosa.New().Std()
llvm := rosa.H("llvm")
for b.Loop() {
+17 -17
View File
@@ -184,16 +184,16 @@ type cachedArtifact struct {
const (
// OptSkipCheck skips running all test suites.
OptSkipCheck = 1 << iota
// OptLLVMNoLTO disables LTO in all [LLVM] stages.
OptLLVMNoLTO
// OptToolchainLTO enables LTO in all LLVM stages.
OptToolchainLTO
)
// S holds a set of [Artifact].
type S struct {
// [ArtifactH] to [Artifact].
artifacts sync.Map
// Size of artifacts.
artifactCount atomic.Uint64
p sync.Map
// Size of p.
len atomic.Uint64
// Target architecture.
arch string
@@ -220,9 +220,9 @@ type S struct {
// Clone returns a copy of s.
func (s *S) Clone() *S {
v := S{arch: s.arch, opts: s.opts}
s.artifacts.Range(func(key, value any) bool {
v.artifacts.Store(key, value)
v.artifactCount.Add(1)
s.p.Range(func(key, value any) bool {
v.p.Store(key, value)
v.len.Add(1)
return true
})
return &v
@@ -304,7 +304,7 @@ func (s *S) DropCaches(targetArch string, flags int) {
// get returns the named [Artifact].
func (s *S) get(handle ArtifactH) (f Artifact) {
s.wantsArch()
v, ok := s.artifacts.Load(handle)
v, ok := s.p.Load(handle)
if ok {
f = v.(Artifact)
}
@@ -393,9 +393,9 @@ func (s *S) Register(name string, f Artifact) bool {
return false
}
p := ArtifactH(unique.Make(name))
_, ok := s.artifacts.LoadOrStore(p, f)
_, ok := s.p.LoadOrStore(p, f)
if !ok {
s.artifactCount.Add(1)
s.len.Add(1)
}
return !ok
}
@@ -418,15 +418,15 @@ func (s *S) MustRegister(name string, f Artifact) {
}
}
// count returns the number of [Artifact] registered to s.
// count returns the number of [Artifact] registered to r.
func (s *S) count() int {
return int(s.artifactCount.Load())
return int(s.len.Load())
}
// CollectAll returns all [ArtifactH] registered to s.
func (s *S) CollectAll() (handles P) {
handles = make(P, 0, s.count())
s.artifacts.Range(func(key, _ any) bool {
s.p.Range(func(key, _ any) bool {
handles = append(handles, key.(ArtifactH))
return true
})
@@ -439,7 +439,7 @@ func (s *S) CollectAll() (handles P) {
// Collect returns all non-excluded [ArtifactH] registered to s.
func (s *S) Collect() (handles P) {
handles = make(P, 0, s.count())
s.artifacts.Range(func(key, _ any) bool {
s.p.Range(func(key, _ any) bool {
h := key.(ArtifactH)
meta, _ := s.Std().MustLoad(h)
if !meta.Exclude {
@@ -453,7 +453,7 @@ func (s *S) Collect() (handles P) {
return
}
// deferredGit is a call to Toolchain.newTagRemote from azalea.
// deferredGit is a call to [Toolchain.NewViaGit] from azalea.
type deferredGit struct {
url string
tag string
@@ -1375,7 +1375,7 @@ func (s *S) SetSource(fsys fs.FS) error {
const name = "hakurei-source"
a := pkg.NewFile("hakurei-src-current.tar.gz", buf.Bytes())
s.artifacts.Store(
s.p.Store(
H(name),
Artifact(func(t Toolchain) (*Metadata, pkg.Artifact) {
return &Metadata{
+3 -3
View File
@@ -9,17 +9,17 @@ import (
func TestLoad(t *testing.T) {
t.Parallel()
for _, p := range rosa.Native().Collect() {
for _, p := range rosa.Collect() {
t.Run(p.String(), func(t *testing.T) {
t.Parallel()
rosa.Native().Std().MustLoad(p)
rosa.MustLoad(p)
})
}
}
func BenchmarkAll(b *testing.B) {
t := rosa.Native().Clone().Std()
t := rosa.New().Std()
for b.Loop() {
for _, p := range t.Collect() {
-4
View File
@@ -2,12 +2,10 @@ package ldd_test
import (
"errors"
"os"
"os/exec"
"testing"
"hakurei.app/check"
"hakurei.app/container"
"hakurei.app/ldd"
"hakurei.app/message"
)
@@ -42,5 +40,3 @@ func TestExec(t *testing.T) {
}
})
}
func TestMain(m *testing.M) { container.TryArgv0(nil); os.Exit(m.Run()) }