[aur] respecting BAUH_ARCH_OPTIMIZE when makepkg calls are executed

This commit is contained in:
Vinicius Moreira
2019-11-29 09:05:20 -03:00
parent 915c3b50a3
commit dca66b315e
3 changed files with 26 additions and 12 deletions

View File

@@ -3,7 +3,7 @@ import re
from typing import Tuple
from bauh.commons.system import SimpleProcess, ProcessHandler
from bauh.gems.arch import CUSTOM_MAKEPKG_PATH
from bauh.gems.arch import CUSTOM_MAKEPKG_PATH, should_optimize_compilation
RE_DEPS_PATTERN = re.compile(r'\n?\s+->\s(.+)\n')
RE_UNKNOWN_GPG_KEY = re.compile(r'\(unknown public key (\w+)\)')
@@ -14,9 +14,12 @@ def check(pkgdir: str, handler: ProcessHandler) -> dict:
cmd = ['makepkg', '-ALcf', '--check', '--noarchive', '--nobuild', '--noprepare']
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))
if should_optimize_compilation():
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))
else:
handler.watcher.print('Custom optimized makepkg.conf ( {} ) not found'.format(CUSTOM_MAKEPKG_PATH))
success, output = handler.handle_simple(SimpleProcess(cmd, cwd=pkgdir))
@@ -37,9 +40,11 @@ def check(pkgdir: str, handler: ProcessHandler) -> dict:
def make(pkgdir: str, handler: ProcessHandler) -> Tuple[bool, str]:
cmd = ['makepkg', '-ALcsmf']
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))
if should_optimize_compilation():
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))
else:
handler.watcher.print('Custom optimized makepkg.conf ( {} ) not found'.format(CUSTOM_MAKEPKG_PATH))
return handler.handle_simple(SimpleProcess(cmd, cwd=pkgdir))