[arch] fix -> multi-threaded download: crashing when could not retrieve download data for packages to upgrade

This commit is contained in:
Vinicius Moreira
2021-02-03 11:03:25 -03:00
parent c566b90264
commit 65c8170db5
3 changed files with 10 additions and 3 deletions

View File

@@ -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

View File

@@ -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:

View File

@@ -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: