From 81a7b682d66ccad06aad5e2b6292ab25d2d83d24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Moreira?= Date: Fri, 8 May 2020 17:50:30 -0300 Subject: [PATCH] [improvement][arch] 'clean cache' removing the whole folder instead of each file --- CHANGELOG.md | 3 +++ bauh/gems/arch/controller.py | 14 +++++--------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ce44ed24..689b4624 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [0.9.3] 2020 ### Fixes +- Arch + - 'clean cache' operation was not working in some scenarios + - upgrade: crashing for scenarios when there are packages that cannot upgrade to be displayed on the summary window - settings: crashing when an empty Qt style is defined [#104](https://github.com/vinifmor/bauh/issues/104) diff --git a/bauh/gems/arch/controller.py b/bauh/gems/arch/controller.py index c1d12f09..1997ea2b 100644 --- a/bauh/gems/arch/controller.py +++ b/bauh/gems/arch/controller.py @@ -2165,20 +2165,16 @@ class ArchManager(SoftwareManager): deny_label=self.i18n['cancel'].capitalize()): handler = ProcessHandler(watcher) - success = True - for f in glob.glob('{}/*'.format(cache_dir)): - rm = SimpleProcess(cmd=['rm', '-rf', f], root_password=root_password) - - success, _ = handler.handle_simple(rm) - - if not success: - success = False - break + rm = SimpleProcess(cmd=['rm', '-rf', cache_dir], root_password=root_password) + success, _ = handler.handle_simple(rm) if success: watcher.show_message(title=self.i18n['arch.custom_action.clean_cache'].capitalize(), body=self.i18n['arch.custom_action.clean_cache.success'], type_=MessageType.INFO) + + mkcache = SimpleProcess(cmd=['mkdir', '-p', cache_dir], root_password=root_password) + handler.handle_simple(mkcache) return True else: watcher.show_message(title=self.i18n['arch.custom_action.clean_cache'].capitalize(),