cmd/mbf: garbage collection commands
All checks were successful
Test / Create distribution (push) Successful in 1m29s
Test / Sandbox (push) Successful in 2m43s
Test / ShareFS (push) Successful in 3m55s
Test / Hakurei (push) Successful in 4m3s
Test / Sandbox (race detector) (push) Successful in 8m34s
Test / Hakurei (race detector) (push) Successful in 11m35s
Test / Flake checks (push) Successful in 8m40s
All checks were successful
Test / Create distribution (push) Successful in 1m29s
Test / Sandbox (push) Successful in 2m43s
Test / ShareFS (push) Successful in 3m55s
Test / Hakurei (push) Successful in 4m3s
Test / Sandbox (race detector) (push) Successful in 8m34s
Test / Hakurei (race detector) (push) Successful in 11m35s
Test / Flake checks (push) Successful in 8m40s
Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -86,6 +86,7 @@ func main() {
|
|||||||
flagCheck bool
|
flagCheck bool
|
||||||
flagLTO bool
|
flagLTO bool
|
||||||
flagPT bool
|
flagPT bool
|
||||||
|
flagDry bool
|
||||||
|
|
||||||
flagSourcePath string
|
flagSourcePath string
|
||||||
flagCrossOverride int
|
flagCrossOverride int
|
||||||
@@ -204,6 +205,10 @@ func main() {
|
|||||||
&flagPT,
|
&flagPT,
|
||||||
"parse-time", command.BoolFlag(false),
|
"parse-time", command.BoolFlag(false),
|
||||||
"Print duration of the initial azalea parse",
|
"Print duration of the initial azalea parse",
|
||||||
|
).Flag(
|
||||||
|
&flagDry,
|
||||||
|
"dry", command.BoolFlag(false),
|
||||||
|
"Do not destroy cache entries",
|
||||||
).Flag(
|
).Flag(
|
||||||
&flagSourcePath,
|
&flagSourcePath,
|
||||||
"source", command.StringFlag(""),
|
"source", command.StringFlag(""),
|
||||||
@@ -736,8 +741,9 @@ func main() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
c.NewCommand(
|
cleanC := c.New("clean", "Remove unused entries from the cache")
|
||||||
"clear",
|
cleanC.NewCommand(
|
||||||
|
"fault",
|
||||||
"Remove all fault entries from the cache",
|
"Remove all fault entries from the cache",
|
||||||
func([]string) error {
|
func([]string) error {
|
||||||
return cm.Do(func(*pkg.Cache) error {
|
return cm.Do(func(*pkg.Cache) error {
|
||||||
@@ -758,6 +764,43 @@ func main() {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
cleanC.NewCommand(
|
||||||
|
"checksum",
|
||||||
|
"Remove unreachable checksum entries",
|
||||||
|
func([]string) error {
|
||||||
|
return cm.Do(func(cache *pkg.Cache) error {
|
||||||
|
_, checksums, err := cache.Clean(flagDry, false)
|
||||||
|
log.Printf("destroyed %d entries", len(checksums))
|
||||||
|
return err
|
||||||
|
})
|
||||||
|
},
|
||||||
|
)
|
||||||
|
{
|
||||||
|
var flagDeep bool
|
||||||
|
cleanC.NewCommand(
|
||||||
|
"all",
|
||||||
|
"Remove identifiers not reachable by loaded packages",
|
||||||
|
func([]string) error {
|
||||||
|
return cm.Do(func(cache *pkg.Cache) error {
|
||||||
|
t := rosa.Native().Std()
|
||||||
|
ids, checksums, err := cache.Clean(
|
||||||
|
flagDry,
|
||||||
|
!flagDeep,
|
||||||
|
t.Append(nil, t.CollectAll()...)...,
|
||||||
|
)
|
||||||
|
log.Printf(
|
||||||
|
"destroyed %d identifier and %d checksum entries",
|
||||||
|
len(ids), len(checksums),
|
||||||
|
)
|
||||||
|
return err
|
||||||
|
})
|
||||||
|
},
|
||||||
|
).Flag(
|
||||||
|
&flagDeep,
|
||||||
|
"deep", command.BoolFlag(false),
|
||||||
|
"Include transitive inputs",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
c.NewCommand(
|
c.NewCommand(
|
||||||
"abort",
|
"abort",
|
||||||
|
|||||||
Reference in New Issue
Block a user