[fix][aur] not finding some dependencies declared as files instead of the package names

This commit is contained in:
Vinicius Moreira
2019-12-02 11:36:05 -03:00
parent a6de4caa51
commit ef5210b468
12 changed files with 54 additions and 24 deletions

View File

@@ -25,7 +25,7 @@ def request_optional_deps(pkgname: str, pkg_mirrors: dict, watcher: ProcessWatch
default_options=None)
install = watcher.request_confirmation(title=i18n['arch.install.optdeps.request.title'],
body='<p>{}</p>'.format(i18n['arch.install.optdeps.request.body'].format(bold(pkgname)) + ':'),
body='<p>{}.</p><p>{}.</p>'.format(i18n['arch.install.optdeps.request.body'].format(bold(pkgname)), i18n['arch.install.optdeps.request.help']),
components=[view_opts],
confirmation_label=i18n['install'],
deny_label=i18n['cancel'])

View File

@@ -355,21 +355,18 @@ class ArchManager(SoftwareManager):
if os.path.exists(temp_dir):
shutil.rmtree(temp_dir)
def _install_deps(self, deps: Set[str], pkg_mirrors: dict, root_password: str, handler: ProcessHandler, change_progress: bool = False) -> str:
def _install_deps(self, pkg_mirrors: dict, root_password: str, handler: ProcessHandler, change_progress: bool = False) -> str:
"""
:param deps:
:param pkg_mirrors:
:param root_password:
:param handler:
:return: not installed dependency
"""
progress_increment = int(100 / len(deps))
progress_increment = int(100 / len(pkg_mirrors))
progress = 0
self._update_progress(handler.watcher, 1, change_progress)
for pkgname in deps:
mirror = pkg_mirrors[pkgname]
for pkgname, mirror in pkg_mirrors.items():
handler.watcher.change_substatus(self.i18n['arch.install.dependency.install'].format(bold('{} ()'.format(pkgname, mirror))))
if mirror == 'aur':
installed = self._install_from_aur(pkgname=pkgname, maintainer=None, root_password=root_password, handler=handler, dependency=True, change_progress=False)
@@ -387,7 +384,7 @@ class ArchManager(SoftwareManager):
def _map_mirrors(self, pkgnames: Set[str]) -> dict:
pkg_mirrors = pacman.get_mirrors(pkgnames) # getting mirrors set
if len(pkgnames) != pkg_mirrors: # checking if any dep not found in the distro mirrors are from AUR
if len(pkgnames) != len(pkg_mirrors): # checking if any dep not found in the distro mirrors are from AUR
nomirrors = {p for p in pkgnames if p not in pkg_mirrors}
for pkginfo in self.aur_client.get_info(nomirrors):
if pkginfo.get('Name') in nomirrors:
@@ -470,10 +467,11 @@ class ArchManager(SoftwareManager):
depnames = {RE_SPLIT_VERSION.split(dep)[0] for dep in check_res['missing_deps']}
dep_mirrors = self._map_mirrors(depnames)
for dep in depnames: # cheking if a dependency could not be found in any mirror
if dep not in dep_mirrors:
message.show_dep_not_found(dep, self.i18n, handler.watcher)
return False
if len(depnames) != len(dep_mirrors): # cheking if a dependency could not be found in any mirror
for dep in depnames:
if dep not in dep_mirrors:
message.show_dep_not_found(dep, self.i18n, handler.watcher)
return False
handler.watcher.change_substatus(self.i18n['arch.missing_deps_found'].format(bold(pkgname)))
@@ -481,7 +479,7 @@ class ArchManager(SoftwareManager):
handler.watcher.print(self.i18n['action.cancelled'])
return False
dep_not_installed = self._install_deps(depnames, dep_mirrors, root_password, handler, change_progress=False)
dep_not_installed = self._install_deps(dep_mirrors, root_password, handler, change_progress=False)
if dep_not_installed:
message.show_dep_not_installed(handler.watcher, pkgname, dep_not_installed, self.i18n)
@@ -525,14 +523,14 @@ class ArchManager(SoftwareManager):
pkg_mirrors = self._map_mirrors(to_install)
if pkg_mirrors:
final_optdeps = {dep: {'desc': odeps.get(dep), 'mirror': pkg_mirrors.get(dep)} for dep in to_install if dep in pkg_mirrors}
final_optdeps = {dep: {'desc': odeps.get(dep), 'mirror': pkg_mirrors.get(dep)} for dep, mirror in pkg_mirrors.items()}
deps_to_install = confirmation.request_optional_deps(pkgname, final_optdeps, handler.watcher, self.i18n)
if not deps_to_install:
return True
else:
dep_not_installed = self._install_deps(deps_to_install, pkg_mirrors, root_password, handler, change_progress=True)
dep_not_installed = self._install_deps(pkg_mirrors, root_password, handler, change_progress=True)
if dep_not_installed:
message.show_optdep_not_installed(dep_not_installed, handler.watcher, self.i18n)

