diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0b595ad2..108ace28 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,13 @@ 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.12] 2021
+### Features
+- Arch
+ - AUR: new custom action to quickly reinstall a package
+
+
+
+
### Improvements
- Arch
- repositories/AUR search time (=~ -70%)
diff --git a/bauh/api/abstract/disk.py b/bauh/api/abstract/disk.py
index fa2e8413..82b785a9 100644
--- a/bauh/api/abstract/disk.py
+++ b/bauh/api/abstract/disk.py
@@ -41,3 +41,7 @@ class DiskCacheLoaderFactory(ABC):
:return:
"""
pass
+
+ @abstractmethod
+ def new(self) -> DiskCacheLoader:
+ pass
diff --git a/bauh/gems/arch/controller.py b/bauh/gems/arch/controller.py
index 7c9c9737..ff54cc23 100644
--- a/bauh/gems/arch/controller.py
+++ b/bauh/gems/arch/controller.py
@@ -26,6 +26,7 @@ from bauh.api.abstract.view import MessageType, FormComponent, InputOption, Sing
ViewComponent, PanelComponent, MultipleSelectComponent, TextInputComponent, TextInputType, \
FileChooserComponent, TextComponent
from bauh.api.constants import TEMP_DIR
+from bauh.api.exception import NoInternetException
from bauh.commons import user, system
from bauh.commons.boot import CreateConfigFile
from bauh.commons.category import CategoriesDownloader
@@ -3398,3 +3399,32 @@ class ArchManager(SoftwareManager):
continue
return res
+
+ def reinstall(self, pkg: ArchPackage, root_password: str, watcher: ProcessWatcher) -> bool: # only available for AUR packages
+ if not self.context.internet_checker.is_available():
+ raise NoInternetException()
+
+ self.aur_client.clean_caches()
+
+ apidatas = self.aur_client.get_info({pkg.name})
+
+ if not apidatas:
+ watcher.show_message(title=self.i18n['error'],
+ body=self.i18n['arch.action.reinstall.error.no_apidata'],
+ type_=MessageType.ERROR)
+ return False
+
+ self.aur_mapper.fill_last_modified(pkg, apidatas[0])
+ context = TransactionContext.gen_context_from(pkg=pkg,
+ arch_config=self.configman.get_config(),
+ root_password=root_password,
+ handler=ProcessHandler(watcher),
+ aur_supported=True)
+ context.skip_opt_deps = False
+ context.update_aur_index = True
+
+ return self.install(pkg=pkg,
+ root_password=root_password,
+ watcher=watcher,
+ context=context,
+ disk_loader=self.context.disk_loader_factory.new()).success
diff --git a/bauh/gems/arch/model.py b/bauh/gems/arch/model.py
index 563d38c4..af044c8d 100644
--- a/bauh/gems/arch/model.py
+++ b/bauh/gems/arch/model.py
@@ -7,19 +7,26 @@ from bauh.view.util.translation import I18n
CACHED_ATTRS = {'command', 'icon_path', 'repository', 'maintainer', 'desktop_entry', 'categories', 'last_modified', 'commit'}
-ACTIONS_AUR_ENABLE_PKGBUILD_EDITION = [CustomSoftwareAction(i18n_label_key='arch.action.enable_pkgbuild_edition',
- i18n_status_key='arch.action.enable_pkgbuild_edition.status',
- i18n_confirm_key='arch.action.enable_pkgbuild_edition.confirm',
- requires_root=False,
- manager_method='enable_pkgbuild_edition',
- icon_path=resource.get_path('img/mark_pkgbuild.svg', ROOT_DIR))]
+ACTION_AUR_ENABLE_PKGBUILD_EDITION = CustomSoftwareAction(i18n_label_key='arch.action.enable_pkgbuild_edition',
+ i18n_status_key='arch.action.enable_pkgbuild_edition.status',
+ i18n_confirm_key='arch.action.enable_pkgbuild_edition.confirm',
+ requires_root=False,
+ manager_method='enable_pkgbuild_edition',
+ icon_path=resource.get_path('img/mark_pkgbuild.svg', ROOT_DIR))
-ACTIONS_AUR_DISABLE_PKGBUILD_EDITION = [CustomSoftwareAction(i18n_label_key='arch.action.disable_pkgbuild_edition',
- i18n_status_key='arch.action.disable_pkgbuild_edition',
- i18n_confirm_key='arch.action.disable_pkgbuild_edition.confirm',
- requires_root=False,
- manager_method='disable_pkgbuild_edition',
- icon_path=resource.get_path('img/unmark_pkgbuild.svg', ROOT_DIR))]
+ACTION_AUR_DISABLE_PKGBUILD_EDITION = CustomSoftwareAction(i18n_label_key='arch.action.disable_pkgbuild_edition',
+ i18n_status_key='arch.action.disable_pkgbuild_edition',
+ i18n_confirm_key='arch.action.disable_pkgbuild_edition.confirm',
+ requires_root=False,
+ manager_method='disable_pkgbuild_edition',
+ icon_path=resource.get_path('img/unmark_pkgbuild.svg', ROOT_DIR))
+
+ACTION_AUR_REINSTALL = CustomSoftwareAction(i18n_label_key='arch.action.reinstall',
+ i18n_status_key='arch.action.reinstall.status',
+ i18n_confirm_key='arch.action.reinstall.confirm',
+ requires_root=True,
+ manager_method='reinstall',
+ icon_path=resource.get_path('img/build.svg', ROOT_DIR))
class ArchPackage(SoftwarePackage):
@@ -174,11 +181,13 @@ class ArchPackage(SoftwarePackage):
return '{}/PKGBUILD'.format(self.get_disk_cache_path())
def get_custom_supported_actions(self) -> List[CustomSoftwareAction]:
- if self.installed and self.pkgbuild_editable is not None and self.repository == 'aur':
- if self.pkgbuild_editable:
- return ACTIONS_AUR_DISABLE_PKGBUILD_EDITION
- else:
- return ACTIONS_AUR_ENABLE_PKGBUILD_EDITION
+ if self.installed and self.repository == 'aur':
+ actions = [ACTION_AUR_REINSTALL]
+
+ if self.pkgbuild_editable is not None:
+ actions.append(ACTION_AUR_DISABLE_PKGBUILD_EDITION if self.pkgbuild_editable else ACTION_AUR_ENABLE_PKGBUILD_EDITION)
+
+ return actions
def __hash__(self):
if self.view_name is not None:
diff --git a/bauh/gems/arch/resources/img/build.svg b/bauh/gems/arch/resources/img/build.svg
new file mode 100644
index 00000000..00ef6f52
--- /dev/null
+++ b/bauh/gems/arch/resources/img/build.svg
@@ -0,0 +1,119 @@
+
+
diff --git a/bauh/gems/arch/resources/locale/ca b/bauh/gems/arch/resources/locale/ca
index e2875e4f..a809896d 100644
--- a/bauh/gems/arch/resources/locale/ca
+++ b/bauh/gems/arch/resources/locale/ca
@@ -9,6 +9,10 @@ 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.action.reinstall=Reinstall
+arch.action.reinstall.status=Reinstalling
+arch.action.reinstall.confirm=Do you want to reinstall {} ?
+arch.action.reinstall.error.no_apidata=It was not possible to retrieve information of {} from AUR
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 {}
diff --git a/bauh/gems/arch/resources/locale/de b/bauh/gems/arch/resources/locale/de
index 3df21a3f..05817f21 100644
--- a/bauh/gems/arch/resources/locale/de
+++ b/bauh/gems/arch/resources/locale/de
@@ -9,6 +9,10 @@ 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.action.reinstall=Reinstall
+arch.action.reinstall.status=Reinstalling
+arch.action.reinstall.confirm=Do you want to reinstall {} ?
+arch.action.reinstall.error.no_apidata=It was not possible to retrieve information of {} from AUR
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
diff --git a/bauh/gems/arch/resources/locale/en b/bauh/gems/arch/resources/locale/en
index 7531351d..69796c5d 100644
--- a/bauh/gems/arch/resources/locale/en
+++ b/bauh/gems/arch/resources/locale/en
@@ -9,6 +9,10 @@ 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.action.reinstall=Reinstall
+arch.action.reinstall.status=Reinstalling
+arch.action.reinstall.confirm=Do you want to reinstall {} ?
+arch.action.reinstall.error.no_apidata=It was not possible to retrieve information of {} from AUR
arch.aur.action.edit_pkgbuild.body=Edit the PKGBUILD file of {} before continuing ?
arch.aur.install.pgp.body=To install {} is necessary to receive the following PGP keys
arch.aur.install.pgp.receive_fail=Could not receive PGP key {}
diff --git a/bauh/gems/arch/resources/locale/es b/bauh/gems/arch/resources/locale/es
index 082a1e58..1975d07f 100644
--- a/bauh/gems/arch/resources/locale/es
+++ b/bauh/gems/arch/resources/locale/es
@@ -9,6 +9,10 @@ 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.action.reinstall=Reinstalar
+arch.action.reinstall.status=Reinstalando
+arch.action.reinstall.confirm=Desea reinstalar {} ?
+arch.action.reinstall.error.no_apidata=No fue posible recuperar información de {} del AUR
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 {}
diff --git a/bauh/gems/arch/resources/locale/fr b/bauh/gems/arch/resources/locale/fr
index 985cfca5..e911398c 100644
--- a/bauh/gems/arch/resources/locale/fr
+++ b/bauh/gems/arch/resources/locale/fr
@@ -9,6 +9,10 @@ arch.action.disable_pkgbuild_edition.status=Décocher PKGBUILD comme éditable
arch.action.enable_pkgbuild_edition=Cocher PKGBUILD comme éditable
arch.action.enable_pkgbuild_edition.confirm=Cocher le PKGBUILD de {} comme éditable ?
arch.action.enable_pkgbuild_edition.status=Le PKGBUILD devient éditable
+arch.action.reinstall=Reinstall
+arch.action.reinstall.status=Reinstalling
+arch.action.reinstall.confirm=Do you want to reinstall {} ?
+arch.action.reinstall.error.no_apidata=It was not possible to retrieve information of {} from AUR
arch.aur.action.edit_pkgbuild.body=Editer le fichier PKGBUILD de {} avant de continuer ?
arch.aur.install.pgp.body=Il faut installer {} pour recevoir les clés PGP suivantes
arch.aur.install.pgp.receive_fail=Échec de la réception de la clé PGP {}
diff --git a/bauh/gems/arch/resources/locale/it b/bauh/gems/arch/resources/locale/it
index 26beb994..b8c6c0d8 100644
--- a/bauh/gems/arch/resources/locale/it
+++ b/bauh/gems/arch/resources/locale/it
@@ -9,6 +9,10 @@ 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.action.reinstall=Reinstall
+arch.action.reinstall.status=Reinstalling
+arch.action.reinstall.confirm=Do you want to reinstall {} ?
+arch.action.reinstall.error.no_apidata=It was not possible to retrieve information of {} from AUR
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 {}
diff --git a/bauh/gems/arch/resources/locale/pt b/bauh/gems/arch/resources/locale/pt
index 6e15056b..c38ce3c0 100644
--- a/bauh/gems/arch/resources/locale/pt
+++ b/bauh/gems/arch/resources/locale/pt
@@ -9,6 +9,10 @@ arch.action.disable_pkgbuild_edition.status=Desmarcando PKGBUILD como editável
arch.action.enable_pkgbuild_edition=Marcando PKGBUILD como editável
arch.action.enable_pkgbuild_edition.confirm=Marcar o PKGBUILD de {} como editável ?
arch.action.enable_pkgbuild_edition.status=Marcando PKGBUILD como editável
+arch.action.reinstall=Reinstalar
+arch.action.reinstall.status=Reinstalando
+arch.action.reinstall.confirm=Deseja reinstalar {} ?
+arch.action.reinstall.error.no_apidata=Não foi possível obter informações de {} do AUR
arch.aur.action.edit_pkgbuild.body=Editar o arquivo PKGBUILD de {} antes de continuar ?
arch.aur.install.pgp.body=Para instalar {} é necessário receber as seguintes chaves PGP
arch.aur.install.pgp.receive_fail=Não foi possível receber a chave PGP {}
diff --git a/bauh/gems/arch/resources/locale/ru b/bauh/gems/arch/resources/locale/ru
index a2434640..8f6978ee 100644
--- a/bauh/gems/arch/resources/locale/ru
+++ b/bauh/gems/arch/resources/locale/ru
@@ -9,6 +9,10 @@ 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.action.reinstall=Reinstall
+arch.action.reinstall.status=Reinstalling
+arch.action.reinstall.confirm=Do you want to reinstall {} ?
+arch.action.reinstall.error.no_apidata=It was not possible to retrieve information of {} from AUR
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-ключ {}
diff --git a/bauh/gems/arch/resources/locale/tr b/bauh/gems/arch/resources/locale/tr
index b770450d..43f75cfb 100644
--- a/bauh/gems/arch/resources/locale/tr
+++ b/bauh/gems/arch/resources/locale/tr
@@ -9,6 +9,10 @@ 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.action.reinstall=Reinstall
+arch.action.reinstall.status=Reinstalling
+arch.action.reinstall.confirm=Do you want to reinstall {} ?
+arch.action.reinstall.error.no_apidata=It was not possible to retrieve information of {} from AUR
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ı {}
diff --git a/bauh/view/util/disk.py b/bauh/view/util/disk.py
index 058b21cf..786ed4e0 100644
--- a/bauh/view/util/disk.py
+++ b/bauh/view/util/disk.py
@@ -22,6 +22,7 @@ class AsyncDiskCacheLoader(Thread, DiskCacheLoader):
self.cache_map = cache_map
self.logger = logger
self.processed = 0
+ self._working = False
def fill(self, pkg: SoftwarePackage, sync: bool = False):
"""
@@ -31,7 +32,7 @@ class AsyncDiskCacheLoader(Thread, DiskCacheLoader):
:return:
"""
if pkg and pkg.supports_disk_cache():
- if sync:
+ if sync or not self._working:
self._fill_cached_data(pkg)
else:
self.pkgs.append(pkg)
@@ -40,6 +41,7 @@ class AsyncDiskCacheLoader(Thread, DiskCacheLoader):
self._work = False
def run(self):
+ self._working = True
last = 0
while True:
@@ -53,6 +55,8 @@ class AsyncDiskCacheLoader(Thread, DiskCacheLoader):
elif not self._work:
break
+ self._working = False
+
def _fill_cached_data(self, pkg: SoftwarePackage) -> bool:
if os.path.exists(pkg.get_disk_data_path()):
disk_path = pkg.get_disk_data_path()