From 4540fc938ed568546eb2ef75916f31db679988ed Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Mon, 14 Dec 2020 13:04:39 -0300 Subject: [PATCH] [arch] improvement -> the task responsible for generating a local AUR index is displayed on the initialization dialog --- CHANGELOG.md | 4 ++ bauh/gems/arch/controller.py | 24 ++++++------ bauh/gems/arch/resources/locale/ca | 7 ++++ bauh/gems/arch/resources/locale/de | 7 ++++ bauh/gems/arch/resources/locale/en | 6 +++ bauh/gems/arch/resources/locale/es | 7 ++++ bauh/gems/arch/resources/locale/fr | 6 +++ bauh/gems/arch/resources/locale/it | 7 ++++ bauh/gems/arch/resources/locale/pt | 6 +++ bauh/gems/arch/resources/locale/ru | 7 ++++ bauh/gems/arch/resources/locale/tr | 7 ++++ bauh/gems/arch/worker.py | 59 +++++++++++++++++++++++------- 12 files changed, 122 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 782a222e..9567ba74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [0.9.11] +### Improvements +- Arch + - the task responsible for generating a local AUR index is displayed on the initialization dialog + ### Fixes - AppImage - some installed applications cannot be launched by their desktop entries (regression from **0.9.10**) [#155](https://github.com/vinifmor/bauh/issues/155). If any of your installed AppImages are affected by this issue, just reinstall them. diff --git a/bauh/gems/arch/controller.py b/bauh/gems/arch/controller.py index e365bb34..257b8f99 100644 --- a/bauh/gems/arch/controller.py +++ b/bauh/gems/arch/controller.py @@ -2339,10 +2339,10 @@ class ArchManager(SoftwareManager): self.logger.warning("It was not possible to synchronized the package databases") handler.watcher.change_substatus(self.i18n['arch.sync_databases.substatus.error']) - def _optimize_makepkg(self, arch_config: dict, watcher: ProcessWatcher): - if arch_config['optimize'] and not os.path.exists(CUSTOM_MAKEPKG_FILE): + def _optimize_makepkg(self, arch_config: dict, watcher: Optional[ProcessWatcher]): + if arch_config['aur'] and arch_config['optimize'] and not os.path.exists(CUSTOM_MAKEPKG_FILE): watcher.change_substatus(self.i18n['arch.makepkg.optimizing']) - ArchCompilationOptimizer(arch_config, self.i18n, self.context.logger).optimize() + ArchCompilationOptimizer(arch_config=arch_config, i18n=self.i18n, logger=self.context.logger).optimize() def install(self, pkg: ArchPackage, root_password: str, disk_loader: DiskCacheLoader, watcher: ProcessWatcher, context: TransactionContext = None) -> TransactionResult: self.aur_client.clean_caches() @@ -2373,7 +2373,6 @@ class ArchManager(SoftwareManager): if res: pkg.name = install_context.name # changes the package name in case the PKGBUILD was edited - if os.path.exists(pkg.get_disk_data_path()): with open(pkg.get_disk_data_path()) as f: data = f.read() @@ -2498,28 +2497,29 @@ class ArchManager(SoftwareManager): def prepare(self, task_manager: TaskManager, root_password: str, internet_available: bool): arch_config = read_config(update_file=True) + if arch_config['aur']: + ArchCompilationOptimizer(arch_config, self.i18n, self.context.logger, task_manager).start() + + if internet_available: + self.index_aur = AURIndexUpdater(context=self.context, taskman=task_manager) + self.index_aur.start() + if arch_config['aur'] or arch_config['repositories']: self.disk_cache_updater = ArchDiskCacheUpdater(task_man=task_manager, arch_config=arch_config, i18n=self.i18n, logger=self.context.logger, controller=self, - internet_available=internet_available) + internet_available=internet_available, + aur_indexer=self.index_aur) self.disk_cache_updater.start() - if arch_config['aur']: - ArchCompilationOptimizer(arch_config, self.i18n, self.context.logger, task_manager).start() - CategoriesDownloader(id_='Arch', http_client=self.context.http_client, logger=self.context.logger, manager=self, url_categories_file=URL_CATEGORIES_FILE, disk_cache_dir=ARCH_CACHE_PATH, categories_path=CATEGORIES_FILE_PATH, before=lambda: self._start_category_task(task_manager), after=lambda: self._finish_category_task(task_manager)).start() - if arch_config['aur'] and internet_available: - self.index_aur = AURIndexUpdater(self.context) - self.index_aur.start() - refresh_mirrors = None if internet_available and arch_config['repositories'] and arch_config['refresh_mirrors_startup'] \ and pacman.is_mirrors_available() and mirrors.should_sync(self.logger): diff --git a/bauh/gems/arch/resources/locale/ca b/bauh/gems/arch/resources/locale/ca index 410cd4c1..09d21cde 100644 --- a/bauh/gems/arch/resources/locale/ca +++ b/bauh/gems/arch/resources/locale/ca @@ -9,6 +9,7 @@ arch.action.disable_pkgbuild_edition.status=Unmarking PKGBUILD as editable arch.action.enable_pkgbuild_edition=Mark PKGBUILD as editable arch.action.enable_pkgbuild_edition.confirm=Mark PKGBUILD of {} as editable ? arch.action.enable_pkgbuild_edition.status=Marking PKGBUILD as editable +arch.aur.action.edit_pkgbuild.body=Edit the PKGBUILD file of {} before continuing ? arch.aur.install.pgp.body=Per a instal·lar {} cal rebre les claus PGP següents arch.aur.install.pgp.receive_fail=Could not receive PGP key {} arch.aur.install.pgp.sign_fail=No s’ha pogut rebre la clau PGP {} @@ -205,11 +206,17 @@ arch.substatus.pre_hooks=Running pre-transaction hooks arch.sync.dep_breakage.reason={} requires {} arch.sync_databases.substatus=Synchronizing package databases arch.sync_databases.substatus.error=It was not possible to synchronize the package database +arch.task.aur.index.status=Generating local AUR index +arch.task.aur.index.substatus.download=Downloading the AUR index +arch.task.aur.index.substatus.error.download=Connection error while downloading the index +arch.task.aur.index.substatus.error.no_data=Error: empty index +arch.task.aur.index.substatus.gen_index=Generating index arch.task.disk_cache=Indexing packages data arch.task.disk_cache.checking=Checking index arch.task.disk_cache.indexed=Indexed arch.task.disk_cache.indexing=Indexing arch.task.disk_cache.reading_files=Reading files +arch.task.disk_cache.waiting_aur_index=Waiting {} arch.task.mirrors=Refreshing mirrors arch.task.optimizing=Optimizing {} arch.task.sync_databases.waiting=Waiting for {} diff --git a/bauh/gems/arch/resources/locale/de b/bauh/gems/arch/resources/locale/de index 55120a11..7229962e 100644 --- a/bauh/gems/arch/resources/locale/de +++ b/bauh/gems/arch/resources/locale/de @@ -9,6 +9,7 @@ arch.action.disable_pkgbuild_edition.status=Unmarking PKGBUILD as editable arch.action.enable_pkgbuild_edition=Mark PKGBUILD as editable arch.action.enable_pkgbuild_edition.confirm=Mark PKGBUILD of {} as editable ? arch.action.enable_pkgbuild_edition.status=Marking PKGBUILD as editable +arch.aur.action.edit_pkgbuild.body=Edit the PKGBUILD file of {} before continuing ? arch.aur.install.pgp.body=Um {} zu installieren sind folgende PGP Schlüssel nötig arch.aur.install.pgp.receive_fail=PGP Schlüssel {} konnte nicht empfangen werden arch.aur.install.pgp.sign_fail=PGP Schlüssel {} konnte nicht signiert werden @@ -205,11 +206,17 @@ arch.substatus.pre_hooks=Running pre-transaction hooks arch.sync.dep_breakage.reason={} requires {} arch.sync_databases.substatus=Synchronizing package databases arch.sync_databases.substatus.error=It was not possible to synchronize the package database +arch.task.aur.index.status=Generating local AUR index +arch.task.aur.index.substatus.download=Downloading the AUR index +arch.task.aur.index.substatus.error.download=Connection error while downloading the index +arch.task.aur.index.substatus.error.no_data=Error: empty index +arch.task.aur.index.substatus.gen_index=Generating index arch.task.disk_cache=Indexing packages data arch.task.disk_cache.checking=Checking index arch.task.disk_cache.indexed=Indexed arch.task.disk_cache.indexing=Indexing arch.task.disk_cache.reading_files=Reading files +arch.task.disk_cache.waiting_aur_index=Waiting {} arch.task.mirrors=Refreshing mirrors arch.task.optimizing=Optimizing {} arch.task.sync_databases.waiting=Waiting for {} diff --git a/bauh/gems/arch/resources/locale/en b/bauh/gems/arch/resources/locale/en index dbe4c5da..c8da0736 100644 --- a/bauh/gems/arch/resources/locale/en +++ b/bauh/gems/arch/resources/locale/en @@ -206,11 +206,17 @@ arch.substatus.pre_hooks=Running pre-transaction hooks arch.sync.dep_breakage.reason={} requires {} arch.sync_databases.substatus=Synchronizing package databases arch.sync_databases.substatus.error=It was not possible to synchronize the package database +arch.task.aur.index.status=Generating local AUR index +arch.task.aur.index.substatus.download=Downloading the AUR index +arch.task.aur.index.substatus.error.download=Connection error while downloading the index +arch.task.aur.index.substatus.error.no_data=Error: empty index +arch.task.aur.index.substatus.gen_index=Generating index arch.task.disk_cache=Indexing packages data arch.task.disk_cache.checking=Checking index arch.task.disk_cache.indexed=Indexed arch.task.disk_cache.indexing=Indexing arch.task.disk_cache.reading_files=Reading files +arch.task.disk_cache.waiting_aur_index=Waiting {} arch.task.mirrors=Refreshing mirrors arch.task.optimizing=Optimizing {} arch.task.sync_databases.waiting=Waiting for {} diff --git a/bauh/gems/arch/resources/locale/es b/bauh/gems/arch/resources/locale/es index 6eb584b1..bfd98360 100644 --- a/bauh/gems/arch/resources/locale/es +++ b/bauh/gems/arch/resources/locale/es @@ -9,6 +9,7 @@ arch.action.disable_pkgbuild_edition.status=Desmarcando PKGBUILD como editable arch.action.enable_pkgbuild_edition=Marcar PKGBUILD como editable arch.action.enable_pkgbuild_edition.confirm=Marcar PKGBUILD de {} como editable ? arch.action.enable_pkgbuild_edition.status=Marcando PKGBUILD como editable +arch.aur.action.edit_pkgbuild.body=Editar el archivo PKGBUILD de {} antes de continuar ? arch.aur.install.pgp.body=Para instalar {} es necesario recibir las siguientes claves PGP arch.aur.install.pgp.receive_fail=Could not receive PGP key {} arch.aur.install.pgp.sign_fail=No fue posible recibir la clave PGP {} @@ -205,11 +206,17 @@ arch.substatus.pre_hooks=Ejecutando ganchos pre-transacción arch.sync.dep_breakage.reason={} necesita de {} arch.sync_databases.substatus=Sincronizando bases de paquetes arch.sync_databases.substatus.error=No fue posible sincronizar la base de paquetes +arch.task.aur.index.status=Generando índice local del AUR +arch.task.aur.index.substatus.download=Descargando el índice +arch.task.aur.index.substatus.error.download=Error de conexión al descargar el índice +arch.task.aur.index.substatus.error.no_data=Error: índice vacío +arch.task.aur.index.substatus.gen_index=Generando índice arch.task.disk_cache=Indexando datos de paquetes arch.task.disk_cache.checking=Comprobando índice arch.task.disk_cache.indexed=Indexados arch.task.disk_cache.indexing=Indexando arch.task.disk_cache.reading_files=Lendo archivos +arch.task.disk_cache.waiting_aur_index=Esperando {} arch.task.mirrors=Actualizando espejos arch.task.optimizing=Optimizando {} arch.task.sync_databases.waiting=Esperando por {} diff --git a/bauh/gems/arch/resources/locale/fr b/bauh/gems/arch/resources/locale/fr index 48bf5583..e78fecba 100644 --- a/bauh/gems/arch/resources/locale/fr +++ b/bauh/gems/arch/resources/locale/fr @@ -206,11 +206,17 @@ arch.substatus.pre_hooks=Éxécution des pre-transaction hooks arch.sync.dep_breakage.reason={} requiert {} arch.sync_databases.substatus=Synchronisation des bases de données du paquet arch.sync_databases.substatus.error=Impossible de synchroniser les bases de données du paquet +arch.task.aur.index.status=Generating local AUR index +arch.task.aur.index.substatus.download=Downloading the AUR index +arch.task.aur.index.substatus.error.download=Connection error while downloading the index +arch.task.aur.index.substatus.error.no_data=Error: empty index +arch.task.aur.index.substatus.gen_index=Generating index arch.task.disk_cache=Indexation des données des paquets arch.task.disk_cache.checking=Verification de l'index arch.task.disk_cache.indexed=Indexé arch.task.disk_cache.indexing=Indexation arch.task.disk_cache.reading_files=Lecture des fichiers +arch.task.disk_cache.waiting_aur_index=Waiting {} arch.task.mirrors=Mise à jour des miroirs arch.task.optimizing=Optimisation {} arch.task.sync_databases.waiting=Attente de {} diff --git a/bauh/gems/arch/resources/locale/it b/bauh/gems/arch/resources/locale/it index 003d5536..c40a313d 100644 --- a/bauh/gems/arch/resources/locale/it +++ b/bauh/gems/arch/resources/locale/it @@ -9,6 +9,7 @@ arch.action.disable_pkgbuild_edition.status=Unmarking PKGBUILD as editable arch.action.enable_pkgbuild_edition=Mark PKGBUILD as editable arch.action.enable_pkgbuild_edition.confirm=Mark PKGBUILD of {} as editable ? arch.action.enable_pkgbuild_edition.status=Marking PKGBUILD as editable +arch.aur.action.edit_pkgbuild.body=Edit the PKGBUILD file of {} before continuing ? arch.aur.install.pgp.body=Per installare {} è necessario ricevere le seguenti chiavi PGP arch.aur.install.pgp.receive_fail=Impossibile ricevere la chiave PGP {} arch.aur.install.pgp.sign_fail=Impossibile firmare la chiave PGP {} @@ -205,11 +206,17 @@ arch.substatus.pre_hooks=Running pre-transaction hooks arch.sync.dep_breakage.reason={} requires {} arch.sync_databases.substatus=Synchronizing package databases arch.sync_databases.substatus.error=It was not possible to synchronize the package database +arch.task.aur.index.status=Generating local AUR index +arch.task.aur.index.substatus.download=Downloading the AUR index +arch.task.aur.index.substatus.error.download=Connection error while downloading the index +arch.task.aur.index.substatus.error.no_data=Error: empty index +arch.task.aur.index.substatus.gen_index=Generating index arch.task.disk_cache=Indexing packages data arch.task.disk_cache.checking=Checking index arch.task.disk_cache.indexed=Indexed arch.task.disk_cache.indexing=Indexing arch.task.disk_cache.reading_files=Reading files +arch.task.disk_cache.waiting_aur_index=Waiting {} arch.task.mirrors=Aggiornando i mirror arch.task.optimizing=Ottimizzando {} arch.task.sync_databases.waiting=Waiting for {} diff --git a/bauh/gems/arch/resources/locale/pt b/bauh/gems/arch/resources/locale/pt index 4b7e43fd..2dd6ece1 100644 --- a/bauh/gems/arch/resources/locale/pt +++ b/bauh/gems/arch/resources/locale/pt @@ -205,11 +205,17 @@ arch.substatus.pre_hooks=Executando ganchos pré-transação arch.sync.dep_breakage.reason={} precisa de {} arch.sync_databases.substatus=Sincronizando bases de pacotes arch.sync_databases.substatus.error=Não foi possível sincronizar as bases de pacotes +arch.task.aur.index.status=Gerando índice local do AUR +arch.task.aur.index.substatus.download=Baixando o índice +arch.task.aur.index.substatus.error.download=Erro de conexão ao baixar o índice +arch.task.aur.index.substatus.error.no_data=Error: índice vazio +arch.task.aur.index.substatus.gen_index=Gerando índice arch.task.disk_cache=Indexando dados de pacotes arch.task.disk_cache.checking=Verificando índice arch.task.disk_cache.indexed=Indexados arch.task.disk_cache.indexing=Indexando arch.task.disk_cache.reading_files=Lendo arquivos +arch.task.disk_cache.waiting_aur_index=Aguardando {} arch.task.mirrors=Atualizando espelhos arch.task.optimizing=Otimizando {} arch.task.sync_databases.waiting=Aguardando por {} diff --git a/bauh/gems/arch/resources/locale/ru b/bauh/gems/arch/resources/locale/ru index 035ce7cb..530d0449 100644 --- a/bauh/gems/arch/resources/locale/ru +++ b/bauh/gems/arch/resources/locale/ru @@ -9,6 +9,7 @@ arch.action.disable_pkgbuild_edition.status=Unmarking PKGBUILD as editable arch.action.enable_pkgbuild_edition=Mark PKGBUILD as editable arch.action.enable_pkgbuild_edition.confirm=Mark PKGBUILD of {} as editable ? arch.action.enable_pkgbuild_edition.status=Marking PKGBUILD as editable +arch.aur.action.edit_pkgbuild.body=Edit the PKGBUILD file of {} before continuing ? arch.aur.install.pgp.body=Для установки {} необходимо получить следующие PGP ключи arch.aur.install.pgp.receive_fail=Не удалось получить PGP-ключ {} arch.aur.install.pgp.sign_fail=Не удалось подписать PGP-ключ {} @@ -205,11 +206,17 @@ arch.substatus.pre_hooks=Running pre-transaction hooks arch.sync.dep_breakage.reason={} requires {} arch.sync_databases.substatus=Синхронизация баз данных пакетов arch.sync_databases.substatus.error=Синхронизировать базу данных пакета не удалось +arch.task.aur.index.status=Generating local AUR index +arch.task.aur.index.substatus.download=Downloading the AUR index +arch.task.aur.index.substatus.error.download=Connection error while downloading the index +arch.task.aur.index.substatus.error.no_data=Error: empty index +arch.task.aur.index.substatus.gen_index=Generating index arch.task.disk_cache=Indexing packages data arch.task.disk_cache.checking=Checking index arch.task.disk_cache.indexed=Indexed arch.task.disk_cache.indexing=Indexing arch.task.disk_cache.reading_files=Reading files +arch.task.disk_cache.waiting_aur_index=Waiting {} arch.task.mirrors=Обновление зеркал arch.task.optimizing=Optimizing {} arch.task.sync_databases.waiting=Waiting for {} diff --git a/bauh/gems/arch/resources/locale/tr b/bauh/gems/arch/resources/locale/tr index a6a12a76..f2b99023 100644 --- a/bauh/gems/arch/resources/locale/tr +++ b/bauh/gems/arch/resources/locale/tr @@ -9,6 +9,7 @@ arch.action.disable_pkgbuild_edition.status=Unmarking PKGBUILD as editable arch.action.enable_pkgbuild_edition=Mark PKGBUILD as editable arch.action.enable_pkgbuild_edition.confirm=Mark PKGBUILD of {} as editable ? arch.action.enable_pkgbuild_edition.status=Marking PKGBUILD as editable +arch.aur.action.edit_pkgbuild.body=Edit the PKGBUILD file of {} before continuing ? arch.aur.install.pgp.body={} kurmak için aşağıdaki PGP anahtarlarını almak gereklidir arch.aur.install.pgp.receive_fail=PGP anahtarı alınamadı {} arch.aur.install.pgp.sign_fail=PGP anahtarı {} imzalanamadı @@ -205,11 +206,17 @@ arch.substatus.pre_hooks=Running pre-transaction hooks arch.sync.dep_breakage.reason={} requires {} arch.sync_databases.substatus=Paket veritabanı eşitleniyor arch.sync_databases.substatus.error=Paket veritabanı eşitlenemedi +arch.task.aur.index.status=Generating local AUR index +arch.task.aur.index.substatus.download=Downloading the AUR index +arch.task.aur.index.substatus.error.download=Connection error while downloading the index +arch.task.aur.index.substatus.error.no_data=Error: empty index +arch.task.aur.index.substatus.gen_index=Generating index arch.task.disk_cache=Indexing packages data arch.task.disk_cache.checking=Checking index arch.task.disk_cache.indexed=Indexed arch.task.disk_cache.indexing=Indexing arch.task.disk_cache.reading_files=Reading files +arch.task.disk_cache.waiting_aur_index=Waiting {} arch.task.mirrors=Yansılar yenileniyor arch.task.optimizing=Uygun hale getiriliyor {} arch.task.sync_databases.waiting=Waiting for {} diff --git a/bauh/gems/arch/worker.py b/bauh/gems/arch/worker.py index 38867518..3add3e3f 100644 --- a/bauh/gems/arch/worker.py +++ b/bauh/gems/arch/worker.py @@ -6,6 +6,7 @@ import time import traceback from pathlib import Path from threading import Thread +from typing import Optional import requests @@ -28,39 +29,66 @@ RE_CLEAR_REPLACE = re.compile(r'[\-_.]') class AURIndexUpdater(Thread): - def __init__(self, context: ApplicationContext): + def __init__(self, context: ApplicationContext, taskman: TaskManager): super(AURIndexUpdater, self).__init__(daemon=True) self.http_client = context.http_client self.i18n = context.i18n self.logger = context.logger + self.taskman = taskman + self.task_id = 'index_aur' def run(self): - self.logger.info('Pre-indexing AUR packages') + ti = time.time() + self.logger.info('Indexing AUR packages') + self.taskman.register_task(self.task_id, self.i18n['arch.task.aur.index.status'], get_icon_path()) + self.taskman.update_progress(self.task_id, 1, self.i18n['arch.task.aur.index.substatus.download']) try: res = self.http_client.get(URL_INDEX) if res and res.text: + index_progress = 50 + self.taskman.update_progress(self.task_id, index_progress, + self.i18n['arch.task.aur.index.substatus.gen_index']) indexed = 0 Path(BUILD_DIR).mkdir(parents=True, exist_ok=True) with open(AUR_INDEX_FILE, 'w+') as f: - for n in res.text.split('\n'): + lines = res.text.split('\n') + progress_inc = round(len(lines) / 50) # 1% + + perc_count = 0 + for n in lines: + if index_progress < 100 and perc_count == progress_inc: + index_progress += 1 + perc_count = 0 + self.taskman.update_progress(self.task_id, index_progress, + self.i18n['arch.task.aur.index.substatus.gen_index']) + if n and not n.startswith('#'): f.write('{}={}\n'.format(RE_CLEAR_REPLACE.sub('', n), n)) indexed += 1 + perc_count += 1 + self.logger.info('Pre-indexed {} AUR package names at {}'.format(indexed, AUR_INDEX_FILE)) + self.taskman.update_progress(self.task_id, 100, None) + else: self.logger.warning('No data returned from: {}'.format(URL_INDEX)) + self.taskman.update_progress(self.task_id, 100, self.i18n['arch.task.aur.index.substatus.error.no_data']) + except requests.exceptions.ConnectionError: self.logger.warning('No internet connection: could not pre-index packages') + self.taskman.update_progress(self.task_id, 100, self.i18n['arch.task.aur.index.substatus.error.download']) - self.logger.info("Finished") + tf = time.time() + self.taskman.finish_task(self.task_id) + self.logger.info("Finished. Took {0:.2f} seconds".format(tf - ti)) class ArchDiskCacheUpdater(Thread): - def __init__(self, task_man: TaskManager, arch_config: dict, i18n: I18n, logger: logging.Logger, controller: "ArchManager", internet_available: bool): + def __init__(self, task_man: TaskManager, arch_config: dict, i18n: I18n, logger: logging.Logger, controller: "ArchManager", internet_available: bool, aur_indexer: Thread): super(ArchDiskCacheUpdater, self).__init__(daemon=True) self.logger = logger self.task_man = task_man @@ -76,6 +104,7 @@ class ArchDiskCacheUpdater(Thread): self.internet_available = internet_available self.installed_hash_path = '{}/installed.sha1'.format(ARCH_CACHE_PATH) self.installed_cache_dir = '{}/installed'.format(ARCH_CACHE_PATH) + self.aur_indexer = aur_indexer def update_indexed(self, pkgname: str): self.indexed += 1 @@ -122,7 +151,11 @@ class ArchDiskCacheUpdater(Thread): self.logger.info('Pre-caching installed Arch packages data to disk') - self._update_progress(20, self.i18n['arch.task.disk_cache.checking']) + if self.aur and self.aur_indexer: + self.task_man.update_progress(self.task_id, 20, self.i18n['arch.task.disk_cache.waiting_aur_index'].format(bold(self.i18n['arch.task.aur.index.status']))) + self.aur_indexer.join() + + self._update_progress(21, self.i18n['arch.task.disk_cache.checking']) installed = self.controller.read_installed(disk_loader=None, internet_available=self.internet_available, only_apps=False, pkg_types=None, limit=-1, names=not_cached_names, wait_disk_cache=False).installed @@ -149,7 +182,7 @@ class ArchDiskCacheUpdater(Thread): class ArchCompilationOptimizer(Thread): - def __init__(self, arch_config: dict, i18n: I18n, logger: logging.Logger, task_man: TaskManager = None): + def __init__(self, arch_config: dict, i18n: I18n, logger: logging.Logger, taskman: Optional[TaskManager] = None): super(ArchCompilationOptimizer, self).__init__(daemon=True) self.logger = logger self.i18n = i18n @@ -157,7 +190,7 @@ class ArchCompilationOptimizer(Thread): self.re_compress_zst = re.compile(r'#?\s*COMPRESSZST\s*=\s*.+') self.re_build_env = re.compile(r'\s+BUILDENV\s*=.+') self.re_ccache = re.compile(r'!?ccache') - self.task_man = task_man + self.taskman = taskman self.task_id = 'arch_make_optm' self.optimizations = bool(arch_config['optimize']) @@ -165,11 +198,11 @@ class ArchCompilationOptimizer(Thread): return bool(run_cmd('which ccache', print_error=False)) def _update_progress(self, progress: float, substatus: str = None): - if self.task_man: - self.task_man.update_progress(self.task_id, progress, substatus) + if self.taskman: + self.taskman.update_progress(self.task_id, progress, substatus) if progress == 100: - self.task_man.finish_task(self.task_id) + self.taskman.finish_task(self.task_id) def optimize(self): ti = time.time() @@ -295,8 +328,8 @@ class ArchCompilationOptimizer(Thread): self.logger.info('Finished') else: - if self.task_man: - self.task_man.register_task(self.task_id, self.i18n['arch.task.optimizing'].format(bold('makepkg.conf')), get_icon_path()) + if self.taskman: + self.taskman.register_task(self.task_id, self.i18n['arch.task.optimizing'].format(bold('makepkg.conf')), get_icon_path()) self.optimize()