[arch][snap] improvement -> caching categories file for 24 hours

This commit is contained in:
Vinicius Moreira
2020-12-28 10:41:54 -03:00
parent 487f019573
commit 01bd532465
36 changed files with 226 additions and 83 deletions

View File

@@ -22,7 +22,8 @@ def read_config(update_file: bool = False) -> dict:
'check_dependency_breakage': True,
'suggest_unneeded_uninstall': False,
'suggest_optdep_uninstall': False,
'aur_idx_exp': 720}
'aur_idx_exp': 720,
'categories_exp': 24}
return read(CONFIG_FILE, template, update_file=update_file)

View File

@@ -2623,7 +2623,7 @@ class ArchManager(SoftwareManager):
return action != SoftwareAction.SEARCH
def _start_category_task(self, task_man: TaskManager):
task_man.register_task('arch_aur_cats', self.i18n['task.download_categories'].format('Arch'), get_icon_path())
task_man.register_task('arch_aur_cats', self.i18n['task.download_categories'], get_icon_path())
task_man.update_progress('arch_aur_cats', 50, None)
def _finish_category_task(self, task_man: TaskManager):
@@ -2654,8 +2654,11 @@ class ArchManager(SoftwareManager):
self.disk_cache_updater.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,
manager=self, url_categories_file=URL_CATEGORIES_FILE,
categories_path=CATEGORIES_FILE_PATH,
expiration=arch_config['categories_exp'] if isinstance(arch_config['categories_exp'], int) else '',
internet_connection=internet_available,
internet_checker=self.context.internet_checker,
before=lambda: self._start_category_task(task_manager),
after=lambda: self._finish_category_task(task_manager)).start()
@@ -2878,7 +2881,14 @@ class ArchManager(SoftwareManager):
max_width=max_width,
file_path=local_config['aur_build_dir'],
capitalize_label=False,
directory=True)
directory=True),
TextInputComponent(id_='arch_cats_exp',
label=self.i18n['arch.config.categories_exp'],
tooltip=self.i18n['arch.config.categories_exp.tip'],
max_width=max_width,
only_int=True,
capitalize_label=False,
value=local_config['categories_exp'] if isinstance(local_config['categories_exp'], int) else ''),
]
return PanelComponent([FormComponent(fields, spaces=False)])
@@ -2886,25 +2896,26 @@ class ArchManager(SoftwareManager):
def save_settings(self, component: PanelComponent) -> Tuple[bool, Optional[List[str]]]:
config = read_config()
form_install = component.components[0]
config['repositories'] = form_install.get_component('repos').get_selected()
config['aur'] = form_install.get_component('aur').get_selected()
config['optimize'] = form_install.get_component('opts').get_selected()
config['sync_databases'] = form_install.get_component('sync_dbs').get_selected()
config['sync_databases_startup'] = form_install.get_component('sync_dbs_start').get_selected()
config['clean_cached'] = form_install.get_component('clean_cached').get_selected()
config['refresh_mirrors_startup'] = form_install.get_component('ref_mirs').get_selected()
config['mirrors_sort_limit'] = form_install.get_component('mirrors_sort_limit').get_int_value()
config['repositories_mthread_download'] = form_install.get_component('mthread_download').get_selected()
config['automatch_providers'] = form_install.get_component('autoprovs').get_selected()
config['edit_aur_pkgbuild'] = form_install.get_component('edit_aur_pkgbuild').get_selected()
config['aur_remove_build_dir'] = form_install.get_component('aur_remove_build_dir').get_selected()
config['aur_build_dir'] = form_install.get_component('aur_build_dir').file_path
config['aur_build_only_chosen'] = form_install.get_component('aur_build_only_chosen').get_selected()
config['aur_idx_exp'] = form_install.get_component('aur_idx_exp').get_int_value()
config['check_dependency_breakage'] = form_install.get_component('check_dependency_breakage').get_selected()
config['suggest_optdep_uninstall'] = form_install.get_component('suggest_optdep_uninstall').get_selected()
config['suggest_unneeded_uninstall'] = form_install.get_component('suggest_unneeded_uninstall').get_selected()
panel = component.components[0]
config['repositories'] = panel.get_component('repos').get_selected()
config['aur'] = panel.get_component('aur').get_selected()
config['optimize'] = panel.get_component('opts').get_selected()
config['sync_databases'] = panel.get_component('sync_dbs').get_selected()
config['sync_databases_startup'] = panel.get_component('sync_dbs_start').get_selected()
config['clean_cached'] = panel.get_component('clean_cached').get_selected()
config['refresh_mirrors_startup'] = panel.get_component('ref_mirs').get_selected()
config['mirrors_sort_limit'] = panel.get_component('mirrors_sort_limit').get_int_value()
config['repositories_mthread_download'] = panel.get_component('mthread_download').get_selected()
config['automatch_providers'] = panel.get_component('autoprovs').get_selected()
config['edit_aur_pkgbuild'] = panel.get_component('edit_aur_pkgbuild').get_selected()
config['aur_remove_build_dir'] = panel.get_component('aur_remove_build_dir').get_selected()
config['aur_build_dir'] = panel.get_component('aur_build_dir').file_path
config['aur_build_only_chosen'] = panel.get_component('aur_build_only_chosen').get_selected()
config['aur_idx_exp'] = panel.get_component('aur_idx_exp').get_int_value()
config['check_dependency_breakage'] = panel.get_component('check_dependency_breakage').get_selected()
config['suggest_optdep_uninstall'] = panel.get_component('suggest_optdep_uninstall').get_selected()
config['suggest_unneeded_uninstall'] = panel.get_component('suggest_unneeded_uninstall').get_selected()
config['categories_exp'] = panel.get_component('arch_cats_exp').get_int_value()
if not config['aur_build_dir']:
config['aur_build_dir'] = None

