1
0

Crutch for regex

This commit is contained in:
dump_stack() 2023-05-11 21:47:43 +00:00
parent cca637cf9d
commit d4fbec39a6
Signed by: dump_stack
GPG Key ID: BE44DA8C062D87DC

View File

@ -34,12 +34,28 @@ var (
func GetDebianKernel(version string) (dk DebianKernel, err error) { func GetDebianKernel(version string) (dk DebianKernel, err error) {
dk.Version.Package = version dk.Version.Package = version
regex := `^linux-(image|headers)-[dbporcexp+~0-9\.\-]*-(amd64|amd64-unsigned)$` regex := `^linux-(image|headers)-[a-z+~0-9\.\-]*-(amd64|amd64-unsigned)$`
packages, err := snapshot.Packages("linux", version, "amd64", regex) pkgs, err := snapshot.Packages("linux", version, "amd64", regex)
if err != nil { if err != nil {
return return
} }
// FIXME correct regex
var packages []snapshot.Package
for _, p := range pkgs {
skip := false
for _, s := range []string{"rt-amd64", "cloud-amd64"} {
if strings.Contains(p.Name, s) {
skip = true
break
}
}
if !skip {
packages = append(packages, p)
}
}
if len(packages) == 0 { if len(packages) == 0 {
err = ErrNoBinaryPackages err = ErrNoBinaryPackages
return return