From 7dae74e3d014e2383c6a7032e2ceab2aa4ed752e Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Mon, 26 Oct 2020 11:55:28 -0300 Subject: [PATCH] [arch] fix -> AUR: not able to find some repository dependencies when their names are not an exact match --- CHANGELOG.md | 5 +++++ bauh/gems/arch/dependencies.py | 13 +++++++++++++ bauh/gems/arch/makepkg.py | 2 +- bauh/gems/arch/pacman.py | 11 +++++++++++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 881a5c89..e49d03a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## [0.9.9] +### Fixes +- Arch: + - AUR: not able to find some repository dependencies when their names are not an exact match (e.g: sc-controller [0.4.7-1] relies on "pylibacl". This dependency now is called "python-pylibacl") + ## [0.9.8] 2020-10-02 ### Fixes - Arch diff --git a/bauh/gems/arch/dependencies.py b/bauh/gems/arch/dependencies.py index 1f129a40..1f9d588f 100644 --- a/bauh/gems/arch/dependencies.py +++ b/bauh/gems/arch/dependencies.py @@ -185,12 +185,25 @@ class DependenciesAnalyser: if dep_name == dep_exp: providers = remote_provided_map.get(dep_name) + + if not providers: # try to find the package through the pacman's search mechanism + match = pacman.find_one_match(dep_name) + + if match: + providers = {match} + else: # handling cases when the dep has an expression ( e.g: xpto>=0.12 ) providers = remote_provided_map.get(dep_exp) if providers is None: providers = remote_provided_map.get(dep_name) + if not providers: # try to find the package through the pacman's search mechanism + match = pacman.find_one_match(dep_name) + + if match: + providers = {match} + if providers and len(providers) > 1: no_mapped_data = {p for p in providers if p not in deps_data} # checking providers with no mapped data diff --git a/bauh/gems/arch/makepkg.py b/bauh/gems/arch/makepkg.py index 60b26640..424697ef 100644 --- a/bauh/gems/arch/makepkg.py +++ b/bauh/gems/arch/makepkg.py @@ -50,7 +50,7 @@ def check(pkgdir: str, optimize: bool, missing_deps: bool, handler: ProcessHandl def make(pkgdir: str, optimize: bool, handler: ProcessHandler, custom_pkgbuild: Optional[str] = None) -> Tuple[bool, str]: - cmd = ['makepkg', '-ALcsmf', '--skipchecksums'] + cmd = ['makepkg', '-ALcsmf', '--skipchecksums', '--nodeps'] if custom_pkgbuild: cmd.append('-p') diff --git a/bauh/gems/arch/pacman.py b/bauh/gems/arch/pacman.py index 50ef39f7..0eb36791 100644 --- a/bauh/gems/arch/pacman.py +++ b/bauh/gems/arch/pacman.py @@ -151,6 +151,7 @@ def install_as_process(pkgpaths: Iterable[str], root_password: str, file: bool, if not simulate: cmd.append('--noconfirm') + cmd.append('-dd') if overwrite_conflicting_files: cmd.append('--overwrite=*') @@ -1172,3 +1173,13 @@ def list_post_uninstall_unneeded_packages(names: Set[str]) -> Set[str]: reqs.add(line_strip) return reqs + + +def find_one_match(name: str) -> Optional[str]: + output = run_cmd('pacman -Ssq {}'.format(name), print_error=False) + + if output: + matches = [l.strip() for l in output.split('\n') if l.strip()] + + if matches and len(matches) == 1: + return matches[0]