commit:     1888634cf91e8e0567e7a3da545a4174eadd5c32
Author:     Thomas Bracht Laumann Jespersen <t <AT> laumann <DOT> xyz>
AuthorDate: Tue Jan 20 19:44:45 2026 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jan 21 06:03:10 2026 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=1888634c

eclean-pkg: fix presentation with binpkgs with build ID

When multiple binpkgs for a package are identified for removal (when
binpkg-multi-instance is set) they should be presented
individually including the build ID, and with --interactive the user
should be prompted for each binpkg.

The previous behaviour still prompted for each binpkg, but under the
package name (excluding build IDs), so the user would not know which
specific binpkg was being prompted for. Without --interactive the
binpkgs were grouped together in the output under CPV (with no
indication of how many binpkgs were being removed).

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

 pym/gentoolkit/eclean/search.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/pym/gentoolkit/eclean/search.py b/pym/gentoolkit/eclean/search.py
index aaa67dc..a304705 100644
--- a/pym/gentoolkit/eclean/search.py
+++ b/pym/gentoolkit/eclean/search.py
@@ -641,6 +641,11 @@ def findPackages(
     dead_binpkgs: dict[str, list[str]] = {}
     keep_binpkgs = {}
 
+    def mk_binpkg_key(cpv):
+        if cpv.build_id is None:
+            return str(cpv)
+        return f"{cpv}~{cpv.build_id}"
+
     # FEATURES=pkgdir-index-trusted is now on by default which makes Portage's
     # invalids inaccessible
     settings = var_dbapi.settings
@@ -652,6 +657,7 @@ def findPackages(
         bin_dbapi.bintree.populate(force_reindex=True, **populate_kwargs)
     for cpv in bin_dbapi.cpv_all():
         cp = portage.cpv_getkey(cpv)
+        binpkg_key = mk_binpkg_key(cpv)
 
         # Exclude per --exclude-file=...
         if exclDictMatchCP(exclude, cp):
@@ -675,8 +681,9 @@ def findPackages(
                 new_time = int(bin_dbapi.aux_get(cpv, ["BUILD_TIME"])[0])
                 drop_cpv = old_cpv if new_time >= old_time else cpv
 
+                binpkg_key = mk_binpkg_key(drop_cpv)
                 binpkg_path = bin_dbapi.bintree.getname(drop_cpv)
-                dead_binpkgs.setdefault(drop_cpv, []).append(binpkg_path)
+                dead_binpkgs.setdefault(binpkg_key, []).append(binpkg_path)
 
                 if new_time >= old_time:
                     keep_binpkgs[cpv_key] = cpv
@@ -723,7 +730,7 @@ def findPackages(
             del keep_binpkgs[cpv_key]
 
         binpkg_path = bin_dbapi.bintree.getname(cpv)
-        dead_binpkgs.setdefault(cpv, []).append(binpkg_path)
+        dead_binpkgs.setdefault(binpkg_key, []).append(binpkg_path)
     try:
         invalid_paths = bin_dbapi.bintree.invalid_paths
     except AttributeError:

Reply via email to