Implement as normal filter
This commit is contained in:
parent
2e6ce1e8f9
commit
ad0a3706cb
@ -36,28 +36,16 @@ func GetDebianKernel(version string) (dk DebianKernel, err error) {
|
||||
|
||||
regex := `^linux-(image|headers)-[a-z+~0-9\.\-]*-(amd64|amd64-unsigned)$`
|
||||
|
||||
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{
|
||||
filter := []string{
|
||||
"rt-amd64",
|
||||
"cloud-amd64",
|
||||
"all-amd64",
|
||||
} {
|
||||
if strings.Contains(p.Name, s) {
|
||||
skip = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !skip {
|
||||
packages = append(packages, p)
|
||||
}
|
||||
|
||||
packages, err := snapshot.Packages("linux", version, "amd64",
|
||||
regex, filter)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if len(packages) == 0 {
|
||||
|
@ -283,7 +283,18 @@ func contains(pkgs []Package, pkg Package) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func Packages(srcname, version, arch, regex string) (pkgs []Package, err error) {
|
||||
func filtered(s string, filter []string) bool {
|
||||
for _, f := range filter {
|
||||
if strings.Contains(s, f) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func Packages(srcname, version, arch, regex string,
|
||||
filter []string) (pkgs []Package, err error) {
|
||||
|
||||
binpkgs, err := mr.GetBinpackages(srcname, version)
|
||||
if err == mr.ErrNotFound {
|
||||
err = nil
|
||||
@ -296,7 +307,7 @@ func Packages(srcname, version, arch, regex string) (pkgs []Package, err error)
|
||||
r := regexp.MustCompile(regex)
|
||||
|
||||
for _, res := range binpkgs.Result {
|
||||
if !r.MatchString(res.Name) {
|
||||
if !r.MatchString(res.Name) || filtered(res.Name, filter) {
|
||||
continue
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user