From a71a008f3c8324ab394e451b852cd9b21f072fab Mon Sep 17 00:00:00 2001 From: Ophestra Date: Sun, 3 May 2026 18:46:47 +0900 Subject: [PATCH] cmd/mbf: optionally build on early stages This makes debugging the bootstrap process much less cumbersome. Signed-off-by: Ophestra --- cmd/mbf/main.go | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/cmd/mbf/main.go b/cmd/mbf/main.go index 291e91ef..44dd7b32 100644 --- a/cmd/mbf/main.go +++ b/cmd/mbf/main.go @@ -471,6 +471,9 @@ func main() { flagExport string flagRemote bool flagNoReply bool + + flagBoot bool + flagStd bool ) c.NewCommand( "cure", @@ -484,11 +487,18 @@ func main() { return fmt.Errorf("unknown artifact %q", args[0]) } + t := rosa.Std + if flagBoot { + t -= 2 + } else if flagStd { + t -= 1 + } + switch { default: var pathname *check.Absolute err := cm.Do(func(cache *pkg.Cache) (err error) { - pathname, _, err = cache.Cure(rosa.Std.Load(p)) + pathname, _, err = cache.Cure(t.Load(p)) return }) if err != nil { @@ -541,7 +551,7 @@ func main() { return cm.Do(func(cache *pkg.Cache) error { return cache.EnterExec( ctx, - rosa.Std.Load(p), + t.Load(p), true, os.Stdin, os.Stdout, os.Stderr, rosa.AbsSystem.Append("bin", "mksh"), "sh", @@ -553,7 +563,7 @@ func main() { if flagNoReply { flags |= remoteNoReply } - a := rosa.Std.Load(p) + a := t.Load(p) pathname, err := cureRemote(ctx, &addr, a, flags) if !flagNoReply && err == nil { log.Println(pathname) @@ -591,6 +601,14 @@ func main() { &flagNoReply, "no-reply", command.BoolFlag(false), "Do not receive a reply from the daemon", + ).Flag( + &flagBoot, + "boot", command.BoolFlag(false), + "Build on the stage0 toolchain", + ).Flag( + &flagStd, + "std", command.BoolFlag(false), + "Build on the intermediate toolchain", ) }