[improvement][aur] generating the optimized makepkg.conf at ~/.config/bauh/arch and using it as a build parameter

This commit is contained in:
Vinicius Moreira
2019-11-27 11:33:13 -03:00
parent 7dda304c7a
commit 374c697196
5 changed files with 42 additions and 17 deletions

View File

@@ -1,6 +1,9 @@
import os
import re
from typing import Tuple
from bauh.commons.system import SimpleProcess, ProcessHandler
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+)\)')
@@ -8,7 +11,14 @@ RE_UNKNOWN_GPG_KEY = re.compile(r'\(unknown public key (\w+)\)')
def check(pkgdir: str, handler: ProcessHandler) -> dict:
res = {}
success, output = handler.handle_simple(SimpleProcess(['makepkg', '-ALcf', '--check', '--noarchive', '--nobuild'], cwd=pkgdir))
cmd = ['makepkg', '-ALcf', '--check', '--noarchive', '--nobuild']
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))
success, output = handler.handle_simple(SimpleProcess(cmd, cwd=pkgdir))
if 'Missing dependencies' in output:
res['missing_deps'] = RE_DEPS_PATTERN.findall(output)
@@ -22,3 +32,14 @@ def check(pkgdir: str, handler: ProcessHandler) -> dict:
res['validity_check'] = True
return res
def make(pkgdir: str, handler: ProcessHandler) -> Tuple[bool, str]:
cmd = ['makepkg', '-ALcsmf', '--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))
return handler.handle_simple(SimpleProcess(cmd, cwd=pkgdir))