diff --git a/bauh/gems/arch/confirmation.py b/bauh/gems/arch/confirmation.py index 4854e777..98b85aee 100644 --- a/bauh/gems/arch/confirmation.py +++ b/bauh/gems/arch/confirmation.py @@ -8,8 +8,8 @@ from bauh.commons.html import bold def request_optional_deps(pkgname: str, pkg_mirrors: dict, watcher: ProcessWatcher, i18n: dict) -> Set[str]: view_opts = MultipleSelectComponent(label='', - options=[InputOption('{} ( {} )'.format(p, m.upper()), p) for p, m in - pkg_mirrors.items()]) + options=[InputOption('{}{} ( {} )'.format(p, ': ' + d['desc'] if d['desc'] else '', d['mirror'].upper()), p) + for p, d in pkg_mirrors.items()]) install = watcher.request_confirmation(title=i18n['arch.install.optdeps.request.title'], body='

{}

'.format(i18n['arch.install.optdeps.request.body'].format(bold(pkgname)) + ':'), components=[view_opts], diff --git a/bauh/gems/arch/controller.py b/bauh/gems/arch/controller.py index a58074ce..96e7e91f 100644 --- a/bauh/gems/arch/controller.py +++ b/bauh/gems/arch/controller.py @@ -247,8 +247,8 @@ class ArchManager(SoftwareManager): res_srcinfo = self.context.http_client.get(URL_SRC_INFO + pkg.name) if res_srcinfo and res_srcinfo.text: - info['11_dependson'] = ' '.join(pkgbuild.read_depends_on(res_srcinfo.text)) - info['12_optdepends'] = ' '.join(pkgbuild.read_optdeps(res_srcinfo.text)) + info['11_dependson'] = '\n'.join(pkgbuild.read_depends_on(res_srcinfo.text)) + info['12_optdepends'] = '\n'.join(pkgbuild.read_optdeps(res_srcinfo.text)) if pkg.pkgbuild: info['13_pkg_build'] = pkg.pkgbuild @@ -339,7 +339,7 @@ class ArchManager(SoftwareManager): # building main package handler.watcher.change_substatus(self.i18n['arch.building.package'].format(bold(pkgname))) - pkgbuilt = handler.handle(SystemProcess(new_subprocess(['makepkg', '-ALcsmf'], cwd=project_dir))) + pkgbuilt = handler.handle(SystemProcess(new_subprocess(['makepkg', '-ALcsmf'], cwd=project_dir), check_error_output=False)) self._update_progress(handler.watcher, 65, change_progress) if pkgbuilt: @@ -392,7 +392,7 @@ class ArchManager(SoftwareManager): def _install_optdeps(self, pkgname: str, root_password: str, handler: ProcessHandler, pkgdir: str, change_progress: bool = True) -> bool: with open('{}/.SRCINFO'.format(pkgdir)) as f: - odeps = pkgbuild.read_optdeps(f.read()) + odeps = pkgbuild.read_optdeps_as_dict(f.read()) if not odeps: return True @@ -406,7 +406,9 @@ class ArchManager(SoftwareManager): pkg_mirrors = self._map_mirrors(to_install) if pkg_mirrors: - deps_to_install = confirmation.request_optional_deps(pkgname, pkg_mirrors, handler.watcher, self.i18n) + final_optdeps = {dep: {'desc': odeps[dep], 'mirror': pkg_mirrors[dep]} for dep in to_install} + + deps_to_install = confirmation.request_optional_deps(pkgname, final_optdeps, handler.watcher, self.i18n) if not deps_to_install: return True @@ -477,7 +479,7 @@ class ArchManager(SoftwareManager): file_url = URL_PKG_DOWNLOAD.format(pkgname) file_name = file_url.split('/')[-1] handler.watcher.change_substatus('{} {}'.format(self.i18n['arch.downloading.package'], bold(file_name))) - download = handler.handle(SystemProcess(new_subprocess(['wget', file_url], cwd=app_build_dir))) + download = handler.handle(SystemProcess(new_subprocess(['wget', file_url], cwd=app_build_dir), check_error_output=False)) if download: self._update_progress(handler.watcher, 30, change_progress) diff --git a/bauh/gems/arch/pkgbuild.py b/bauh/gems/arch/pkgbuild.py index 40d19c29..0b92e9a8 100644 --- a/bauh/gems/arch/pkgbuild.py +++ b/bauh/gems/arch/pkgbuild.py @@ -1,8 +1,17 @@ import re from typing import Set -RE_PKGBUILD_OPTDEPS = re.compile(r"optdepends = ([^:\s]+)") -RE_PKGBUILD_DEPSON = re.compile(r"depends = ([^:\s]+)") +RE_PKGBUILD_OPTDEPS = re.compile(r"optdepends = (.+)") +RE_PKGBUILD_DEPSON = re.compile(r"\s+depends = (.+)") + + +def read_optdeps_as_dict(srcinfo: str) -> dict: + res = {} + for optdep in read_opts_deps(srcinfo): + split_dep = optdep.split(':') + res[split_dep[0].strip()] = split_dep[1].strip() if len(split_dep) > 1 else None + + return res def read_optdeps(srcinfo: str) -> Set[str]: