From b31dee9ec37bc6aea81b59670fb938f3e18174eb Mon Sep 17 00:00:00 2001 From: Caleb Connolly Date: Sun, 19 May 2024 15:29:19 +0200 Subject: [PATCH] pmb.chroot.zap: don't calculate size (MR 2252) It's nice to know how much space gets free'd when zapping, but I often find myself with a lot of chroot's and other junk, and on my laptop running "du" across all of this takes quite a few seconds. As this is purely cosmetic, it doesn't justify taking such a long time. Remove the size calculation code to substantially speed up zap. Signed-off-by: Caleb Connolly --- pmb/chroot/zap.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/pmb/chroot/zap.py b/pmb/chroot/zap.py index caf6f9f3..628a95ac 100644 --- a/pmb/chroot/zap.py +++ b/pmb/chroot/zap.py @@ -2,7 +2,6 @@ # SPDX-License-Identifier: GPL-3.0-or-later import glob import logging -import math import os import pmb.chroot @@ -37,8 +36,6 @@ def zap(args, confirm=True, dry=False, pkgs_local=False, http=False, # Get current work folder size if not dry: pmb.chroot.shutdown(args) - logging.debug("Calculate work folder size") - size_old = pmb.helpers.other.folder_size(args, args.work) # Delete packages with a different version compared to aports, # then re-index @@ -89,10 +86,6 @@ def zap(args, confirm=True, dry=False, pkgs_local=False, http=False, # Print amount of cleaned up space if dry: logging.info("Dry run: nothing has been deleted") - else: - size_new = pmb.helpers.other.folder_size(args, args.work) - mb = (size_old - size_new) / 1024 - logging.info(f"Cleared up ~{math.ceil(mb)} MB of space") def zap_pkgs_local_mismatch(args, confirm=True, dry=False):