From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 2F943138C9D for ; Tue, 28 Apr 2015 20:54:06 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B5D8FE095B; Tue, 28 Apr 2015 20:54:05 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 2EA43E0909 for ; Tue, 28 Apr 2015 20:54:04 +0000 (UTC) Received: from big_daddy.dol-sen.ca (S010634bdfa9ecf80.vc.shawcable.net [96.49.31.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: dolsen) by smtp.gentoo.org (Postfix) with ESMTPSA id 7824E340C6B for ; Tue, 28 Apr 2015 20:54:03 +0000 (UTC) Date: Tue, 28 Apr 2015 13:54:00 -0700 From: Brian Dolbec To: gentoo-portage-dev@lists.gentoo.org Subject: Re: [gentoo-portage-dev] [PATCH] search: fix addCP so only the specified results are displayed (bug 547736) Message-ID: <20150428135400.665fee27.dolsen@gentoo.org> In-Reply-To: <1430002040-473-1-git-send-email-zmedico@gentoo.org> References: <1430002040-473-1-git-send-email-zmedico@gentoo.org> Organization: Gentoo Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-portage-dev@lists.gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Archives-Salt: 022ecf46-6ddf-4acd-a583-290dc3ddc24a X-Archives-Hash: 3040e4edbca1dab30f1032ca653a4409 On Sat, 25 Apr 2015 15:47:20 -0700 Zac Medico wrote: > Since commit 4938b8a8a72e719b394a5c5b0c5030c160091d57, the > search.addCP method has not worked as intended. > > Fixes: 4938b8a8a72e ("Display emerge search results incrementally > (412471)") X-Gentoo-Bug: 547736 > X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=547736 > --- > pym/_emerge/search.py | 14 +++++++++++--- > 1 file changed, 11 insertions(+), 3 deletions(-) > > diff --git a/pym/_emerge/search.py b/pym/_emerge/search.py > index 5a8143c..41c182d 100644 > --- a/pym/_emerge/search.py > +++ b/pym/_emerge/search.py > @@ -36,6 +36,7 @@ class search(object): > self.verbose = verbose > self.searchdesc = searchdesc > self.searchkey = None > + self._results_specified = False > # Disable the spinner since search results are > displayed # incrementally. > self.spinner = None > @@ -295,6 +296,12 @@ class search(object): > yield ("set", setname) > > def addCP(self, cp): > + """ > + Add a specific cp to the search results. This > modifies the > + behavior of the output method, so that it only > displays specific > + packages added via this method. > + """ > + self._results_specified = True > if not self._xmatch("match-all", cp): > return > self.matches["pkg"].append(cp) > @@ -315,11 +322,12 @@ class search(object): > metadata_keys.update(["DESCRIPTION", "HOMEPAGE", > "LICENSE", "SRC_URI"]) metadata_keys = tuple(metadata_keys) > > - if self.searchkey is None: > + if self._results_specified: > # Handle results added via addCP > addCP_matches = [] > - for mytype, match in self.matches.items(): > - addCP_matches.append(mytype, match) > + for mytype, matches in self.matches.items(): > + for match in matches: > + > addCP_matches.append((mytype, match)) iterator = iter(addCP_matches) > > else: Looks good -- Brian Dolbec