1 |
commit: 2d78938f5d4c3be536e7484c0f23be64b124db05 |
2 |
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Jan 2 13:23:35 2020 +0000 |
4 |
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Jan 2 13:23:35 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=2d78938f |
7 |
|
8 |
qdepends: use tree_foreach_pkg query selection on forward queries |
9 |
|
10 |
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org> |
11 |
|
12 |
qdepends.c | 22 ++++++++++++++++++---- |
13 |
1 file changed, 18 insertions(+), 4 deletions(-) |
14 |
|
15 |
diff --git a/qdepends.c b/qdepends.c |
16 |
index 44821b6..6f580a9 100644 |
17 |
--- a/qdepends.c |
18 |
+++ b/qdepends.c |
19 |
@@ -375,14 +375,28 @@ int qdepends_main(int argc, char **argv) |
20 |
array_for_each(overlays, n, overlay) { |
21 |
t = tree_open(portroot, overlay); |
22 |
if (t != NULL) { |
23 |
- ret = tree_foreach_pkg_sorted(t, |
24 |
- qdepends_results_cb, &state, NULL); |
25 |
+ if (!(state.qmode & QMODE_REVERSE) && array_cnt(atoms) > 0) { |
26 |
+ array_for_each(atoms, i, atom) { |
27 |
+ ret = tree_foreach_pkg_sorted(t, |
28 |
+ qdepends_results_cb, &state, atom); |
29 |
+ } |
30 |
+ } else { |
31 |
+ ret = tree_foreach_pkg_sorted(t, |
32 |
+ qdepends_results_cb, &state, NULL); |
33 |
+ } |
34 |
tree_close(t); |
35 |
} |
36 |
} |
37 |
} else { |
38 |
- ret = tree_foreach_pkg_fast(state.vdb, |
39 |
- qdepends_results_cb, &state, NULL); |
40 |
+ if (!(state.qmode & QMODE_REVERSE) && array_cnt(atoms) > 0) { |
41 |
+ array_for_each(atoms, i, atom) { |
42 |
+ ret = tree_foreach_pkg_fast(state.vdb, |
43 |
+ qdepends_results_cb, &state, atom); |
44 |
+ } |
45 |
+ } else { |
46 |
+ ret = tree_foreach_pkg_fast(state.vdb, |
47 |
+ qdepends_results_cb, &state, NULL); |
48 |
+ } |
49 |
} |
50 |
|
51 |
if (state.vdb != NULL) |