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