[flatpak] able to differentiate system and user updates for Flatpak >= 1.5

This commit is contained in:
Vinícius Moreira
2020-01-13 11:51:28 -03:00
parent 4144631f49
commit 23941015c2
3 changed files with 11 additions and 9 deletions

View File

@@ -7,7 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [0.8.1] ## [0.8.1]
### Features: ### Features:
- Flatpak: - 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 deal with user and system applications / runtimes
- able to handle partial updates for Flatpak >= 1.5 - 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 ) - 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 - only centralizing the panel for the first refresh
### Fixes ### Fixes
- missing categories i18n [48](https://github.com/vinifmor/bauh/issues/48) - missing categories i18n [#48](https://github.com/vinifmor/bauh/issues/48)
- Web: - Web:
- not handling HTTP connection issues - 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: - UI:
- not verifying if an icon path is a file - not verifying if an icon path is a file
- minor fixes - minor fixes
- minor bug fixes
### UI ### 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 ## [0.8.0] 2019-12-24
### Features ### Features

View File

@@ -115,14 +115,17 @@ class FlatpakManager(SoftwareManager):
if update_map and (update_map['full'] or update_map['partial']): if update_map and (update_map['full'] or update_map['partial']):
if version >= '1.5.0': 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']: if update_map['full'] and update_id in update_map['full']:
model.update = True model.update = True
if update_map['partial']: if update_map['partial']:
for partial in 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 = model.gen_partial(partial.split('/')[0])
partial_model.update = True partial_model.update = True
models.append(partial_model) models.append(partial_model)

View File

@@ -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: for o in new_subprocess(['grep', '-E', reg, '-o', '--color=never'], stdin=updates).stdout:
if o: if o:
line_split = o.decode().strip().split('\t') 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 len(line_split) == 7:
if line_split[4] != 'i': 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: 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': if installation == 'system':
return new_root_subprocess(cmd, root_password) return new_root_subprocess(cmd, root_password)