diff --git a/CHANGELOG.md b/CHANGELOG.md index 76f368ed..08b568d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,13 +17,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Minor UI improvements ### AppImage support -- Search, install, uninstall and retrieve history of applications available in [AppImageHub](https://appimage.github.io) -- Adds desktop entries (menu shortcuts) for the installed applications - - -### AppImage support -- Database from https://appimage.github.io -- Search, install, uninstall +- Search, install, uninstall, downgrade, launch and retrieve the applications history available in [AppImageHub](https://appimage.github.io) +- Adds desktop entries ( menu shortcuts ) for the installed applications ( **~/.local/share/applications **) ## [0.6.2] 2019-10-02 diff --git a/README.md b/README.md index e77952d7..76a36ebb 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,7 @@ You can change some application settings via environment variables or arguments - Let the disk cache always enabled so **bauh** does not need to dynamically retrieve some data every time you launch it. ### Flatpak support ( flatpak gem ) -- The user is able to search, install, uninstall, downgrade, laucnh and retrieve the applications history +- The user is able to search, install, uninstall, downgrade, launch and retrieve the applications history ### Snap support ( snap gem ) - The user is able to search, install, uninstall, refresh, launch and downgrade applications @@ -104,7 +104,8 @@ will be pre-downloaded faster ( it does **NOT** modify your **pacman** settings - Automatically makes simple package compilation improvements ### AppImage support ( appimage gem ) -- +- The user is able to search, install, uninstall, downgrade, launch and retrieve the applications history available in [AppImageHub](https://appimage.github.io) +- Adds desktop entries ( menu shortcuts ) for the installed applications ( **~/.local/share/applications **) a) if **MAKEFLAGS** is not set in **/etc/makepkg.conf** and **~/.makepkg.conf** does not exist, then a copy of **/etc/makepkg.conf** will be generated at **~/.makepkg.conf** defining MAKEFLAGS to work with diff --git a/bauh/gems/appimage/controller.py b/bauh/gems/appimage/controller.py index 35cbeaf4..b4cb2f71 100644 --- a/bauh/gems/appimage/controller.py +++ b/bauh/gems/appimage/controller.py @@ -85,7 +85,41 @@ class AppImageManager(SoftwareManager): return res def downgrade(self, pkg: AppImage, root_password: str, watcher: ProcessWatcher) -> bool: - pass + versions = self.get_history(pkg) + + if len(versions.history) == 1: + watcher.show_message(title=self.i18n['appimage.downgrade.impossible.title'], + body=self.i18n['appimage.downgrade.impossible.body'].format(bold(pkg.name)), + type_=MessageType.ERROR) + return False + elif versions.pkg_status_idx == -1: + watcher.show_message(title=self.i18n['appimage.downgrade.impossible.title'], + body=self.i18n['appimage.downgrade.unknown_version.body'].format(bold(pkg.name)), + type_=MessageType.ERROR) + return False + elif versions.pkg_status_idx == len(versions.history) - 1: + watcher.show_message(title=self.i18n['appimage.downgrade.impossible.title'], + body=self.i18n['appimage.downgrade.first_version'].format(bold(pkg.name)), + type_=MessageType.ERROR) + return False + else: + if self.uninstall(pkg, root_password, watcher): + old_release = versions.history[versions.pkg_status_idx + 1] + pkg.version = old_release['0_version'] + pkg.url_download = old_release['2_url_download'] + if self.install(pkg, root_password, watcher): + self.cache_to_disk(pkg, None, False) + return True + else: + watcher.show_message(title=self.i18n['error'], + body=self.i18n['appimage.downgrade.install_version'].format(bold(pkg.version), bold(pkg.url_download)), + type_=MessageType.ERROR) + else: + watcher.show_message(title=self.i18n['error'], + body=self.i18n['appimage.downgrade.uninstall_current_version'].format(bold(pkg.name)), + type_=MessageType.ERROR) + + return False def update(self, pkg: AppImage, root_password: str, watcher: ProcessWatcher) -> SystemProcess: pass diff --git a/bauh/gems/appimage/model.py b/bauh/gems/appimage/model.py index 41107ee2..bcb097db 100644 --- a/bauh/gems/appimage/model.py +++ b/bauh/gems/appimage/model.py @@ -35,8 +35,7 @@ class AppImage(SoftwarePackage): return True def can_be_downgraded(self): - # TODO - return False + return self.installed def get_type(self): return 'AppImage' diff --git a/bauh/gems/appimage/resources/locale/en b/bauh/gems/appimage/resources/locale/en index 09640abb..7a0a72e6 100644 --- a/bauh/gems/appimage/resources/locale/en +++ b/bauh/gems/appimage/resources/locale/en @@ -7,4 +7,10 @@ appimage.info.url_download=File URL appimage.info.icon_path=icon appimage.history.0_version=version appimage.history.1_published_at=date -appimage.history.2_url_download=File URL \ No newline at end of file +appimage.history.2_url_download=File URL +appimage.downgrade.impossible.title=Impossible to downgrade +appimage.downgrade.impossible.body={} has only one published version. +appimage.downgrade.unknown_version.body=It was not possible to identify {} current version in its versions history +appimage.downgrade.first_version={} is in its first published version +appimage.downgrade.uninstall_current_version=It was not possible to uninstall the current version of {} +appimage.downgrade.install_version=It was not possible to install the version {} ({}) \ No newline at end of file diff --git a/bauh/gems/appimage/resources/locale/es b/bauh/gems/appimage/resources/locale/es index a3f64406..0c3ccff7 100644 --- a/bauh/gems/appimage/resources/locale/es +++ b/bauh/gems/appimage/resources/locale/es @@ -7,4 +7,10 @@ appimage.info.url_download=URL del archivo appimage.info.icon_path=icono appimage.history.0_version=versión appimage.history.1_published_at=fecha -appimage.history.2_url_download=URL del archivo \ No newline at end of file +appimage.history.2_url_download=URL del archivo +appimage.downgrade.impossible.title=Imposible revertir la versión +appimage.downgrade.impossible.body={} solo tiene una versión publicada. +appimage.downgrade.unknown_version.body=No fue posible identificar la versión actual de {} en su historial de versiones +appimage.downgrade.first_version={} está en su primera versión publicada +appimage.downgrade.uninstall_current_version=No fue posible desinstalar la versión actual de {} +appimage.downgrade.install_version=No fue posible instalar la versión {} ({}) \ No newline at end of file diff --git a/bauh/gems/appimage/resources/locale/pt b/bauh/gems/appimage/resources/locale/pt index f411bca0..4f5a4c5d 100644 --- a/bauh/gems/appimage/resources/locale/pt +++ b/bauh/gems/appimage/resources/locale/pt @@ -7,4 +7,10 @@ appimage.info.url_download=URL do arquivo appimage.info.icon_path=ícone appimage.history.0_version=versão appimage.history.1_published_at=data -appimage.history.2_url_download=URL do arquivo \ No newline at end of file +appimage.history.2_url_download=URL do arquivo +appimage.downgrade.impossible.title=Impossível reverter a versão +appimage.downgrade.impossible.body={} tem somente uma versão publicada. +appimage.downgrade.unknown_version.body=Não foi possível identificar a versão atual de {} no seu histórico de versões +appimage.downgrade.first_version={} se encontra em sua primeira versão publicada +appimage.downgrade.uninstall_current_version=Não foi possível desinstalar a versão atual de {} +appimage.downgrade.install_version=Não foi possivel instalar a versão {} ({}) \ No newline at end of file