From 98ea92bc1f36cdecf761f4f4177639d9c49355df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Moreira?= Date: Wed, 18 Dec 2019 18:42:38 -0300 Subject: [PATCH] [aur] fix config reading during dependency checking --- bauh/gems/arch/__init__.py | 4 ---- bauh/gems/arch/controller.py | 2 +- bauh/gems/arch/makepkg.py | 6 +++--- bauh/gems/arch/worker.py | 2 +- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/bauh/gems/arch/__init__.py b/bauh/gems/arch/__init__.py index 10103d7f..bb582a62 100644 --- a/bauh/gems/arch/__init__.py +++ b/bauh/gems/arch/__init__.py @@ -12,7 +12,3 @@ CONFIG_DIR = '{}/.config/bauh/arch'.format(HOME_PATH) CUSTOM_MAKEPKG_PATH = '{}/makepkg.conf'.format(CONFIG_DIR) AUR_INDEX_FILE = '{}/aur.txt'.format(BUILD_DIR) CONFIG_FILE = '{}/arch.yml'.format(CONFIG_PATH) - - -def should_optimize_compilation() -> bool: - return bool(int(os.getenv('BAUH_ARCH_OPTIMIZE', 1))) diff --git a/bauh/gems/arch/controller.py b/bauh/gems/arch/controller.py index 43b899a7..5cbe866e 100644 --- a/bauh/gems/arch/controller.py +++ b/bauh/gems/arch/controller.py @@ -528,7 +528,7 @@ class ArchManager(SoftwareManager): def _handle_deps_and_keys(self, pkgname: str, root_password: str, handler: ProcessHandler, pkgdir: str, check_subdeps: bool = True) -> bool: handler.watcher.change_substatus(self.i18n['arch.checking.deps'].format(bold(pkgname))) - check_res = makepkg.check(pkgdir, handler) + check_res = makepkg.check(pkgdir, optimize=self.local_config['optimize'], handler=handler) if check_res: if check_res.get('missing_deps'): diff --git a/bauh/gems/arch/makepkg.py b/bauh/gems/arch/makepkg.py index 08f2e0a8..c2a2ccfc 100644 --- a/bauh/gems/arch/makepkg.py +++ b/bauh/gems/arch/makepkg.py @@ -3,18 +3,18 @@ import re from typing import Tuple from bauh.commons.system import SimpleProcess, ProcessHandler -from bauh.gems.arch import CUSTOM_MAKEPKG_PATH, should_optimize_compilation +from bauh.gems.arch import CUSTOM_MAKEPKG_PATH RE_DEPS_PATTERN = re.compile(r'\n?\s+->\s(.+)\n') RE_UNKNOWN_GPG_KEY = re.compile(r'\(unknown public key (\w+)\)') -def check(pkgdir: str, handler: ProcessHandler) -> dict: +def check(pkgdir: str, optimize: bool, handler: ProcessHandler) -> dict: res = {} cmd = ['makepkg', '-ALcf', '--check', '--noarchive', '--nobuild', '--noprepare'] - if should_optimize_compilation(): + if optimize: if os.path.exists(CUSTOM_MAKEPKG_PATH): handler.watcher.print('Using custom makepkg.conf -> {}'.format(CUSTOM_MAKEPKG_PATH)) cmd.append('--config={}'.format(CUSTOM_MAKEPKG_PATH)) diff --git a/bauh/gems/arch/worker.py b/bauh/gems/arch/worker.py index 61f1f4f5..0494a298 100644 --- a/bauh/gems/arch/worker.py +++ b/bauh/gems/arch/worker.py @@ -8,7 +8,7 @@ from threading import Thread import requests from bauh.api.abstract.context import ApplicationContext -from bauh.gems.arch import pacman, disk, CUSTOM_MAKEPKG_PATH, CONFIG_DIR, should_optimize_compilation, BUILD_DIR, \ +from bauh.gems.arch import pacman, disk, CUSTOM_MAKEPKG_PATH, CONFIG_DIR, BUILD_DIR, \ AUR_INDEX_FILE, config URL_INDEX = 'https://aur.archlinux.org/packages.gz'