commit:     6e9734170ad12852c380e7178bedf6ee1fa30547
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Thu Jan  1 12:53:18 2026 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Thu Jan  1 12:53:18 2026 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=6e973417

qpkg: make clean work with gpkgs and multi-instances

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 qpkg.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/qpkg.c b/qpkg.c
index 29da9f7..5fdd2ff 100644
--- a/qpkg.c
+++ b/qpkg.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2025 Gentoo Foundation
+ * Copyright 2005-2026 Gentoo Foundation
  * Distributed under the terms of the GNU General Public License v2
  *
  * Copyright 2005-2010 Ned Ludd               - <[email protected]>
@@ -74,7 +74,6 @@ qpkg_clean(char *dirp)
        tree_ctx *t;
        tree_ctx *pkgs;
        char *binatomstr;
-       depend_atom *atom;
        char buf[_Q_PATH_MAX];
        struct stat st;
 
@@ -117,9 +116,9 @@ qpkg_clean(char *dirp)
        }
 
        array_for_each(bins, n, binatomstr) {
-               snprintf(buf, sizeof(buf), "%s/%s.tbz2", dirp, binatomstr);
-               atom = atom_explode(binatomstr);
-               if (lstat(buf, &st) != -1) {
+               depend_atom    *atom = atom_explode(binatomstr);
+               tree_match_ctx *m    = tree_match_atom(pkgs, atom, 0);
+               if (lstat(m->path, &st) != -1) {
                        if (S_ISREG(st.st_mode)) {
                                disp_units = KILOBYTE;
                                if ((st.st_size / KILOBYTE) > 1000)
@@ -129,11 +128,13 @@ qpkg_clean(char *dirp)
                                                DKBLUE, GREEN,
                                                
make_human_readable_str(st.st_size, 1, disp_units),
                                                disp_units == MEGABYTE ? "MiB" 
: "KiB",
-                                               DKBLUE, NORM, 
atom_format("%[CAT]/%[PF]", atom));
+                                               DKBLUE, NORM, 
atom_format("%[CAT]/%[PF]%[BUILDID]",
+                                                                               
                  m->atom));
                        }
                        if (!pretend)
                                unlink(buf);
                }
+               tree_match_close(m);
                atom_implode(atom);
        }
 

Reply via email to