aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Magorsch <arzano@gentoo.org>2020-09-08 13:09:02 +0200
committerMax Magorsch <arzano@gentoo.org>2020-09-08 13:09:02 +0200
commit437c0cfe28cb72d3ed558110da34fb3fca38525f (patch)
tree680d5f694d00819c8f2a65ac39e00171e748e780
parentCorrectly return exact matches (diff)
downloadsoko-437c0cfe28cb72d3ed558110da34fb3fca38525f.tar.gz
soko-437c0cfe28cb72d3ed558110da34fb3fca38525f.tar.bz2
soko-437c0cfe28cb72d3ed558110da34fb3fca38525f.zip
Improve the ignored repositories for repology
So far one had to specify all versions of a repository to ignore all of them, e.g.: app-forensics/afl::rosa_2016_1 app-forensics/afl::rosa_2019_1 Now it's possible to use app-forensics/afl::rosa to ignore all versions of the repository. However, it's still possible to use e.g. rosa_2019_1 to just ignore rosa_2019_1. Thanks to hanno for pointing this out. Signed-off-by: Max Magorsch <arzano@gentoo.org>
-rw-r--r--pkg/portage/repology/outdated.go15
1 files changed, 13 insertions, 2 deletions
diff --git a/pkg/portage/repology/outdated.go b/pkg/portage/repology/outdated.go
index ac25a17..20aba3c 100644
--- a/pkg/portage/repology/outdated.go
+++ b/pkg/portage/repology/outdated.go
@@ -86,8 +86,8 @@ func getOutdatedStartingWith(letter rune) []*models.OutdatedPackages {
}
if v.Repo == "gentoo" &&
v.Status == "outdated" &&
- !contains(blockedCategories, strings.Split(v.VisibleName, "/")[0]) &&
- !contains(blockedPackages, v.VisibleName) {
+ !containsPrefix(blockedCategories, strings.Split(v.VisibleName, "/")[0]) &&
+ !containsPrefix(blockedPackages, v.VisibleName) {
atom = v.VisibleName
outdated = true
@@ -161,3 +161,14 @@ func contains(list []string, item string) bool {
}
return false
}
+
+// contains returns true if the given string is a prefix
+// of an item in the given list. Otherwise false is returned.
+func containsPrefix(list []string, item string) bool {
+ for _, i := range list {
+ if strings.HasPrefix(i, item) {
+ return true
+ }
+ }
+ return false
+}