From d45dc799cac8c277693dbbd841f98af2448619ef Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Tue, 2 Jun 2020 15:59:13 -0300 Subject: [PATCH] [fix][arch] not checking if the are other installed providers for the target package --- CHANGELOG.md | 6 +++--- bauh/gems/arch/controller.py | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0869bce1..54f2ed95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,9 +14,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - regressions (from **0.9.4**) - resetting the main configuration when tray mode is active [#118](https://github.com/vinifmor/bauh/issues/118) - bauh-cli crashing (https://github.com/vinifmor/bauh/issues/118) - - Arch - - not checking if **pacman-mirrors** is available before starting to download repository packages (when multi-threaded download is enabled) [#117](https://github.com/vinifmor/bauh/issues/117) - + - Arch: not checking if **pacman-mirrors** is available before starting to download repository packages (when multi-threaded download is enabled) [#117](https://github.com/vinifmor/bauh/issues/117) +- Arch + - uninstall: not checking if the are other installed providers for the target package ## [0.9.4] 2020-05-29 diff --git a/bauh/gems/arch/controller.py b/bauh/gems/arch/controller.py index dec9176c..5423ffa8 100644 --- a/bauh/gems/arch/controller.py +++ b/bauh/gems/arch/controller.py @@ -972,6 +972,27 @@ class ArchManager(SoftwareManager): required_by = self.deps_analyser.map_all_required_by({context.name}, set()) + if required_by: + target_provided = pacman.map_provided(pkgs={context.name}).keys() + + if target_provided: + required_by_deps = pacman.map_all_deps(required_by, only_installed=True) + + if required_by_deps: + all_provided = pacman.map_provided() + + for pkg, deps in required_by_deps.items(): + target_required_by = 0 + for dep in deps: + if dep in target_provided: + dep_providers = all_provided.get(dep) + + if dep_providers: + target_required_by += 1 if not dep_providers.difference(target_provided) else 0 + + if not target_required_by: + required_by.remove(pkg) + self._update_progress(context, 50) to_uninstall = set()