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