View File

@@ -41,6 +41,8 @@ arch.config.aur_build_only_chosen=Build only chosen (AUR)
arch.config.aur_build_only_chosen.tip=Some AUR packages have a common PKGBUILD shared with other packages and that defines build instructions for each one. This property enabled will ensure that only the chosen package will be built.
arch.config.aur_remove_build_dir=Remove build directory (AUR)
arch.config.aur_remove_build_dir.tip=If a package's generated build directory should be removed after the operations is finished.
arch.config.categories_exp=Categories expiration
arch.config.categories_exp.tip=It defines the expiration time (in HOURS) of the packages categories mapping file stored in disc. Use 0 so that it is always updated during initialization.
arch.config.clean_cache=Elimina les versions antigues
arch.config.clean_cache.tip=Si cal eliminar les versions antigues d'un paquet emmagatzemat al disc durant la desinstal·lació
arch.config.check_dependency_breakage=Check dependency version breakage

View File

@@ -41,6 +41,8 @@ arch.config.aur_build_only_chosen=Build only chosen (AUR)
arch.config.aur_build_only_chosen.tip=Some AUR packages have a common PKGBUILD shared with other packages and that defines build instructions for each one. This property enabled will ensure that only the chosen package will be built.
arch.config.aur_remove_build_dir=Remove build directory (AUR)
arch.config.aur_remove_build_dir.tip=If a package's generated build directory should be removed after the operations is finished.
arch.config.categories_exp=Categories expiration
arch.config.categories_exp.tip=It defines the expiration time (in HOURS) of the packages categories mapping file stored in disc. Use 0 so that it is always updated during initialization.
arch.config.clean_cache=Remove old versions
arch.config.clean_cache.tip=Whether old versions of a package stored on disk should be removed during uninstall
arch.config.check_dependency_breakage=Check dependency version breakage

View File

@@ -41,6 +41,8 @@ arch.config.aur_build_only_chosen=Build only chosen (AUR)
arch.config.aur_build_only_chosen.tip=Some AUR packages have a common PKGBUILD shared with other packages and that defines build instructions for each one. This property enabled will ensure that only the chosen package will be built.
arch.config.aur_remove_build_dir=Remove build directory (AUR)
arch.config.aur_remove_build_dir.tip=If a package's generated build directory should be removed after the operations is finished.
arch.config.categories_exp=Categories expiration
arch.config.categories_exp.tip=It defines the expiration time (in HOURS) of the packages categories mapping file stored in disc. Use 0 so that it is always updated during initialization.
arch.config.clean_cache=Remove old versions
arch.config.clean_cache.tip=Whether old versions of a package stored on disk should be removed during uninstall
arch.config.check_dependency_breakage=Check dependency version breakage

View File

@@ -41,6 +41,8 @@ arch.config.aur_build_only_chosen=Compilar solo elegido (AUR)
arch.config.aur_build_only_chosen.tip=Algunos paquetes AUR tienen un PKGBUILD común compartido con otros paquetes y que define las instrucciones de construcción para cada uno. Esta propiedad habilitada garantizará que solo se compile el paquete elegido.
arch.config.aur_remove_build_dir=Eliminar directorio de compilación (AUR)
arch.config.aur_remove_build_dir.tip=Si el directorio de compilación generado para un paquete debe ser eliminado una vez finalizada la operación.
arch.config.categories_exp=Expiración de categorías
arch.config.categories_exp.tip=Define el tiempo de vencimiento (en HORAS) del archivo de mapeo de categorías de paquetes almacenado en el disco. Utilice 0 para que siempre se actualice durante la inicialización.
arch.config.clean_cache=Eliminar versiones antiguas
arch.config.clean_cache.tip=Si las versiones antiguas de un paquete almacenado en el disco deben ser eliminadas durante la desinstalación
arch.config.check_dependency_breakage=Verificar rotura de versión de dependencia

View File

