commit:     262ec2d23a8819c36b6983971dfead24bdd6cbee
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Tue Apr 30 08:00:59 2019 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Tue Apr 30 08:00:59 2019 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=262ec2d2

qcache: suppress keywordless ebuilds in -n mode

Only return matches for ebuilds that actually have *any* keywords.

Bug: https://bugs.gentoo.org/684252
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 qcache.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/qcache.c b/qcache.c
index 7c5ae42..116f389 100644
--- a/qcache.c
+++ b/qcache.c
@@ -240,14 +240,23 @@ qcache_imlate(cache_pkg_ctx *pkg_ctx, void *priv)
 static int
 qcache_not(cache_pkg_ctx *pkg_ctx, void *priv)
 {
+       size_t a;
        qcache_data *data = (qcache_data *)priv;
 
        if (data->keywordsbuf[qcache_test_arch] != testing &&
                        data->keywordsbuf[qcache_test_arch] != stable)
        {
-               print_keywords(pkg_ctx->cat_ctx->name, pkg_ctx->name,
-                               data->keywordsbuf);
-               return EXIT_SUCCESS;
+               /* match if any of the other arches have keywords */
+               for (a = 0; a < archlist_count; a++) {
+                       if (data->keywordsbuf[a] == stable ||
+                                       data->keywordsbuf[a] == testing)
+                               break;
+               }
+               if (a < archlist_count) {
+                       print_keywords(pkg_ctx->cat_ctx->name, pkg_ctx->name,
+                                       data->keywordsbuf);
+                       return EXIT_SUCCESS;
+               }
        }
 
        return EXIT_FAILURE;

Reply via email to