commit:     81c667614774fa91ef36c05bc29a009bf0126c6a
Author:     Thomas Bracht Laumann Jespersen <t <AT> laumann <DOT> xyz>
AuthorDate: Tue Jan 20 20:17:21 2026 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jan 21 06:03:11 2026 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=81c66761

eclean: pass file_type to pretend_clean()

This function is called both by eclean-dist and eclean-pkg and it will
be useful later to have a handle on the file type.

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/clean.py | 3 +--
 pym/gentoolkit/eclean/cli.py   | 3 ++-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/pym/gentoolkit/eclean/clean.py b/pym/gentoolkit/eclean/clean.py
index 11cc755..776c6a4 100644
--- a/pym/gentoolkit/eclean/clean.py
+++ b/pym/gentoolkit/eclean/clean.py
@@ -76,7 +76,7 @@ class CleanUp:
         # return total size of deleted or to delete files
         return clean_size
 
-    def pretend_clean(self, clean_dict, vcs={}):
+    def pretend_clean(self, clean_dict, vcs={}, file_type="file"):
         """Shortcut function that calculates total space savings
         for the files in clean_dict.
 
@@ -84,7 +84,6 @@ class CleanUp:
         @rtype: integer
         @return: total size that would be cleaned
         """
-        file_type = "file"
         clean_size = 0
         # tally all entries one by one; sorting helps reading
         if vcs:

diff --git a/pym/gentoolkit/eclean/cli.py b/pym/gentoolkit/eclean/cli.py
index 21ce4aa..b62ae97 100644
--- a/pym/gentoolkit/eclean/cli.py
+++ b/pym/gentoolkit/eclean/cli.py
@@ -604,7 +604,8 @@ def doAction(action, options, exclude={}, output=None):
         if options["pretend"]:
             if options["skip-vcs"] or not options["destructive"]:
                 vcs = {}
-            clean_size = cleaner.pretend_clean(clean_me, vcs)
+            file_type = "binary package" if action in ["packages"] else "file"
+            clean_size = cleaner.pretend_clean(clean_me, vcs, file_type)
         elif action in ["distfiles"]:
             if options["skip-vcs"] or not options["destructive"]:
                 vcs = {}

Reply via email to