refactor: merge guess with when no kernels defined
This commit is contained in:
parent
ceaacade0b
commit
2c2124bdb0
22
pew.go
22
pew.go
@ -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
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user