From b130ad6d0b5f565ed74ea695cd24200e3f4cee03 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Mon, 31 Jan 2022 15:26:37 -0300 Subject: [PATCH] [arch] improvement: explicitly marking installed dependent packages as 'dependencies' (installation) --- CHANGELOG.md | 3 ++- bauh/gems/arch/controller.py | 6 ++++-- bauh/gems/arch/pacman.py | 5 ++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3015b5b2..b4606166 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,9 +11,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - not rechecking sub-dependencies of an AUR dependency to be installed - allowing AUR packages to be installed as dependencies of a repository package - always listing repository packages as primary options when multiple providers for a given dependency are available + - installation: explicitly marking installed dependent packages as "dependencies" (`--asdeps`) - settings: - "Auto-define dependency providers" property renamed to "Auto-match dependency by name" - - new property 'prefer_repository_provider': automatically picks the single package from the repositories among several external (AUR) available as the provider for a given dependency + - new property 'prefer_repository_provider': automatically picks the single package from the repositories among several external (AUR) available as the provider for a given dependency ### Fixes - General diff --git a/bauh/gems/arch/controller.py b/bauh/gems/arch/controller.py index ccef1f49..a93d9442 100644 --- a/bauh/gems/arch/controller.py +++ b/bauh/gems/arch/controller.py @@ -1760,7 +1760,8 @@ class ArchManager(SoftwareManager): status_handler.start() installed, _ = context.handler.handle_simple(pacman.install_as_process(pkgpaths=repo_dep_names, root_password=context.root_password, - file=False), + file=False, + as_deps=True), output_handler=status_handler.handle) if installed: @@ -2427,7 +2428,8 @@ class ArchManager(SoftwareManager): root_password=context.root_password, file=context.has_install_files(), pkgdir=context.project_dir, - overwrite_conflicting_files=overwrite_files), + overwrite_conflicting_files=overwrite_files, + as_deps=context.dependency), output_handler=status_handler.handle if status_handler else None) def _handle_install_call(self, context: TransactionContext, to_install: List[str], status_handler) -> bool: diff --git a/bauh/gems/arch/pacman.py b/bauh/gems/arch/pacman.py index 7bda9593..2116b601 100644 --- a/bauh/gems/arch/pacman.py +++ b/bauh/gems/arch/pacman.py @@ -147,7 +147,7 @@ def map_installed(names: Iterable[str] = None) -> dict: # returns a dict with w def install_as_process(pkgpaths: Iterable[str], root_password: str, file: bool, pkgdir: str = '.', - overwrite_conflicting_files: bool = False, simulate: bool = False) -> SimpleProcess: + overwrite_conflicting_files: bool = False, simulate: bool = False, as_deps: bool = False) -> SimpleProcess: cmd = ['pacman', '-U'] if file else ['pacman', '-S'] cmd.extend(pkgpaths) @@ -158,6 +158,9 @@ def install_as_process(pkgpaths: Iterable[str], root_password: str, file: bool, if overwrite_conflicting_files: cmd.append('--overwrite=*') + if as_deps: + cmd.append('--asdeps') + return SimpleProcess(cmd=cmd, root_password=root_password, cwd=pkgdir,