diff --git a/CHANGELOG.md b/CHANGELOG.md index f1aa588d..0ca29842 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Fixes - Arch - - crashing when trying to upgrade AUR packages which data could not be retrieved + - crashing when trying to upgrade repository packages which data could not be retrieved + - multi-threaded download: crashing when could not retrieve download data for packages to upgrade - Installation setup - wrong style resources paths diff --git a/bauh/gems/arch/download.py b/bauh/gems/arch/download.py index eef2b12b..a15f3a4a 100644 --- a/bauh/gems/arch/download.py +++ b/bauh/gems/arch/download.py @@ -160,6 +160,12 @@ class MultithreadedDownloadService: downloaded = 0 pkgs_data = pacman.list_download_data(pkgs) + if not pkgs_data: + error_msg = "Could not retrieve download data of the following packages: {}".format(', '.join(pkgs)) + watcher.print(error_msg) + self.logger.error(error_msg) + return 0 + for pkg in pkgs_data: self.logger.info('Preparing to download package: {} ({})'.format(pkg['n'], pkg['v'])) try: diff --git a/bauh/gems/arch/pacman.py b/bauh/gems/arch/pacman.py index dbda8042..2aeef6b0 100644 --- a/bauh/gems/arch/pacman.py +++ b/bauh/gems/arch/pacman.py @@ -599,8 +599,8 @@ def map_provided(remote: bool = False, pkgs: Iterable[str] = None) -> Dict[str, def list_download_data(pkgs: Iterable[str]) -> List[Dict[str, str]]: _, output = system.run(['pacman', '-Si', *pkgs]) + res = [] if output: - res = [] data = {'a': None, 'v': None, 'r': None, 'n': None} for l in output.split('\n'): @@ -623,7 +623,7 @@ def list_download_data(pkgs: Iterable[str]) -> List[Dict[str, str]]: res.append(data) data = {'a': None, 'v': None, 'r': None, 'n': None} - return res + return res def map_updates_data(pkgs: Iterable[str], files: bool = False) -> dict: