From d4fbec39a69a3362ae20ed27383c38c0f1915023 Mon Sep 17 00:00:00 2001 From: Mikhail Klementev Date: Thu, 11 May 2023 21:47:43 +0000 Subject: [PATCH] Crutch for regex --- distro/debian/kernel.go | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/distro/debian/kernel.go b/distro/debian/kernel.go index bc3f3f6..49db090 100644 --- a/distro/debian/kernel.go +++ b/distro/debian/kernel.go @@ -34,12 +34,28 @@ var ( func GetDebianKernel(version string) (dk DebianKernel, err error) { 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 { 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 { err = ErrNoBinaryPackages return