From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 4A462158089 for ; Mon, 2 Oct 2023 11:47:59 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 922D72BC02B; Mon, 2 Oct 2023 11:47:58 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 730372BC02B for ; Mon, 2 Oct 2023 11:47:58 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 80532335C7E for ; Mon, 2 Oct 2023 11:47:57 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 2C86892C for ; Mon, 2 Oct 2023 11:47:56 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1696247273.2b0a904f6b3e0376d0ee2359469d8732c11e376b.sam@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: /, lib/_emerge/ X-VCS-Repository: proj/portage X-VCS-Files: NEWS lib/_emerge/search.py X-VCS-Directories: lib/_emerge/ / X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 2b0a904f6b3e0376d0ee2359469d8732c11e376b X-VCS-Branch: master Date: Mon, 2 Oct 2023 11:47:56 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: f1bddacf-c168-45b4-a2a6-25b72ff64392 X-Archives-Hash: 2c9e712ad9964cb056464c17e9b52a44 commit: 2b0a904f6b3e0376d0ee2359469d8732c11e376b Author: Mike Gilbert gentoo org> AuthorDate: Sun Oct 1 21:36:23 2023 +0000 Commit: Sam James gentoo org> CommitDate: Mon Oct 2 11:47:53 2023 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=2b0a904f search: fix 'mlen' counter for ambiguous package names self.mlen was being incremented in both addCP() and output(). Drop the increment in addCP(), and convert mlen to a function-local variable in output(). Bug: https://bugs.gentoo.org/915054 Signed-off-by: Mike Gilbert gentoo.org> Closes: https://github.com/gentoo/portage/pull/1106 Signed-off-by: Sam James gentoo.org> NEWS | 3 +++ lib/_emerge/search.py | 14 +++----------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/NEWS b/NEWS index aa2b39ee9b..bfa6261bb9 100644 --- a/NEWS +++ b/NEWS @@ -28,6 +28,9 @@ Bug fixes: * dispatch-conf, etc-update: fix SELinux security labels on merged files. +* emerge: fix application count when listing search results for ambiguous + packages (bug #915054). + Cleanups: * vartree: Remove unused variables and parameters diff --git a/lib/_emerge/search.py b/lib/_emerge/search.py index e422434a72..62406258d0 100644 --- a/lib/_emerge/search.py +++ b/lib/_emerge/search.py @@ -57,7 +57,6 @@ class search: self.fuzzy = fuzzy self.search_similarity = 80 if search_similarity is None else search_similarity self.matches = {"pkg": []} - self.mlen = 0 self._dbs = [] @@ -377,7 +376,6 @@ class search: if not self._xmatch("match-all", cp): return self.matches["pkg"].append(cp) - self.mlen += 1 def output(self): """Outputs the results of the search.""" @@ -407,8 +405,9 @@ class search: # Do a normal search iterator = self._iter_search() + mlen = 0 for mtype, match in iterator: - self.mlen += 1 + mlen += 1 masked = False full_package = None if mtype in ("pkg", "desc"): @@ -521,14 +520,7 @@ class search: " " + darkgreen("License:") + " " + license + "\n\n" ) - msg.append("[ Applications found : " + bold(str(self.mlen)) + " ]\n\n") - - # This method can be called multiple times, so - # reset the match count for the next call. Don't - # reset it at the beginning of this method, since - # that would lose modfications from the addCP - # method. - self.mlen = 0 + msg.append("[ Applications found : " + bold(str(mlen)) + " ]\n\n") # # private interface