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

25
pew.go
View File

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