commit:     8b167b0adffac5bdf1d7e43f2ca3da5f8d604b33
Author:     Eli Schwartz <eschwartz93 <AT> gmail <DOT> com>
AuthorDate: Wed Dec 27 02:12:03 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Dec 27 13:30:19 2023 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=8b167b0a

emerge: enable "avoid spamming too much info about unused binpkgs" again

In commit a6853d5493b7bed37e60c2e3b7536b209500ba3f this code in
_show_ignored_binaries_respect_use was refactored to handle pkg.root.
But it was refactored incorrectly -- the storage/lookup key started off
as:

```
seen[pkg.cpv]
```

and was refactored so the storage key was:
```
seen[pkg.root][pkg.cpv]
```

and the lookup key was
```
seen[(pkg.root, pkg.cpv)]
```

As a result, we never detected a previously seen USE flags combo, and
the logic to avoid spamming too much info was a no-op; the info was
spammed, instead.

Note that even though we have more code than before this patch, we
actually have less code. The black code formatter decided that since the
line length was decreased, this entire code block should be reformatted,
murdering the diff view and dividing less code across *more* lines. This
is not my fault and I refuse to be held accountable for it -- if you git
blame this and do not know what happened, understand that it happens
despite my objections.

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

 lib/_emerge/depgraph.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py
index 6ee4471bbe..efe084a780 100644
--- a/lib/_emerge/depgraph.py
+++ b/lib/_emerge/depgraph.py
@@ -1256,9 +1256,10 @@ class depgraph:
 
             # We don't want to list the same USE flags for multiple build IDs
             seen.setdefault(pkg.root, dict())
-            if (pkg.root, pkg.cpv) not in seen or flag_display not in 
seen[pkg.root][
-                pkg.cpv
-            ]:
+            if (
+                pkg.cpv not in seen[pkg.root]
+                or flag_display not in seen[pkg.root][pkg.cpv]
+            ):
                 seen[pkg.root].setdefault(pkg.cpv, set()).add(flag_display)
                 # The user can paste this line into package.use
                 messages.append(f"    ={pkg.cpv} {flag_display}")

Reply via email to