1 |
commit: 37453ccdfc2dad1bb21d79a596655b614264fee9 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Apr 25 22:44:25 2015 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Apr 28 23:49:28 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=37453ccd |
7 |
|
8 |
search: fix addCP so only the specified results are displayed (bug 547736) |
9 |
|
10 |
Since commit 4938b8a8a72e719b394a5c5b0c5030c160091d57, the search.addCP |
11 |
method has not worked as intended. |
12 |
|
13 |
Fixes: 4938b8a8a72e ("Display emerge search results incrementally (412471)") |
14 |
X-Gentoo-Bug: 547736 |
15 |
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=547736 |
16 |
Acked-by: Brian Dolbec <dolsen <AT> gentoo.org> |
17 |
|
18 |
pym/_emerge/search.py | 14 +++++++++++--- |
19 |
1 file changed, 11 insertions(+), 3 deletions(-) |
20 |
|
21 |
diff --git a/pym/_emerge/search.py b/pym/_emerge/search.py |
22 |
index 5a8143c..41c182d 100644 |
23 |
--- a/pym/_emerge/search.py |
24 |
+++ b/pym/_emerge/search.py |
25 |
@@ -36,6 +36,7 @@ class search(object): |
26 |
self.verbose = verbose |
27 |
self.searchdesc = searchdesc |
28 |
self.searchkey = None |
29 |
+ self._results_specified = False |
30 |
# Disable the spinner since search results are displayed |
31 |
# incrementally. |
32 |
self.spinner = None |
33 |
@@ -295,6 +296,12 @@ class search(object): |
34 |
yield ("set", setname) |
35 |
|
36 |
def addCP(self, cp): |
37 |
+ """ |
38 |
+ Add a specific cp to the search results. This modifies the |
39 |
+ behavior of the output method, so that it only displays specific |
40 |
+ packages added via this method. |
41 |
+ """ |
42 |
+ self._results_specified = True |
43 |
if not self._xmatch("match-all", cp): |
44 |
return |
45 |
self.matches["pkg"].append(cp) |
46 |
@@ -315,11 +322,12 @@ class search(object): |
47 |
metadata_keys.update(["DESCRIPTION", "HOMEPAGE", "LICENSE", "SRC_URI"]) |
48 |
metadata_keys = tuple(metadata_keys) |
49 |
|
50 |
- if self.searchkey is None: |
51 |
+ if self._results_specified: |
52 |
# Handle results added via addCP |
53 |
addCP_matches = [] |
54 |
- for mytype, match in self.matches.items(): |
55 |
- addCP_matches.append(mytype, match) |
56 |
+ for mytype, matches in self.matches.items(): |
57 |
+ for match in matches: |
58 |
+ addCP_matches.append((mytype, match)) |
59 |
iterator = iter(addCP_matches) |
60 |
|
61 |
else: |