diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-11-30 20:49:12 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-11-30 20:49:12 +0900 |
| commit | 1d73ffe341b4ec3e3dc636b8a14227ce28a4c410 (patch) | |
| tree | dfaba2e840cf0e8b98bc8413ba339fffc015c3f2 | |
| parent | 32ca5e80ef2602a84521efa305f7da63b461fb03 (diff) | |
cmd/mbf: exclude from allstaging
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 <cat@gensokyo.uk>
| -rw-r--r-- | cmd/mbf/main.go | 49 |
1 files 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) @@ -823,6 +856,14 @@ func main() { }) }, ).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(""), "Target architecture (cross-compilation)", |
