From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1576340-garchives=archives.gentoo.org@lists.gentoo.org>
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 AAA38158013
	for <garchives@archives.gentoo.org>; Mon,  4 Dec 2023 06:45:51 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id A8B002BC015;
	Mon,  4 Dec 2023 06:45:50 +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) server-digest SHA256)
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 89C1D2BC015
	for <gentoo-commits@lists.gentoo.org>; Mon,  4 Dec 2023 06:45:50 +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) server-digest SHA256)
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 67043335C7E
	for <gentoo-commits@lists.gentoo.org>; Mon,  4 Dec 2023 06:45:49 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 9A037AE5
	for <gentoo-commits@lists.gentoo.org>; Mon,  4 Dec 2023 06:45:47 +0000 (UTC)
From: "Sam James" <sam@gentoo.org>
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" <sam@gentoo.org>
Message-ID: <1701672345.09f642b894eff3a607026b1edf417f5bceee95f1.sam@gentoo>
Subject: [gentoo-commits] proj/portage:master commit in: lib/_emerge/
X-VCS-Repository: proj/portage
X-VCS-Files: lib/_emerge/depgraph.py
X-VCS-Directories: lib/_emerge/
X-VCS-Committer: sam
X-VCS-Committer-Name: Sam James
X-VCS-Revision: 09f642b894eff3a607026b1edf417f5bceee95f1
X-VCS-Branch: master
Date: Mon,  4 Dec 2023 06:45:47 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: 1b67d646-294f-4843-9f48-d3fe74bdaa39
X-Archives-Hash: 6278d5ebdf6363f4f8c7230845648c68

commit:     09f642b894eff3a607026b1edf417f5bceee95f1
Author:     Eli Schwartz <eschwartz93 <AT> gmail <DOT> com>
AuthorDate: Sun Nov 26 02:25:06 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Dec  4 06:45:45 2023 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=09f642b8

emerge: avoid spamming too much info about unused binpkgs, redux

Specifically:

- many packages can be participating in the recursive deptree, but not
  get selected for actual merging, and may not even be installed at all;
  these were still reported as changed-deps although the packages
  themselves were not shown in show_merge_list

Previously done for mismatched-USE in commit:
bb82666b48e18f448661a1a8bf6a39b773cc4b1c

Before:
```

Local copy of remote index is up-to-date and will be used.

Local copy of remote index is up-to-date and will be used.

These are the packages that would be merged, in order:

Calculating dependencies... done!
Dependency resolution took 17.62 s.

[binary     U  ] dev-python/ensurepip-pip-23.3.1-1 [23.2.1]
[binary     U  ] sys-devel/binutils-2.40-r9-1 [2.40-r5] USE="-debuginfod%"
[binary     U  ] dev-python/trove-classifiers-2023.11.14-1 [2023.10.18]
[ebuild     U  ] dev-python/traitlets-5.13.0 [5.11.2] PYTHON_TARGETS="(-pypy3)"
[ebuild     U  ] dev-python/pip-23.3.1 [23.2.1]
[ebuild     U  ] dev-python/pycurl-7.45.2-r1 [7.45.2]
[ebuild     U  ] dev-python/cachetools-5.3.2 [5.3.1]
[ebuild     U  ] dev-python/pytest-7.4.3 [7.4.2]
[ebuild     U  ] dev-python/executing-2.0.1 [1.2.0] PYTHON_TARGETS="(-pypy3) -python3_12%"
[ebuild     U  ] dev-python/virtualenv-20.24.7 [20.24.5]

!!! The following binary packages have been ignored due to changed dependencies:

     kde-plasma/kde-cli-tools-5.27.9::gentoo
     kde-plasma/kde-cli-tools-5.27.8::gentoo

NOTE: The --binpkg-changed-deps=n option will prevent emerge
      from ignoring these binary packages if possible.
      Using --binpkg-changed-deps=y will silence this warning.
```

After:
```

Local copy of remote index is up-to-date and will be used.

Local copy of remote index is up-to-date and will be used.

These are the packages that would be merged, in order:

Calculating dependencies... done!
Dependency resolution took 17.62 s.

[binary     U  ] dev-python/ensurepip-pip-23.3.1-1 [23.2.1]
[binary     U  ] sys-devel/binutils-2.40-r9-1 [2.40-r5] USE="-debuginfod%"
[binary     U  ] dev-python/trove-classifiers-2023.11.14-1 [2023.10.18]
[ebuild     U  ] dev-python/traitlets-5.13.0 [5.11.2] PYTHON_TARGETS="(-pypy3)"
[ebuild     U  ] dev-python/pip-23.3.1 [23.2.1]
[ebuild     U  ] dev-python/pycurl-7.45.2-r1 [7.45.2]
[ebuild     U  ] dev-python/cachetools-5.3.2 [5.3.1]
[ebuild     U  ] dev-python/pytest-7.4.3 [7.4.2]
[ebuild     U  ] dev-python/executing-2.0.1 [1.2.0] PYTHON_TARGETS="(-pypy3) -python3_12%"
[ebuild     U  ] dev-python/virtualenv-20.24.7 [20.24.5]
```

Signed-off-by: Eli Schwartz <eschwartz93 <AT> gmail.com>
Closes: https://github.com/gentoo/portage/pull/1194
Signed-off-by: Sam James <sam <AT> gentoo.org>

 lib/_emerge/depgraph.py | 28 ++++++++++++++++++++++------
 1 file changed, 22 insertions(+), 6 deletions(-)

diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py
index d3b5756429..9b09701021 100644
--- a/lib/_emerge/depgraph.py
+++ b/lib/_emerge/depgraph.py
@@ -1288,17 +1288,33 @@ class depgraph:
             writemsg(line + "\n", noiselevel=-1)
 
     def _show_ignored_binaries_changed_deps(self, changed_deps):
-        writemsg(
-            "\n!!! The following binary packages have been "
-            "ignored due to changed dependencies:\n\n",
-            noiselevel=-1,
-        )
+        merging = {
+            (pkg.root, pkg.cpv)
+            for pkg in self._dynamic_config._displayed_list or ()
+            if isinstance(pkg, Package)
+        }
+        messages = []
 
         for pkg in changed_deps:
+            # Don't include recursive deps which aren't in the merge list anyway.
+            if (pkg.root, pkg.cpv) not in merging:
+                continue
+
             msg = f"     {pkg.cpv}{_repo_separator}{pkg.repo}"
             if pkg.root_config.settings["ROOT"] != "/":
                 msg += f" for {pkg.root}"
-            writemsg(f"{msg}\n", noiselevel=-1)
+            messages.append(f"{msg}\n")
+
+        if not messages:
+            return
+
+        writemsg(
+            "\n!!! The following binary packages have been "
+            "ignored due to changed dependencies:\n\n",
+            noiselevel=-1,
+        )
+        for line in messages:
+            writemsg(line, noiselevel=-1)
 
         msg = [
             "",