diff --git a/CHANGELOG.md b/CHANGELOG.md index 56722fb0..d02cb4db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - the temp dir used now has a different name if you launch bauh as the root user to avoid permissioning issues ( **/tmp/bauh_root** ) ### Fixes +- AUR: + - not able to downgrade some packages with multiple equal versions on their release history - Web: - not able to launch applications for the root user - not able to upgrade the environment's NodeJS version diff --git a/bauh/gems/arch/controller.py b/bauh/gems/arch/controller.py index ccd98afc..3d8d34ee 100644 --- a/bauh/gems/arch/controller.py +++ b/bauh/gems/arch/controller.py @@ -228,6 +228,7 @@ class ArchManager(SoftwareManager): if len(commit_list) > 1: srcfields = {'pkgver', 'pkgrel'} + commit_found = None for idx in range(1, len(commit_list)): commit = commit_list[idx] with open(srcinfo_path) as f: @@ -239,7 +240,17 @@ class ArchManager(SoftwareManager): if '{}-{}'.format(pkgsrc.get('pkgver'), pkgsrc.get('pkgrel')) == pkg.version: # current version found + commit_found = commit + elif commit_found: watcher.change_substatus(self.i18n['arch.downgrade.version_found']) + if not handler.handle(SystemProcess(subproc=new_subprocess(['git', 'checkout', commit_found], cwd=clone_path), check_error_output=False)): + watcher.print("Could not rollback to current version's commit") + return False + + if not handler.handle(SystemProcess(subproc=new_subprocess(['git', 'reset', '--hard', commit_found], cwd=clone_path), check_error_output=False)): + watcher.print("Could not downgrade to previous commit of '{}'. Aborting...".format(commit_found)) + return False + break watcher.change_substatus(self.i18n['arch.downgrade.install_older'])