diff --git a/CHANGELOG.md b/CHANGELOG.md index de14e879..2ce7e9f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,9 +7,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [0.9.5] 2020 ### Improvements +- Arch + - new **automatch_providers** settings: bauh will automatically choose which provider will be used for a package dependency when both names are equal. +

+ +

+ - minor UI improvements - download clients parameters + ### Fixes - regressions (from **0.9.4**) - resetting the main configuration when tray mode is active [#118](https://github.com/vinifmor/bauh/issues/118) diff --git a/README.md b/README.md index 74a70996..c3522458 100644 --- a/README.md +++ b/README.md @@ -183,6 +183,7 @@ mirrors_sort_limit: 5 # defines the maximum number of mirrors that will be used aur: true # allows to manage AUR packages repositories: true # allows to manage packages from the configured repositories repositories_mthread_download: true # enable multi-threaded download for repository packages if aria2 is installed +automatch_providers: true # if a possible provider for a given package dependency exactly matches its name, it will be chosen instead of asking for the user to decide (false). ``` - Required dependencies: - **pacman** diff --git a/bauh/gems/arch/config.py b/bauh/gems/arch/config.py index c40674d3..2c511bc3 100644 --- a/bauh/gems/arch/config.py +++ b/bauh/gems/arch/config.py @@ -11,5 +11,6 @@ def read_config(update_file: bool = False) -> dict: "refresh_mirrors_startup": False, "sync_databases_startup": True, 'mirrors_sort_limit': 5, - 'repositories_mthread_download': True} + 'repositories_mthread_download': True, + 'automatch_providers': True} return read(CONFIG_FILE, template, update_file=update_file) diff --git a/bauh/gems/arch/controller.py b/bauh/gems/arch/controller.py index 5423ffa8..c9766c3c 100644 --- a/bauh/gems/arch/controller.py +++ b/bauh/gems/arch/controller.py @@ -1514,6 +1514,7 @@ class ArchManager(SoftwareManager): sort=True, remote_provided_map=context.get_remote_provided_map(), remote_repo_map=context.get_remote_repo_map(), + automatch_providers=context.config['automatch_providers'], watcher=context.watcher) tf = time.time() @@ -1615,6 +1616,7 @@ class ArchManager(SoftwareManager): watcher=context.watcher, remote_provided_map=remote_provided_map, remote_repo_map=remote_repo_map, + automatch_providers=context.config['automatch_providers'], sort=False) if missing_deps is None: @@ -2122,6 +2124,11 @@ class ArchManager(SoftwareManager): tooltip_key='arch.config.optimize.tip', value=bool(local_config['optimize']), max_width=max_width), + self._gen_bool_selector(id_='autoprovs', + label_key='arch.config.automatch_providers', + tooltip_key='arch.config.automatch_providers.tip', + value=bool(local_config['automatch_providers']), + max_width=max_width), self._gen_bool_selector(id_='mthread_download', label_key='arch.config.pacman_mthread_download', tooltip_key='arch.config.pacman_mthread_download.tip', @@ -2167,6 +2174,7 @@ class ArchManager(SoftwareManager): config['refresh_mirrors_startup'] = form_install.get_component('ref_mirs').get_selected() config['mirrors_sort_limit'] = form_install.get_component('mirrors_sort_limit').get_int_value() config['repositories_mthread_download'] = form_install.get_component('mthread_download').get_selected() + config['automatch_providers'] = form_install.get_component('autoprovs').get_selected() try: save_config(config, CONFIG_FILE) diff --git a/bauh/gems/arch/dependencies.py b/bauh/gems/arch/dependencies.py index ed4ee018..24404504 100644 --- a/bauh/gems/arch/dependencies.py +++ b/bauh/gems/arch/dependencies.py @@ -178,7 +178,8 @@ class DependenciesAnalyser: def _fill_missing_dep(self, dep_name: str, dep_exp: str, aur_index: Iterable[str], missing_deps: Set[Tuple[str, str]], remote_provided_map: Dict[str, Set[str]], remote_repo_map: Dict[str, str], - repo_deps: Set[str], aur_deps: Set[str], deps_data: Dict[str, dict], watcher: ProcessWatcher): + repo_deps: Set[str], aur_deps: Set[str], deps_data: Dict[str, dict], watcher: ProcessWatcher, + automatch_providers: bool): if dep_name == dep_exp: providers = remote_provided_map.get(dep_name) @@ -222,7 +223,16 @@ class DependenciesAnalyser: if providers: if len(providers) > 1: - dep_data = (dep_name, '__several__') + dep_data = None + + if automatch_providers: + exact_matches = [p for p in providers if p == dep_name] + + if exact_matches: + dep_data = (exact_matches[0], remote_repo_map.get(exact_matches[0])) + + if not dep_data: + dep_data = (dep_name, '__several__') else: real_name = providers.pop() dep_data = (real_name, remote_repo_map.get(real_name)) @@ -246,7 +256,8 @@ class DependenciesAnalyser: def map_missing_deps(self, pkgs_data: Dict[str, dict], provided_map: Dict[str, Set[str]], remote_provided_map: Dict[str, Set[str]], remote_repo_map: Dict[str, str], aur_index: Iterable[str], deps_checked: Set[str], deps_data: Dict[str, dict], - sort: bool, watcher: ProcessWatcher, choose_providers: bool = True) -> List[Tuple[str, str]]: + sort: bool, watcher: ProcessWatcher, choose_providers: bool = True, + automatch_providers: bool = False) -> List[Tuple[str, str]]: sorted_deps = [] # it will hold the proper order to install the missing dependencies missing_deps, repo_missing, aur_missing = set(), set(), set() @@ -271,7 +282,8 @@ class DependenciesAnalyser: remote_provided_map=remote_provided_map, remote_repo_map=remote_repo_map, repo_deps=repo_missing, aur_deps=aur_missing, watcher=watcher, - deps_data=deps_data) + deps_data=deps_data, + automatch_providers=automatch_providers) else: version_pattern = '{}='.format(dep_name) version_found = [p for p in provided_map if p.startswith(version_pattern)] @@ -297,7 +309,8 @@ class DependenciesAnalyser: remote_repo_map=remote_repo_map, repo_deps=repo_missing, aur_deps=aur_missing, watcher=watcher, - deps_data=deps_data) + deps_data=deps_data, + automatch_providers=automatch_providers) else: self._fill_missing_dep(dep_name=dep_name, dep_exp=dep, aur_index=aur_index, missing_deps=missing_deps, @@ -305,7 +318,8 @@ class DependenciesAnalyser: remote_repo_map=remote_repo_map, repo_deps=repo_missing, aur_deps=aur_missing, watcher=watcher, - deps_data=deps_data) + deps_data=deps_data, + automatch_providers=automatch_providers) if missing_deps: if repo_missing: @@ -339,6 +353,7 @@ class DependenciesAnalyser: watcher=watcher, remote_provided_map=remote_provided_map, remote_repo_map=remote_repo_map, + automatch_providers=automatch_providers, choose_providers=False) if missing_subdeps: @@ -353,7 +368,8 @@ class DependenciesAnalyser: return self.fill_providers_deps(missing_deps=sorted_deps, provided_map=provided_map, remote_provided_map=remote_provided_map, remote_repo_map=remote_repo_map, watcher=watcher, sort=sort, already_checked=deps_checked, - aur_idx=aur_index, deps_data=deps_data) + aur_idx=aur_index, deps_data=deps_data, + automatch_providers=automatch_providers) return sorted_deps @@ -361,7 +377,7 @@ class DependenciesAnalyser: provided_map: Dict[str, Set[str]], remote_repo_map: Dict[str, str], already_checked: Set[str], remote_provided_map: Dict[str, Set[str]], deps_data: Dict[str, dict], aur_idx: Iterable[str], sort: bool, - watcher: ProcessWatcher) -> List[Tuple[str, str]]: + watcher: ProcessWatcher, automatch_providers: bool) -> List[Tuple[str, str]]: """ :param missing_deps: :param provided_map: @@ -372,6 +388,7 @@ class DependenciesAnalyser: :param aur_idx: :param sort: :param watcher: + :param automatch_providers :return: all deps sorted or None if the user declined the providers options """ @@ -404,7 +421,8 @@ class DependenciesAnalyser: remote_provided_map=remote_provided_map, remote_repo_map=remote_repo_map, watcher=watcher, - choose_providers=True) + choose_providers=True, + automatch_providers=automatch_providers) # cleaning the already mapped providers deps: to_remove = [] @@ -427,7 +445,8 @@ class DependenciesAnalyser: if not self.fill_providers_deps(missing_deps=missing_deps, provided_map=provided_map, remote_repo_map=remote_repo_map, already_checked=already_checked, aur_idx=aur_idx, remote_provided_map=remote_provided_map, - deps_data=deps_data, sort=False, watcher=watcher): + deps_data=deps_data, sort=False, watcher=watcher, + automatch_providers=automatch_providers): return if sort: diff --git a/bauh/gems/arch/resources/locale/ca b/bauh/gems/arch/resources/locale/ca index b6d7882b..7f114f37 100644 --- a/bauh/gems/arch/resources/locale/ca +++ b/bauh/gems/arch/resources/locale/ca @@ -22,6 +22,8 @@ arch.checking.missing_deps=Verificació de les dependències que falten de {} arch.clone=S’està clonant el dipòsit {} de l’AUR arch.config.aur=AUR packages arch.config.aur.tip=It allows to manage AUR packages +arch.config.automatch_providers=Auto-define dependency providers +arch.config.automatch_providers.tip=It automatically chooses which provider will be used for a package dependency when both names are equal. arch.config.clean_cache=Elimina les versions antigues arch.config.clean_cache.tip=Si cal eliminar les versions antigues d'un paquet emmagatzemat al disc durant la desinstal·lació arch.config.mirrors_sort_limit=Mirrors sort limit diff --git a/bauh/gems/arch/resources/locale/de b/bauh/gems/arch/resources/locale/de index f67865a0..3f556069 100644 --- a/bauh/gems/arch/resources/locale/de +++ b/bauh/gems/arch/resources/locale/de @@ -22,6 +22,8 @@ arch.checking.missing_deps=Überprüfen der fehlenden Abhängigkeiten von {} arch.clone=AUR Repository {} wird kopiert arch.config.aur=AUR packages arch.config.aur.tip=It allows to manage AUR packages +arch.config.automatch_providers=Auto-define dependency providers +arch.config.automatch_providers.tip=It automatically chooses which provider will be used for a package dependency when both names are equal. arch.config.clean_cache=Remove old versions arch.config.clean_cache.tip=Whether old versions of a package stored on disk should be removed during uninstall arch.config.mirrors_sort_limit=Mirrors sort limit diff --git a/bauh/gems/arch/resources/locale/en b/bauh/gems/arch/resources/locale/en index 59fa52f5..e50f16c5 100644 --- a/bauh/gems/arch/resources/locale/en +++ b/bauh/gems/arch/resources/locale/en @@ -22,6 +22,8 @@ arch.checking.missing_deps=Verifying missing dependencies of {} arch.clone=Cloning the AUR repository {} arch.config.aur=AUR packages arch.config.aur.tip=It allows to manage AUR packages +arch.config.automatch_providers=Auto-define dependency providers +arch.config.automatch_providers.tip=It automatically chooses which provider will be used for a package dependency when both names are equal. arch.config.clean_cache=Remove old versions arch.config.clean_cache.tip=Whether old versions of a package stored on disk should be removed during uninstall arch.config.mirrors_sort_limit=Mirrors sort limit diff --git a/bauh/gems/arch/resources/locale/es b/bauh/gems/arch/resources/locale/es index 1c912e65..62ddba54 100644 --- a/bauh/gems/arch/resources/locale/es +++ b/bauh/gems/arch/resources/locale/es @@ -22,6 +22,8 @@ arch.checking.missing_deps=Verificando las dependencias faltantes de {} arch.clone=Clonando el repositorio {} de AUR arch.config.aur=Paquetes de AUR arch.config.aur.tip=Permite gestionar paquetes del AUR +arch.config.automatch_providers=Autodefinir proveedores de dependencia +arch.config.automatch_providers.tip=Elige automáticamente qué proveedor se usará para una dependencia de paquete cuando ambos nombres son iguales. arch.config.clean_cache=Eliminar versiones antiguas arch.config.clean_cache.tip=Si las versiones antiguas de un paquete almacenado en el disco deben ser eliminadas durante la desinstalación arch.config.mirrors_sort_limit=Límite de ordenación de espejos diff --git a/bauh/gems/arch/resources/locale/it b/bauh/gems/arch/resources/locale/it index 12df9b7f..ec76bfa3 100644 --- a/bauh/gems/arch/resources/locale/it +++ b/bauh/gems/arch/resources/locale/it @@ -22,6 +22,8 @@ arch.checking.missing_deps=Verifica delle dipendenze mancanti di {} arch.clone=Clonazione del repository AUR {} arch.config.aur=AUR packages arch.config.aur.tip=It allows to manage AUR packages +arch.config.automatch_providers=Auto-define dependency providers +arch.config.automatch_providers.tip=It automatically chooses which provider will be used for a package dependency when both names are equal. arch.config.clean_cache=Rimuovi le vecchie versioni arch.config.clean_cache.tip=Se le vecchie versioni di un pacchetto memorizzate sul disco devono essere rimosse durante la disinstallazione arch.config.mirrors_sort_limit=Mirrors sort limit diff --git a/bauh/gems/arch/resources/locale/pt b/bauh/gems/arch/resources/locale/pt index d817da5e..0c80cfcb 100644 --- a/bauh/gems/arch/resources/locale/pt +++ b/bauh/gems/arch/resources/locale/pt @@ -22,6 +22,8 @@ arch.checking.missing_deps=Verificando dependências ausentes de {} arch.clone=Clonando o repositório {} do AUR arch.config.aur=Pacotes do AUR arch.config.aur.tip=Permite gerenciar pacotes dos AUR +arch.config.automatch_providers=Auto-definir provedores de dependências +arch.config.automatch_providers.tip=Escolhe automaticamente qual provedor será utilizado para determinada dependência de um pacote caso os nomes de ambos sejam iguais. arch.config.clean_cache=Remover versões antigas arch.config.clean_cache.tip=Se versões antigas de um pacote armazenadas em disco devem ser removidas durante a desinstalação arch.config.mirrors_sort_limit=Limite de ordenação de espelhos diff --git a/bauh/gems/arch/resources/locale/ru b/bauh/gems/arch/resources/locale/ru index cdf5eeac..67d9b0f8 100644 --- a/bauh/gems/arch/resources/locale/ru +++ b/bauh/gems/arch/resources/locale/ru @@ -22,6 +22,8 @@ arch.checking.missing_deps=Проверка отсутствующих зави arch.clone=Клонирование AUR-репозитория {} arch.config.aur=пакеты AUR arch.config.aur.tip=Это позволяет управлять пакетами AUR +arch.config.automatch_providers=Auto-define dependency providers +arch.config.automatch_providers.tip=It automatically chooses which provider will be used for a package dependency when both names are equal. arch.config.clean_cache=Remove old versions arch.config.clean_cache.tip=Whether old versions of a package stored on disk should be removed during uninstall arch.config.mirrors_sort_limit=Ограничение сортировки зеркал diff --git a/bauh/gems/arch/resources/locale/tr b/bauh/gems/arch/resources/locale/tr index 98b2d95e..3fec7930 100644 --- a/bauh/gems/arch/resources/locale/tr +++ b/bauh/gems/arch/resources/locale/tr @@ -22,6 +22,8 @@ arch.checking.missing_deps={} eksik bağımlılıkları kontrol ediliyor arch.clone=AUR deposu kopyalanıyor {} arch.config.aur=AUR paketleri arch.config.aur.tip=AUR paketlerinin yönetilmesine izin verir +arch.config.automatch_providers=Auto-define dependency providers +arch.config.automatch_providers.tip=It automatically chooses which provider will be used for a package dependency when both names are equal. arch.config.clean_cache=Önbelleği temizle arch.config.clean_cache.tip=Disk üzerinde kurulu bir paketin eski sürümlerinin kaldırma sırasında kaldırılıp kaldırılmayacağı arch.config.mirrors_sort_limit=Yansı sıralama sınırı diff --git a/bauh/gems/arch/updates.py b/bauh/gems/arch/updates.py index 7819b59c..9a6a8ad7 100644 --- a/bauh/gems/arch/updates.py +++ b/bauh/gems/arch/updates.py @@ -253,7 +253,8 @@ class UpdatesSummarizer: deps_data=deps_data, remote_provided_map=context.remote_provided_map, remote_repo_map=context.remote_repo_map, - watcher=self.watcher) + watcher=self.watcher, + automatch_providers=context.arch_config['automatch_providers']) if deps is None: tf = time.time() diff --git a/pictures/releases/0.9.5/arch_providers.png b/pictures/releases/0.9.5/arch_providers.png new file mode 100644 index 00000000..fca86745 Binary files /dev/null and b/pictures/releases/0.9.5/arch_providers.png differ