1
0

Move all kernels generation to separate function

This commit is contained in:
dump_stack() 2018-12-10 03:00:26 +00:00
parent 094f209791
commit 630f6c7fe1

29
pew.go
View File

@ -334,6 +334,22 @@ func kernelMask(kernel string) (km config.KernelMask, err error) {
return return
} }
func genAllKernels() (sk []config.KernelMask, err error) {
for _, dType := range config.DistroTypeStrings {
var dt config.DistroType
dt, err = config.NewDistroType(dType)
if err != nil {
return
}
sk = append(sk, config.KernelMask{
DistroType: dt,
ReleaseMask: ".*",
})
}
return
}
func pewHandler(kcfg config.KernelConfig, func pewHandler(kcfg config.KernelConfig,
workPath, ovrrdKrnl, binary, test string, guess bool, workPath, ovrrdKrnl, binary, test string, guess bool,
qemuTimeout, dockerTimeout time.Duration) (err error) { qemuTimeout, dockerTimeout time.Duration) (err error) {
@ -358,16 +374,9 @@ func pewHandler(kcfg config.KernelConfig,
} }
if guess { if guess {
ka.SupportedKernels = []config.KernelMask{} ka.SupportedKernels, err = genAllKernels()
for _, dType := range config.DistroTypeStrings { if err != nil {
var dt config.DistroType return
dt, err = config.NewDistroType(dType)
if err != nil {
return
}
km := config.KernelMask{DistroType: dt, ReleaseMask: ".*"}
ka.SupportedKernels = append(ka.SupportedKernels, km)
} }
} }