[aur] generating the optimized makepkg file if it is not found during an installation

This commit is contained in:
Vinícius Moreira
2019-12-18 19:13:02 -03:00
parent 98ea92bc1f
commit ce1f30365d
11 changed files with 92 additions and 79 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_FILE
RE_DEPS_PATTERN = re.compile(r'\n?\s+->\s(.+)\n')
RE_UNKNOWN_GPG_KEY = re.compile(r'\(unknown public key (\w+)\)')
@@ -15,11 +15,11 @@ def check(pkgdir: str, optimize: bool, handler: ProcessHandler) -> dict:
cmd = ['makepkg', '-ALcf', '--check', '--noarchive', '--nobuild', '--noprepare']
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))
if os.path.exists(CUSTOM_MAKEPKG_FILE):
handler.watcher.print('Using custom makepkg.conf -> {}'.format(CUSTOM_MAKEPKG_FILE))
cmd.append('--config={}'.format(CUSTOM_MAKEPKG_FILE))
else:
handler.watcher.print('Custom optimized makepkg.conf ( {} ) not found'.format(CUSTOM_MAKEPKG_PATH))
handler.watcher.print('Custom optimized makepkg.conf ( {} ) not found'.format(CUSTOM_MAKEPKG_FILE))
success, output = handler.handle_simple(SimpleProcess(cmd, cwd=pkgdir))
@@ -41,10 +41,10 @@ def make(pkgdir: str, optimize: bool, handler: ProcessHandler) -> Tuple[bool, st
cmd = ['makepkg', '-ALcsmf']
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))
if os.path.exists(CUSTOM_MAKEPKG_FILE):
handler.watcher.print('Using custom makepkg.conf -> {}'.format(CUSTOM_MAKEPKG_FILE))
cmd.append('--config={}'.format(CUSTOM_MAKEPKG_FILE))
else:
handler.watcher.print('Custom optimized makepkg.conf ( {} ) not found'.format(CUSTOM_MAKEPKG_PATH))
handler.watcher.print('Custom optimized makepkg.conf ( {} ) not found'.format(CUSTOM_MAKEPKG_FILE))
return handler.handle_simple(SimpleProcess(cmd, cwd=pkgdir))