mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 01:14:15 +02:00
fix: AUR -> makepkg console output
This commit is contained in:
@@ -13,7 +13,8 @@ from bauh.api.abstract.handler import ProcessWatcher
|
||||
from bauh.api.abstract.model import PackageUpdate, PackageHistory, SoftwarePackage, PackageSuggestion, PackageStatus
|
||||
from bauh.api.abstract.view import MessageType
|
||||
from bauh.commons.html import bold
|
||||
from bauh.commons.system import SystemProcess, ProcessHandler, new_subprocess, run_cmd, new_root_subprocess
|
||||
from bauh.commons.system import SystemProcess, ProcessHandler, new_subprocess, run_cmd, new_root_subprocess, \
|
||||
SimpleProcess
|
||||
from bauh.gems.arch import BUILD_DIR, aur, pacman, makepkg, pkgbuild, message, confirmation, disk, git, suggestions, gpg
|
||||
from bauh.gems.arch.aur import AURClient
|
||||
from bauh.gems.arch.mapper import ArchDataMapper
|
||||
@@ -397,7 +398,7 @@ class ArchManager(SoftwareManager):
|
||||
|
||||
# building main package
|
||||
handler.watcher.change_substatus(self.i18n['arch.building.package'].format(bold(pkgname)))
|
||||
pkgbuilt = handler.handle(SystemProcess(new_subprocess(['makepkg', '-ALcsmf'], cwd=project_dir, lang=None), check_error_output=False, skip_stdout=True))
|
||||
pkgbuilt, output = handler.handle_simple(SimpleProcess(['makepkg', '-ALcsmf'], cwd=project_dir, lang=None))
|
||||
self._update_progress(handler.watcher, 65, change_progress)
|
||||
|
||||
if pkgbuilt:
|
||||
@@ -423,7 +424,7 @@ class ArchManager(SoftwareManager):
|
||||
|
||||
def _install_missings_deps_and_keys(self, pkgname: str, root_password: str, handler: ProcessHandler, pkgdir: str) -> bool:
|
||||
handler.watcher.change_substatus(self.i18n['arch.checking.deps'].format(bold(pkgname)))
|
||||
check_res = makepkg.check(pkgdir, handler.watcher)
|
||||
check_res = makepkg.check(pkgdir, handler)
|
||||
|
||||
if check_res:
|
||||
if check_res.get('missing_deps'):
|
||||
|
||||
@@ -1,46 +1,21 @@
|
||||
import re
|
||||
|
||||
from bauh.api.abstract.handler import ProcessWatcher
|
||||
from bauh.commons.system import new_subprocess
|
||||
from bauh.commons.system import SimpleProcess, ProcessHandler
|
||||
|
||||
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, watcher: ProcessWatcher) -> dict:
|
||||
depcheck = new_subprocess(['makepkg', '-ALcf', '--check', '--noarchive'], cwd=pkgdir)
|
||||
def check(pkgdir: str, handler: ProcessHandler) -> dict:
|
||||
res = {}
|
||||
success, output = handler.handle_simple(SimpleProcess(['makepkg', '-ALcf', '--check', '--noarchive'], cwd=pkgdir))
|
||||
|
||||
output_lines = []
|
||||
if 'Missing dependencies' in output:
|
||||
res['missing_deps'] = RE_DEPS_PATTERN.findall(output)
|
||||
|
||||
for o in depcheck.stdout:
|
||||
if o:
|
||||
line = o.decode().strip()
|
||||
gpg_keys = RE_UNKNOWN_GPG_KEY.findall(output)
|
||||
|
||||
if line:
|
||||
output_lines.append(line)
|
||||
watcher.print(line)
|
||||
|
||||
for s in depcheck.stderr:
|
||||
if s:
|
||||
line = s.decode()
|
||||
if line:
|
||||
output_lines.append(line)
|
||||
|
||||
line_strip = line.strip()
|
||||
|
||||
if line_strip:
|
||||
watcher.print(line_strip)
|
||||
|
||||
if output_lines:
|
||||
error_str = ''.join(output_lines)
|
||||
|
||||
if 'Missing dependencies' in error_str:
|
||||
res['missing_deps'] = RE_DEPS_PATTERN.findall(error_str)
|
||||
|
||||
gpg_keys = RE_UNKNOWN_GPG_KEY.findall(error_str)
|
||||
|
||||
if gpg_keys:
|
||||
res['gpg_key'] = gpg_keys[0]
|
||||
if gpg_keys:
|
||||
res['gpg_key'] = gpg_keys[0]
|
||||
|
||||
return res
|
||||
|
||||
Reference in New Issue
Block a user