From 1d73ffe341b4ec3e3dc636b8a14227ce28a4c410 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Mon, 30 Nov 2026 20:49:12 +0900 Subject: cmd/mbf: exclude from all This excludes packages from all by poisoning them. The default value excludes the first rustc stage to avoid wasting 4-5 hours every toolchain update building rustc, while still being able to use all for every other package. Signed-off-by: Ophestra --- cmd/mbf/main.go | 49 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 45 insertions(+), 4 deletions(-) diff --git a/cmd/mbf/main.go b/cmd/mbf/main.go index 7ec1188a..00a76633 100644 --- a/cmd/mbf/main.go +++ b/cmd/mbf/main.go @@ -796,7 +796,11 @@ func main() { } { - var flagCross string + var ( + flagExclude string + flagShowPoison bool + flagCross string + ) c.NewCommand( "all", command.UsageInternal, @@ -809,10 +813,39 @@ func main() { } } + if flagExclude != "" { + s = s.WithPoison(strings.Split(flagExclude, ",")...) + } + all := s.CollectAll() - a := make(pkg.Collect, len(all)) - for i, h := range all { - _, a[i] = rosa.Load(h) + a := make(pkg.Collect, 0, len(all)) + t := s.Std() + for _, h := range all { + func() { + defer func() { + r := recover() + if r == nil { + return + } + + err, ok := r.(error) + if !ok { + panic(r) + } + + if e, _ok := errors.AsType[rosa.PoisonError](err); !_ok { + panic(err) + } else if flagShowPoison { + if h.String() == string(e) { + log.Printf("excluding %s", string(e)) + } else { + log.Printf("skipping %s due to %s", h, string(e)) + } + } + }() + _, p := t.Load(h) + a = append(a, p) + }() } return cm.Do(func(cache *pkg.Cache) (err error) { _, _, err = cache.Cure(&a) @@ -822,6 +855,14 @@ func main() { return }) }, + ).Flag( + &flagExclude, + "exclude", command.StringFlag("rustc-mrustc"), + "Comma-separated list of packages to exclude", + ).Flag( + &flagShowPoison, + "show-poison", command.BoolFlag(false), + "Show all excluded packages", ).Flag( &flagCross, "cross", command.StringFlag(""), -- cgit v1.3.1