commit:     b903e392ccd40ea3fd8551e47d31c2c5704e94d9
Author:     Thomas Bracht Laumann Jespersen <t <AT> laumann <DOT> xyz>
AuthorDate: Wed Jan 21 20:36:58 2026 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Jan 22 01:02:15 2026 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=b903e392

eclean-pkg: fix output for invalid packages

Signed-off-by: Thomas Bracht Laumann Jespersen <t <AT> laumann.xyz>
Part-of: https://codeberg.org/gentoo/gentoolkit/pulls/4
Merges: https://codeberg.org/gentoo/gentoolkit/pulls/4
Signed-off-by: Sam James <sam <AT> gentoo.org>

 pym/gentoolkit/eclean/cli.py    |  3 ++-
 pym/gentoolkit/eclean/output.py | 21 +++++++++++----------
 2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/pym/gentoolkit/eclean/cli.py b/pym/gentoolkit/eclean/cli.py
index 7bf2e34..a1d437f 100644
--- a/pym/gentoolkit/eclean/cli.py
+++ b/pym/gentoolkit/eclean/cli.py
@@ -667,7 +667,8 @@ def doAction(action, options, exclude={}, output=None):
                 output.set_colors("invalid")
                 output.list_pkgs(invalids)
                 clean_size = cleaner.clean_pkgs(invalids, pkgdir)
-                output.total("invalid", clean_size, len(invalids), verb, 
action)
+                invalid_count = sum(len(pkgs) for pkgs in invalids.values())
+                output.total("invalid", clean_size, invalid_count, verb, 
action)
             else:
                 cleaner.clean_pkgs(invalids, pkgdir)
 

diff --git a/pym/gentoolkit/eclean/output.py b/pym/gentoolkit/eclean/output.py
index e02ccce..f24086d 100644
--- a/pym/gentoolkit/eclean/output.py
+++ b/pym/gentoolkit/eclean/output.py
@@ -200,17 +200,18 @@ class OutputControl:
             print(" ===========")
             print(self.prettySize(size, True, red), message)
 
-    def list_pkgs(self, pkgs):
+    def list_pkgs(self, loc_pkgs):
         """outputs the packages to stdout
 
-        @param pkgs: dict. of {cat/pkg-ver: src_uri,}
+        @param pkgs: dict. of {location: {cat/pkg-ver: src_uri,} }
         """
         indent = " " * 12
-        keys = sorted(pkgs)
-        for key in keys:
-            if pkgs[key]:
-                saved = ""
-            else:
-                saved = " ...distfile name(s) not known/saved"
-            print(indent, self.pkg_color(key) + saved)
-        print()
+        for pkgs in loc_pkgs.values():
+            keys = sorted(pkgs)
+            for key in keys:
+                if pkgs[key]:
+                    saved = ""
+                else:
+                    saved = " ...distfile name(s) not known/saved"
+                print(indent, self.pkg_color(key) + saved)
+            print()

Reply via email to