View File

@@ -1,6 +1,6 @@
import re
from threading import Thread
from typing import List, Set
from typing import List, Set, Tuple
from bauh.commons.system import run_cmd, new_subprocess, new_root_subprocess, SystemProcess
@@ -13,6 +13,17 @@ def is_enabled() -> bool:
return res and not res.strip().startswith('which ')
def get_mirror(pkg: str) -> Tuple[str, str]:
res = run_cmd('pacman -Ss {}'.format(pkg))
if res:
lines = res.split('\n')
if lines:
data = lines[0].split('/')
return data[1].split(' ')[0], data[0]
def get_mirrors(pkgs: Set[str]) -> dict:
pkgre = '|'.join(pkgs).replace('+', r'\+').replace('.', r'\.')
@@ -26,6 +37,15 @@ def get_mirrors(pkgs: Set[str]) -> dict:
if p in match:
mirrors[p] = match.split('/')[0]
not_found = {pkg for pkg in pkgs if pkg not in mirrors}
if not_found: # if there are any not found, try to find via the single method:
for dep in not_found:
mirror_data = get_mirror(dep)
if mirror_data:
mirrors[mirror_data[0]] = mirror_data[1]
return mirrors

View File

@@ -79,7 +79,8 @@ arch.install.dependency.install.error=No sha pogut instal·lar el paquet depe
arch.uninstall.required_by=No es pot desinstal·lar {} perquè és necessari per al funcionament dels paquets següents
arch.uninstall.required_by.advice=Heu de desinstal·lar-los abans de desinstal·lar {}
arch.install.optdeps.request.title=Dependències opcionals
arch.install.optdeps.request.body={} sha instal·lat correctament. Hi ha paquets opcionals associats que potser voldreu instal·lar (marqueu els que voleu)
arch.install.optdeps.request.body={} sha instal·lat correctament. Hi ha paquets opcionals associats que potser voldreu instal·lar
arch.install.optdeps.request.help=Marqueu els que voleu
arch.install.optdep.error=No sha pogut instal·lar el paquet opcional {}
arch.optdeps.checking=Sestan comprovant les dependències opcionals de {}
arch.warning.disabled=Sembla que no sha instal·lat {}. No podreu gestionar paquets Arch/AUR.

View File

@@ -47,7 +47,8 @@ arch.install.dependency.install.error=Paket {} konnte nicht installiert werden.
arch.uninstall.required_by={} konnte nicht deinstalliert werden, da es für die folgenden Pakete benötigt wird.
arch.uninstall.required_by.advice=Deinstalliere sie zuerst, bevor du {} deinstalliert
arch.install.optdeps.request.title=Optionale Abhängigkeiten
arch.install.optdeps.request.body={} wurde erfolgreich installiert! Es gibt optionale zugehörige Pakete welche du vielleicht auch installieren möchtest (wähle entsprechende aus)
arch.install.optdeps.request.body={} wurde erfolgreich installiert! Es gibt optionale zugehörige Pakete welche du vielleicht auch installieren möchtest
arch.install.optdeps.request.help=Wähle entsprechende aus
arch.install.optdep.error=Optionales Paket {} konnte nicht installiert werden
arch.optdeps.checking={} optionale Abhängigkeiten überprüfen
arch.warning.disabled={} scheint nicht intstalliert zu sein. Die Verwaltung von Arch / AUR Pakten wird nicht möglich sein.