@@ -41,6 +41,8 @@ arch.config.aur_build_only_chosen=Compiler uniquement la sélection (AUR)
arch.config.aur_build_only_chosen.tip=Certains paquets AUR ont un PKGBUILD commun partagé avec d'autres packages et ça définit les insctructions de compilation pour chacun d'eux. Cette propriété assure que le paquet sélectionné sera le seul compilé.
arch.config.aur_remove_build_dir=Supprimer le répertoire de compilation (AUR)
arch.config.aur_remove_build_dir.tip=Si le repertoire de compilation généré doit être supprimé à la fin des opérations.
arch.config.categories_exp=Categories expiration
arch.config.categories_exp.tip=It defines the expiration time (in HOURS) of the packages categories mapping file stored in disc. Use 0 so that it is always updated during initialization.
arch.config.clean_cache=Supprimer les anciennes versions
arch.config.clean_cache.tip=Supprimer les vielles versions d'un package stocké sur le disque pendant la désinstallation
arch.config.check_dependency_breakage=Vérification pour éviter qu'une version de casse les dépendances

View File

@@ -41,6 +41,8 @@ arch.config.aur_build_only_chosen=Build only chosen (AUR)
arch.config.aur_build_only_chosen.tip=Some AUR packages have a common PKGBUILD shared with other packages and that defines build instructions for each one. This property enabled will ensure that only the chosen package will be built.
arch.config.aur_remove_build_dir=Remove build directory (AUR)
arch.config.aur_remove_build_dir.tip=If a package's generated build directory should be removed after the operations is finished.
arch.config.categories_exp=Categories expiration
arch.config.categories_exp.tip=It defines the expiration time (in HOURS) of the packages categories mapping file stored in disc. Use 0 so that it is always updated during initialization.
arch.config.clean_cache=Rimuovi le vecchie versioni
arch.config.clean_cache.tip=Se le vecchie versioni di un pacchetto memorizzate sul disco devono essere rimosse durante la disinstallazione
arch.config.check_dependency_breakage=Check dependency version breakage

View File

@@ -41,6 +41,8 @@ arch.config.aur_build_only_chosen=Construir somente escolhido (AUR)
arch.config.aur_build_only_chosen.tip=Alguns pacotes do AUR têm um PKGBUILD comum a outros pacotes e que define a construção para todos. Essa propriedade ativada garantirá que somente o pacote escolhido será construído.
arch.config.aur_remove_build_dir=Remover diretório de construção (AUR)
arch.config.aur_remove_build_dir.tip=Se o diretório gerado para a construção de um pacote do AUR deve ser removido após a operação ser finalizada.
arch.config.categories_exp=Expiração de categorias
arch.config.categories_exp.tip=Define o tempo de expiração (em HORAS) do arquivo de mapeamento de categorias de pacotes armazenado em disco. Utilize 0 para que ele seja sempre atualizado durante a inicialização.
arch.config.clean_cache=Remover versões antigas
arch.config.clean_cache.tip=Se versões antigas de um pacote armazenadas em disco devem ser removidas durante a desinstalação
arch.config.check_dependency_breakage=Verificar quebra de dependência de versão

View File

@@ -41,6 +41,8 @@ arch.config.aur_build_only_chosen=Build only chosen (AUR)
arch.config.aur_build_only_chosen.tip=Some AUR packages have a common PKGBUILD shared with other packages and that defines build instructions for each one. This property enabled will ensure that only the chosen package will be built.
arch.config.aur_remove_build_dir=Remove build directory (AUR)
arch.config.aur_remove_build_dir.tip=If a package's generated build directory should be removed after the operations is finished.
arch.config.categories_exp=Categories expiration
arch.config.categories_exp.tip=It defines the expiration time (in HOURS) of the packages categories mapping file stored in disc. Use 0 so that it is always updated during initialization.
arch.config.clean_cache=Remove old versions
arch.config.clean_cache.tip=Whether old versions of a package stored on disk should be removed during uninstall
arch.config.check_dependency_breakage=Check dependency version breakage

View File

@@ -41,6 +41,8 @@ arch.config.aur_build_only_chosen=Build only chosen (AUR)
arch.config.aur_build_only_chosen.tip=Some AUR packages have a common PKGBUILD shared with other packages and that defines build instructions for each one. This property enabled will ensure that only the chosen package will be built.
arch.config.aur_remove_build_dir=Remove build directory (AUR)
arch.config.aur_remove_build_dir.tip=If a package's generated build directory should be removed after the operations is finished.
arch.config.categories_exp=Categories expiration
arch.config.categories_exp.tip=It defines the expiration time (in HOURS) of the packages categories mapping file stored in disc. Use 0 so that it is always updated during initialization.
arch.config.clean_cache=Önbelleği temizle
arch.config.clean_cache.tip=Disk üzerinde kurulu bir paketin eski sürümlerinin kaldırma sırasında kaldırılıp kaldırılmayacağı
arch.config.check_dependency_breakage=Check dependency version breakage