Refactor deb package matcher
This commit is contained in:
parent
e44124c063
commit
604d21e4a2
18
kernel.go
18
kernel.go
@ -161,10 +161,9 @@ func (cmd *KernelConfigRegenCmd) Run(kernelCmd *KernelCmd, g *Globals) (err erro
|
|||||||
return updateKernelsCfg(kernelCmd.UseHost, !kernelCmd.NoDownload)
|
return updateKernelsCfg(kernelCmd.UseHost, !kernelCmd.NoDownload)
|
||||||
}
|
}
|
||||||
|
|
||||||
func matchDebianHeadersPkg(container, mask string, generic bool) (
|
func matchDebImagePkg(container, mask string) (pkgs []string, err error) {
|
||||||
pkgs []string, err error) {
|
|
||||||
|
|
||||||
cmd := "apt-cache search linux-image | cut -d ' ' -f 1"
|
cmd := "apt-cache search --names-only '^linux-image-[0-9\\.\\-]*-generic' | awk '{ print $1 }'"
|
||||||
|
|
||||||
// FIXME timeout should be in global out-of-tree config
|
// FIXME timeout should be in global out-of-tree config
|
||||||
c, err := NewContainer(container, time.Hour)
|
c, err := NewContainer(container, time.Hour)
|
||||||
@ -183,18 +182,8 @@ func matchDebianHeadersPkg(container, mask string, generic bool) (
|
|||||||
}
|
}
|
||||||
|
|
||||||
kernels := r.FindAll([]byte(output), -1)
|
kernels := r.FindAll([]byte(output), -1)
|
||||||
|
|
||||||
for _, k := range kernels {
|
for _, k := range kernels {
|
||||||
pkg := string(k)
|
pkg := string(k)
|
||||||
if generic && !strings.HasSuffix(pkg, "generic") {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if pkg == "linux-headers-generic" {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if pkg == "linux-image-generic" {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
pkgs = append(pkgs, pkg)
|
pkgs = append(pkgs, pkg)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -703,8 +692,7 @@ func generateKernels(km config.KernelMask, registry string,
|
|||||||
var pkgs []string
|
var pkgs []string
|
||||||
switch km.DistroType {
|
switch km.DistroType {
|
||||||
case config.Ubuntu:
|
case config.Ubuntu:
|
||||||
pkgs, err = matchDebianHeadersPkg(km.DockerName(),
|
pkgs, err = matchDebImagePkg(km.DockerName(), km.ReleaseMask)
|
||||||
km.ReleaseMask, true)
|
|
||||||
case config.CentOS:
|
case config.CentOS:
|
||||||
pkgs, err = matchCentOSDevelPkg(km.DockerName(),
|
pkgs, err = matchCentOSDevelPkg(km.DockerName(),
|
||||||
km.ReleaseMask, true)
|
km.ReleaseMask, true)
|
||||||
|
Loading…
Reference in New Issue
Block a user