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 = [
             "",

Reply via email to