mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-08 08:34:17 +02:00
[fix][arch] not displaying 'removing' substatus during the upgrade process
This commit is contained in:
@@ -34,6 +34,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||||||
- Arch
|
- Arch
|
||||||
- uninstall: not checking if the are other installed providers for the target package
|
- uninstall: not checking if the are other installed providers for the target package
|
||||||
- not recursively asking for dependencies providers when installing / upgrading
|
- not recursively asking for dependencies providers when installing / upgrading
|
||||||
|
- not displaying "removing" substatus during the upgrade process
|
||||||
- UI
|
- UI
|
||||||
- table overwrite effect when updating its content
|
- table overwrite effect when updating its content
|
||||||
|
|
||||||
|
|||||||
@@ -851,15 +851,25 @@ class ArchManager(SoftwareManager):
|
|||||||
|
|
||||||
if requirements.to_remove:
|
if requirements.to_remove:
|
||||||
to_remove_names = {r.pkg.name for r in requirements.to_remove}
|
to_remove_names = {r.pkg.name for r in requirements.to_remove}
|
||||||
|
output_handler = TransactionStatusHandler(watcher=handler.watcher,
|
||||||
|
i18n=self.i18n,
|
||||||
|
pkgs_to_sync=0,
|
||||||
|
logger=self.logger,
|
||||||
|
pkgs_to_remove=len(to_remove_names))
|
||||||
|
output_handler.start()
|
||||||
try:
|
try:
|
||||||
success = handler.handle(pacman.remove_several(to_remove_names, root_password))
|
success = handler.handle(pacman.remove_several(to_remove_names, root_password), output_handler=output_handler.handle)
|
||||||
|
|
||||||
if not success:
|
if not success:
|
||||||
self.logger.error("Could not remove packages: {}".format(', '.join(to_remove_names)))
|
self.logger.error("Could not remove packages: {}".format(', '.join(to_remove_names)))
|
||||||
|
output_handler.stop_working()
|
||||||
|
output_handler.join()
|
||||||
return False
|
return False
|
||||||
except:
|
except:
|
||||||
self.logger.error("An error occured while removing packages: {}".format(', '.join(to_remove_names)))
|
self.logger.error("An error occured while removing packages: {}".format(', '.join(to_remove_names)))
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
output_handler.stop_working()
|
||||||
|
output_handler.join()
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if repo_pkgs:
|
if repo_pkgs:
|
||||||
@@ -1305,7 +1315,7 @@ class ArchManager(SoftwareManager):
|
|||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _install_deps(self, context: TransactionContext, deps: List[Tuple[str, str]]) -> Iterable[str]:
|
def _install_deps(self, context: TransactionContext, deps: List[Tuple[str, str]]) -> Iterable[str]:
|
||||||
"""
|
"""
|
||||||
:param pkgs_repos:
|
:param pkgs_repos:
|
||||||
:param root_password:
|
:param root_password:
|
||||||
@@ -1355,7 +1365,7 @@ class ArchManager(SoftwareManager):
|
|||||||
except ArchDownloadException:
|
except ArchDownloadException:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
status_handler = TransactionStatusHandler(watcher=context.watcher, i18n=self.i18n, npkgs=len(repo_dep_names),
|
status_handler = TransactionStatusHandler(watcher=context.watcher, i18n=self.i18n, pkgs_to_sync=len(repo_dep_names),
|
||||||
logger=self.logger, percentage=len(repo_deps) > 1, downloading=downloaded)
|
logger=self.logger, percentage=len(repo_deps) > 1, downloading=downloaded)
|
||||||
status_handler.start()
|
status_handler.start()
|
||||||
installed, _ = context.handler.handle_simple(pacman.install_as_process(pkgpaths=repo_dep_names,
|
installed, _ = context.handler.handle_simple(pacman.install_as_process(pkgpaths=repo_dep_names,
|
||||||
|
|||||||
@@ -9,15 +9,17 @@ from bauh.view.util.translation import I18n
|
|||||||
|
|
||||||
class TransactionStatusHandler(Thread):
|
class TransactionStatusHandler(Thread):
|
||||||
|
|
||||||
def __init__(self, watcher: ProcessWatcher, i18n: I18n, npkgs: int, logger: logging.Logger,
|
def __init__(self, watcher: ProcessWatcher, i18n: I18n, pkgs_to_sync: int, logger: logging.Logger,
|
||||||
percentage: bool = True, downloading: int = 0):
|
percentage: bool = True, downloading: int = 0, pkgs_to_remove: int = 0):
|
||||||
super(TransactionStatusHandler, self).__init__(daemon=True)
|
super(TransactionStatusHandler, self).__init__(daemon=True)
|
||||||
self.watcher = watcher
|
self.watcher = watcher
|
||||||
self.i18n = i18n
|
self.i18n = i18n
|
||||||
self.npkgs = npkgs
|
self.pkgs_to_sync = pkgs_to_sync
|
||||||
|
self.pkgs_to_remove = pkgs_to_remove
|
||||||
self.downloading = downloading
|
self.downloading = downloading
|
||||||
self.upgrading = 0
|
self.upgrading = 0
|
||||||
self.installing = 0
|
self.installing = 0
|
||||||
|
self.removing = 0
|
||||||
self.outputs = []
|
self.outputs = []
|
||||||
self.work = True
|
self.work = True
|
||||||
self.logger = logger
|
self.logger = logger
|
||||||
@@ -32,7 +34,7 @@ class TransactionStatusHandler(Thread):
|
|||||||
def gen_percentage(self) -> str:
|
def gen_percentage(self) -> str:
|
||||||
if self.percentage:
|
if self.percentage:
|
||||||
performed = self.downloading + self.upgrading + self.installing
|
performed = self.downloading + self.upgrading + self.installing
|
||||||
return '({0:.2f}%) '.format((performed / (2 * self.npkgs)) * 100)
|
return '({0:.2f}%) '.format((performed / (2 * self.pkgs_to_sync)) * 100)
|
||||||
else:
|
else:
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
@@ -41,32 +43,42 @@ class TransactionStatusHandler(Thread):
|
|||||||
|
|
||||||
def _handle(self, output: str) -> bool:
|
def _handle(self, output: str) -> bool:
|
||||||
if output:
|
if output:
|
||||||
|
if output.startswith('removing'):
|
||||||
|
if self.pkgs_to_remove > 0:
|
||||||
|
self.removing += 1
|
||||||
|
|
||||||
|
self.watcher.change_substatus(
|
||||||
|
'[{}/{}] {} {}'.format(self.removing, self.pkgs_to_remove,
|
||||||
|
self.i18n['uninstalling'].capitalize(), output.split(' ')[1].strip()))
|
||||||
|
else:
|
||||||
|
self.watcher.change_substatus('{} {}'.format(self.i18n['uninstalling'].capitalize(), output.split(' ')[1].strip()))
|
||||||
|
|
||||||
if output.startswith('downloading'):
|
if output.startswith('downloading'):
|
||||||
if self.downloading < self.npkgs:
|
if self.downloading < self.pkgs_to_sync:
|
||||||
perc = self.gen_percentage()
|
perc = self.gen_percentage()
|
||||||
self.downloading += 1
|
self.downloading += 1
|
||||||
|
|
||||||
self.watcher.change_substatus('{}[{}/{}] {} {} {}'.format(perc, self.downloading, self.npkgs, bold('[pacman]'),
|
self.watcher.change_substatus('{}[{}/{}] {} {} {}'.format(perc, self.downloading, self.pkgs_to_sync, bold('[pacman]'),
|
||||||
self.i18n['downloading'].capitalize(), output.split(' ')[1].strip()))
|
self.i18n['downloading'].capitalize(), output.split(' ')[1].strip()))
|
||||||
elif output.startswith('upgrading'):
|
elif output.startswith('upgrading'):
|
||||||
if self.get_performed() < self.npkgs:
|
if self.get_performed() < self.pkgs_to_sync:
|
||||||
perc = self.gen_percentage()
|
perc = self.gen_percentage()
|
||||||
self.upgrading += 1
|
self.upgrading += 1
|
||||||
|
|
||||||
performed = self.upgrading + self.installing
|
performed = self.upgrading + self.installing
|
||||||
|
|
||||||
if performed <= self.npkgs:
|
if performed <= self.pkgs_to_sync:
|
||||||
self.watcher.change_substatus('{}[{}/{}] {} {}'.format(perc, self.upgrading, self.npkgs,
|
self.watcher.change_substatus('{}[{}/{}] {} {}'.format(perc, self.upgrading, self.pkgs_to_sync,
|
||||||
self.i18n['manage_window.status.upgrading'].capitalize(), output.split(' ')[1].strip()))
|
self.i18n['manage_window.status.upgrading'].capitalize(), output.split(' ')[1].strip()))
|
||||||
elif output.startswith('installing'):
|
elif output.startswith('installing'):
|
||||||
if self.get_performed() < self.npkgs:
|
if self.get_performed() < self.pkgs_to_sync:
|
||||||
perc = self.gen_percentage()
|
perc = self.gen_percentage()
|
||||||
self.installing += 1
|
self.installing += 1
|
||||||
|
|
||||||
performed = self.upgrading + self.installing
|
performed = self.upgrading + self.installing
|
||||||
|
|
||||||
if performed <= self.npkgs:
|
if performed <= self.pkgs_to_sync:
|
||||||
self.watcher.change_substatus('{}[{}/{}] {} {}'.format(perc, self.installing, self.npkgs,
|
self.watcher.change_substatus('{}[{}/{}] {} {}'.format(perc, self.installing, self.pkgs_to_sync,
|
||||||
self.i18n['manage_window.status.installing'].capitalize(),
|
self.i18n['manage_window.status.installing'].capitalize(),
|
||||||
output.split(' ')[1].strip()))
|
output.split(' ')[1].strip()))
|
||||||
else:
|
else:
|
||||||
@@ -83,7 +95,7 @@ class TransactionStatusHandler(Thread):
|
|||||||
|
|
||||||
if performed == 0 and self.downloading > 0:
|
if performed == 0 and self.downloading > 0:
|
||||||
self.watcher.change_substatus('')
|
self.watcher.change_substatus('')
|
||||||
elif performed == self.npkgs:
|
elif performed == self.pkgs_to_sync:
|
||||||
self.watcher.change_substatus(self.i18n['finishing'].capitalize())
|
self.watcher.change_substatus(self.i18n['finishing'].capitalize())
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|||||||
@@ -385,6 +385,7 @@ task.download_categories=Download de categories [ {} ]
|
|||||||
type=tipus
|
type=tipus
|
||||||
uninstall=desinstal·la
|
uninstall=desinstal·la
|
||||||
uninstalled=desinstal·lada
|
uninstalled=desinstal·lada
|
||||||
|
uninstalling=uninstalling
|
||||||
unknown=desconegut
|
unknown=desconegut
|
||||||
updates=actualitzacions
|
updates=actualitzacions
|
||||||
user=usuari
|
user=usuari
|
||||||
|
|||||||
@@ -384,6 +384,7 @@ task.download_categories=Downloading categories [ {} ]
|
|||||||
type=Typ
|
type=Typ
|
||||||
uninstall=Deinstallation
|
uninstall=Deinstallation
|
||||||
uninstalled=deinstalliert
|
uninstalled=deinstalliert
|
||||||
|
uninstalling=uninstalling
|
||||||
unknown=unbekannt
|
unknown=unbekannt
|
||||||
updates=Updates
|
updates=Updates
|
||||||
user=Benutzer
|
user=Benutzer
|
||||||
|
|||||||
@@ -384,6 +384,7 @@ task.download_categories=Downloading categories [ {} ]
|
|||||||
type=type
|
type=type
|
||||||
uninstall=uninstall
|
uninstall=uninstall
|
||||||
uninstalled=uninstalled
|
uninstalled=uninstalled
|
||||||
|
uninstalling=uninstalling
|
||||||
unknown=unknown
|
unknown=unknown
|
||||||
updates=updates
|
updates=updates
|
||||||
user=user
|
user=user
|
||||||
|
|||||||
@@ -363,6 +363,7 @@ prepare_panel.title.start=Inicializando
|
|||||||
proceed=continuar
|
proceed=continuar
|
||||||
publisher=publicador
|
publisher=publicador
|
||||||
publisher.verified=verificado
|
publisher.verified=verificado
|
||||||
|
removing=removing
|
||||||
repository=repositorio
|
repository=repositorio
|
||||||
screenshots.bt_back.label=anterior
|
screenshots.bt_back.label=anterior
|
||||||
screenshots.bt_next.label=siguiente
|
screenshots.bt_next.label=siguiente
|
||||||
@@ -385,6 +386,7 @@ task.download_categories=Descargando categorías [ {} ]
|
|||||||
type=tipo
|
type=tipo
|
||||||
uninstall=desinstalar
|
uninstall=desinstalar
|
||||||
uninstalled=desinstalada
|
uninstalled=desinstalada
|
||||||
|
uninstalling=desinstalando
|
||||||
unknown=desconocido
|
unknown=desconocido
|
||||||
updates=actualizaciones
|
updates=actualizaciones
|
||||||
user=usuario
|
user=usuario
|
||||||
|
|||||||
@@ -387,6 +387,7 @@ task.download_categories=Download delle categorie [ {} ]
|
|||||||
type=tipe
|
type=tipe
|
||||||
uninstall=Disinstalla
|
uninstall=Disinstalla
|
||||||
uninstalled=disinstallato
|
uninstalled=disinstallato
|
||||||
|
uninstalling=uninstalling
|
||||||
unknown=sconosciuto
|
unknown=sconosciuto
|
||||||
updates=aggiornamenti
|
updates=aggiornamenti
|
||||||
user=utente
|
user=utente
|
||||||
|
|||||||
@@ -384,6 +384,7 @@ task.download_categories=Baixando categorias [ {} ]
|
|||||||
type=tipo
|
type=tipo
|
||||||
uninstall=desinstalar
|
uninstall=desinstalar
|
||||||
uninstalled=desinstalado
|
uninstalled=desinstalado
|
||||||
|
uninstalling=desinstalando
|
||||||
unknown=desconhecido
|
unknown=desconhecido
|
||||||
updates=atualizações
|
updates=atualizações
|
||||||
user=usuário
|
user=usuário
|
||||||
|
|||||||
@@ -384,6 +384,7 @@ task.download_categories=Downloading categories [ {} ]
|
|||||||
type=Тип
|
type=Тип
|
||||||
uninstall=Деинсталляция
|
uninstall=Деинсталляция
|
||||||
uninstalled=Деинсталлировано
|
uninstalled=Деинсталлировано
|
||||||
|
uninstalling=uninstalling
|
||||||
unknown=неизвестный
|
unknown=неизвестный
|
||||||
updates=Обновления
|
updates=Обновления
|
||||||
user=Пользователь
|
user=Пользователь
|
||||||
|
|||||||
@@ -384,6 +384,7 @@ task.download_categories=Kategoriler indiriliyor [ {} ]
|
|||||||
type=tür
|
type=tür
|
||||||
uninstall=kaldır
|
uninstall=kaldır
|
||||||
uninstalled=kaldırıldı
|
uninstalled=kaldırıldı
|
||||||
|
uninstalling=uninstalling
|
||||||
unknown=bilinmeyen
|
unknown=bilinmeyen
|
||||||
updates=güncellemeler
|
updates=güncellemeler
|
||||||
user=kullanıcı
|
user=kullanıcı
|
||||||
|
|||||||
Reference in New Issue
Block a user