From 23941015c2f075f61279790503e41fffa030fd36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Moreira?= Date: Mon, 13 Jan 2020 11:51:28 -0300 Subject: [PATCH] [flatpak] able to differentiate system and user updates for Flatpak >= 1.5 --- CHANGELOG.md | 9 ++++----- bauh/gems/flatpak/controller.py | 7 +++++-- bauh/gems/flatpak/flatpak.py | 4 ++-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f53be63d..2a971bba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [0.8.1] ### Features: - Flatpak: - - allow the user to choose the installation level: **user** or **system** + - allow the user to choose the application installation level: **user** or **system** - able to deal with user and system applications / runtimes - able to handle partial updates for Flatpak >= 1.5 - new configuration file located at **~/.config/bauh/flatpak.yml** ( it allows to define a default installation level ) @@ -23,17 +23,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - only centralizing the panel for the first refresh ### Fixes -- missing categories i18n [48](https://github.com/vinifmor/bauh/issues/48) +- missing categories i18n [#48](https://github.com/vinifmor/bauh/issues/48) - Web: - not handling HTTP connection issues -- not passing the Home path as a String ( does not work in Python 3.5 ) +- not passing the Home path as a String ( an exception happens for Python 3.5 ) - UI: - not verifying if an icon path is a file - minor fixes -- minor bug fixes ### UI -- Default **Type** icon removed from the Type filter to make the design more consistent with the Category filter. +- Default **Type** icon removed from the Type filter to make the design more consistent. ## [0.8.0] 2019-12-24 ### Features diff --git a/bauh/gems/flatpak/controller.py b/bauh/gems/flatpak/controller.py index 49f16942..10a56b35 100644 --- a/bauh/gems/flatpak/controller.py +++ b/bauh/gems/flatpak/controller.py @@ -115,14 +115,17 @@ class FlatpakManager(SoftwareManager): if update_map and (update_map['full'] or update_map['partial']): if version >= '1.5.0': - update_id = '{}/{}'.format(app_json['id'], app_json['branch']) + update_id = '{}/{}/{}'.format(app_json['id'], app_json['branch'], app_json['installation']) if update_map['full'] and update_id in update_map['full']: model.update = True if update_map['partial']: for partial in update_map['partial']: - if app_json['id'] in partial and '/' + app_json['branch'] in partial: + partial_data = partial.split('/') + if app_json['id'] in partial_data[0] and\ + app_json['branch'] == partial_data[1] and\ + app_json['installation'] == partial_data[2]: partial_model = model.gen_partial(partial.split('/')[0]) partial_model.update = True models.append(partial_model) diff --git a/bauh/gems/flatpak/flatpak.py b/bauh/gems/flatpak/flatpak.py index 359fbb1d..31dfbd29 100755 --- a/bauh/gems/flatpak/flatpak.py +++ b/bauh/gems/flatpak/flatpak.py @@ -200,7 +200,7 @@ def read_updates(version: str, installation: str) -> Dict[str, set]: for o in new_subprocess(['grep', '-E', reg, '-o', '--color=never'], stdin=updates).stdout: if o: line_split = o.decode().strip().split('\t') - update_id = line_split[2] + '/' + line_split[3] + update_id = '{}/{}/{}'.format(line_split[2], line_split[3], installation) if len(line_split) == 7: if line_split[4] != 'i': @@ -217,7 +217,7 @@ def read_updates(version: str, installation: str) -> Dict[str, set]: def downgrade(app_ref: str, commit: str, installation: str, root_password: str) -> subprocess.Popen: - cmd = [BASE_CMD, 'update', '--no-related', '--commit={}'.format(commit), app_ref, '-y'] + cmd = [BASE_CMD, 'update', '--no-related', '--commit={}'.format(commit), app_ref, '-y', '--{}'.format(installation)] if installation == 'system': return new_root_subprocess(cmd, root_password)