commit:     a94a9e688526d776c808fee96e9a3b9e1733764c
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sat Feb 20 12:04:32 2021 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sat Feb 20 12:04:32 2021 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=a94a9e68

libq/tree: allow tree_match_atom to skip over acct-* categories

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 libq/tree.c | 4 ++++
 libq/tree.h | 7 ++++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/libq/tree.c b/libq/tree.c
index df52171..9b06720 100644
--- a/libq/tree.c
+++ b/libq/tree.c
@@ -1736,6 +1736,10 @@ tree_match_atom(tree_ctx *ctx, depend_atom *query, int 
flags)
                if (!(flags & TREE_MATCH_VIRTUAL || \
                                strcmp(atom->CATEGORY, "virtual") != 0)) \
                        continue; \
+               /* skip acct-* package as requested */ \
+               if (!(flags & TREE_MATCH_ACCT || \
+                               strncmp(atom->CATEGORY, "acct-", 
sizeof("acct-") - 1) != 0)) \
+                       continue; \
                /* see if this atom matches the query */ \
                if (atom_compare(atom, query) == EQUAL) { \
                        tree_match_ctx *n; \

diff --git a/libq/tree.h b/libq/tree.h
index 53fee67..5a12c92 100644
--- a/libq/tree.h
+++ b/libq/tree.h
@@ -158,9 +158,10 @@ tree_match_ctx *tree_match_atom(tree_ctx *t, depend_atom 
*q, int flags);
 #define TREE_MATCH_FULL_ATOM  (1<<1)
 #define TREE_MATCH_METADATA   (1<<2)
 #define TREE_MATCH_LATEST     (1<<3)
-#define TREE_MATCH_VIRTUAL    (1<<4)
-#define TREE_MATCH_FIRST      (1<<5)
-#define TREE_MATCH_DEFAULT     TREE_MATCH_VIRTUAL
+#define TREE_MATCH_FIRST      (1<<4)
+#define TREE_MATCH_VIRTUAL    (1<<5)
+#define TREE_MATCH_ACCT       (1<<6)
+#define TREE_MATCH_DEFAULT    (TREE_MATCH_VIRTUAL | TREE_MATCH_ACCT)
 void tree_match_close(tree_match_ctx *t);
 
 #endif

Reply via email to