1
0

refactor: merge guess with when no kernels defined

This commit is contained in:
dump_stack() 2023-05-24 15:46:58 +00:00
parent ceaacade0b
commit 2c2124bdb0
Signed by: dump_stack
GPG Key ID: BE44DA8C062D87DC

22
pew.go
View File

@ -90,9 +90,8 @@ func (cmd *PewCmd) Run(g *Globals) (err error) {
return
}
if len(ka.Targets) == 0 {
log.Debug().Msg("no targets defined in .out-of-tree.toml, " +
"will use all available")
if len(ka.Targets) == 0 || cmd.Guess {
log.Debug().Msg("will use all available targets")
for _, dist := range distro.List() {
ka.Targets = append(ka.Targets, config.Target{
@ -118,13 +117,6 @@ func (cmd *PewCmd) Run(g *Globals) (err error) {
ka.Targets = []config.Target{km}
}
if cmd.Guess {
ka.Targets, err = genAllKernels()
if err != nil {
return
}
}
if cmd.QemuTimeout != 0 {
log.Info().Msgf("Set qemu timeout to %s", cmd.QemuTimeout)
} else {
@ -866,13 +858,3 @@ func kernelMask(kernel string) (km config.Target, err error) {
}
return
}
func genAllKernels() (sk []config.Target, err error) {
for _, id := range distro.IDs {
sk = append(sk, config.Target{
Distro: distro.Distro{ID: id},
Kernel: config.Kernel{Regex: ".*"},
})
}
return
}