appimage downgrading

This commit is contained in:
Vinicius Moreira
2019-10-08 18:36:47 -03:00
parent d44258bcab
commit a3bccb86f4
7 changed files with 62 additions and 15 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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'

View File

@@ -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
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 {} ({})

View File

@@ -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
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 {} ({})

View File

@@ -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
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 {} ({})