View File

@@ -47,7 +47,8 @@ arch.install.dependency.install.error=Could not install dependent package {}. In
arch.uninstall.required_by={} cannot be uninstalled because it is necessary for these following packages to work
arch.uninstall.required_by.advice=Uninstall them first before uninstalling {}.
arch.install.optdeps.request.title=Optional dependencies
arch.install.optdeps.request.body={} was succesfully installed ! There are some optional associated packages that you might want to install ( check those you want )
arch.install.optdeps.request.body={} was succesfully installed ! There are some optional associated packages that you might want to install
arch.install.optdeps.request.help=Check those you want
arch.install.optdep.error=Could not install the optional package {}
arch.optdeps.checking=Checking {} optional dependencies
arch.warning.disabled={} seems not to be installed. It will not be possible to manage Arch / AUR packages.

View File

@@ -79,7 +79,8 @@ arch.install.dependency.install.error=No se pudo instalar el paquete dependiente
arch.uninstall.required_by=No se puede desinstalar {} porque es necesario para que los siguientes paquetes funcionen
arch.uninstall.required_by.advice=Debe desinstalarlos primero antes de desinstalar {}
arch.install.optdeps.request.title=Dependencias opcionales
arch.install.optdeps.request.body=¡{} se instaló correctamente! Hay algunos paquetes opcionales asociados que es posible que desee instalar ( marque los que desee )
arch.install.optdeps.request.body=¡{} se instaló correctamente! Hay algunos paquetes opcionales asociados que es posible que desee instalar
arch.install.optdeps.request.help=Marque los que desee
arch.install.optdep.error=No se pudo instalar el paquete opcional {}
arch.optdeps.checking=Verificando las dependencias opcionales de {}
arch.warning.disabled={} parece no estar instalado. No será posible administrar paquetes Arch / AUR.

View File

@@ -47,7 +47,8 @@ arch.install.dependency.install.error=Impossibile installare il pacchetto dipend
arch.uninstall.required_by={} non può essere disinstallato perché è necessario che i seguenti pacchetti funzionino
arch.uninstall.required_by.advice= Uninstall them first before uninstalling {}.
arch.install.optdeps.request.title=Dipendenze opzionali
arch.install.optdeps.request.body={} è stato installato con successo! Ci sono alcuni pacchetti associati opzionali che potresti voler installare (controlla quelli che vuoi)
arch.install.optdeps.request.body={} è stato installato con successo! Ci sono alcuni pacchetti associati opzionali che potresti voler installare
arch.install.optdeps.request.help=Controlla quelli che vuoi
arch.install.optdep.error=Impossibile installare il pacchetto opzionale {}
arch.optdeps.checking=Verifica di {} dipendenze opzionali
arch.warning.disabled={} sembra non essere installato. Non sarà possibile gestire i pacchetti Arch/AUR.

View File

@@ -79,7 +79,8 @@ arch.install.dependency.install.error=Não foi possível instalar o pacote depen
arch.uninstall.required_by={} não pode ser desinstalado porque ele é necessário para o funcionamento dos seguintes pacotes
arch.uninstall.required_by.advice=Desinstale eles primeiro antes de desinstalar {}
arch.install.optdeps.request.title=Dependências opcionais
arch.install.optdeps.request.body={} foi instalado com sucesso ! Existem alguns pacotes associados opcionais que você talvez queira instalar ( marque os desejados )
arch.install.optdeps.request.body={} foi instalado com sucesso ! Existem alguns pacotes opcionais associados que você talvez queira instalar
arch.install.optdeps.request.help=Marque os desejados
arch.install.optdep.error=Não foi possível instalar o pacote opcional {}
arch.optdeps.checking=Verificando as dependências opcionais de {}
arch.warning.disabled={} parece não estar instalado. Não será possível gerenciar pacotes Arch / AUR.