mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 02:24:16 +02:00
[improvement][arch] using unified subprocess output when installing packages to prevent wrong error results
This commit is contained in:
@@ -728,7 +728,7 @@ class ArchManager(SoftwareManager):
|
|||||||
try:
|
try:
|
||||||
output_handler = TransactionStatusHandler(watcher, self.i18n, len(repo_pkgs_names), self.logger)
|
output_handler = TransactionStatusHandler(watcher, self.i18n, len(repo_pkgs_names), self.logger)
|
||||||
output_handler.start()
|
output_handler.start()
|
||||||
success = handler.handle_simple(pacman.upgrade_several(repo_pkgs_names, root_password), output_handler=output_handler.handle)
|
success, _ = handler.handle_simple(pacman.upgrade_several(repo_pkgs_names, root_password), output_handler=output_handler.handle)
|
||||||
output_handler.stop_working()
|
output_handler.stop_working()
|
||||||
output_handler.join()
|
output_handler.join()
|
||||||
|
|
||||||
@@ -1107,9 +1107,10 @@ class ArchManager(SoftwareManager):
|
|||||||
|
|
||||||
status_handler = TransactionStatusHandler(context.watcher, self.i18n, len(repo_deps), self.logger, percentage=len(repo_deps) > 1)
|
status_handler = TransactionStatusHandler(context.watcher, self.i18n, len(repo_deps), self.logger, percentage=len(repo_deps) > 1)
|
||||||
status_handler.start()
|
status_handler.start()
|
||||||
installed = context.handler.handle(pacman.install_as_process(pkgpaths=repo_deps,
|
installed, _ = context.handler.handle_simple(pacman.install_as_process(pkgpaths=repo_deps,
|
||||||
root_password=context.root_password,
|
root_password=context.root_password,
|
||||||
file=False), output_handler=status_handler.handle)
|
file=False),
|
||||||
|
output_handler=status_handler.handle)
|
||||||
|
|
||||||
if installed:
|
if installed:
|
||||||
progress += len(repo_deps) * progress_increment
|
progress += len(repo_deps) * progress_increment
|
||||||
@@ -1459,11 +1460,11 @@ class ArchManager(SoftwareManager):
|
|||||||
else:
|
else:
|
||||||
status_handler = None
|
status_handler = None
|
||||||
|
|
||||||
installed = context.handler.handle(process=pacman.install_as_process(pkgpaths=to_install,
|
installed, _ = context.handler.handle_simple(pacman.install_as_process(pkgpaths=to_install,
|
||||||
root_password=context.root_password,
|
root_password=context.root_password,
|
||||||
file=context.has_install_file(),
|
file=context.has_install_file(),
|
||||||
pkgdir=context.project_dir),
|
pkgdir=context.project_dir),
|
||||||
output_handler=status_handler.handle if status_handler else None)
|
output_handler=status_handler.handle if status_handler else None)
|
||||||
if status_handler:
|
if status_handler:
|
||||||
status_handler.stop_working()
|
status_handler.stop_working()
|
||||||
status_handler.join()
|
status_handler.join()
|
||||||
|
|||||||
@@ -135,13 +135,13 @@ def map_installed(repositories: bool = True, aur: bool = True) -> dict: # retur
|
|||||||
return pkgs
|
return pkgs
|
||||||
|
|
||||||
|
|
||||||
def install_as_process(pkgpaths: Iterable[str], root_password: str, file: bool, pkgdir: str = '.') -> SystemProcess:
|
def install_as_process(pkgpaths: Iterable[str], root_password: str, file: bool, pkgdir: str = '.') -> SimpleProcess:
|
||||||
if file:
|
if file:
|
||||||
cmd = ['pacman', '-U', *pkgpaths, '--noconfirm'] # pkgpath = install file path
|
cmd = ['pacman', '-U', *pkgpaths, '--noconfirm'] # pkgpath = install file path
|
||||||
else:
|
else:
|
||||||
cmd = ['pacman', '-S', *pkgpaths, '--noconfirm'] # pkgpath = pkgname
|
cmd = ['pacman', '-S', *pkgpaths, '--noconfirm'] # pkgpath = pkgname
|
||||||
|
|
||||||
return SystemProcess(new_root_subprocess(cmd, root_password, cwd=pkgdir), wrong_error_phrase='warning:')
|
return SimpleProcess(cmd=cmd, root_password=root_password, cwd=pkgdir)
|
||||||
|
|
||||||
|
|
||||||
def list_desktop_entries(pkgnames: Set[str]) -> List[str]:
|
def list_desktop_entries(pkgnames: Set[str]) -> List[str]:
|
||||||
|
|||||||
Reference in New Issue
Block a user