diff --git a/bauh/gems/arch/controller.py b/bauh/gems/arch/controller.py index dfe58646..3494804e 100644 --- a/bauh/gems/arch/controller.py +++ b/bauh/gems/arch/controller.py @@ -407,8 +407,7 @@ class ArchManager(SoftwareManager): if not odeps: return True - installed = pacman.list_installed() - to_install = {d for d in odeps if d not in installed} + to_install = {d for d in odeps if not pacman.check_installed(d)} if not to_install: return True diff --git a/bauh/gems/arch/pacman.py b/bauh/gems/arch/pacman.py index b7f2a09f..634048c3 100644 --- a/bauh/gems/arch/pacman.py +++ b/bauh/gems/arch/pacman.py @@ -61,6 +61,11 @@ def list_installed() -> Set[str]: return {out.decode().strip() for out in new_subprocess(['pacman', '-Qq']).stdout if out} +def check_installed(pkg: str) -> bool: + res = run_cmd('pacman -Qq ' + pkg, print_error=False) + return bool(res) + + def list_and_map_installed() -> dict: # returns a dict with with package names as keys and versions as values installed = new_subprocess(['pacman', '-Qq']).stdout # retrieving all installed package names allinfo = new_subprocess(['pacman', '-Qi'], stdin=installed).stdout # retrieving all installed packages info