mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-06 22:54:16 +02:00
[flatpak] new update model for flatpak 1.0.X
This commit is contained in:
@@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
- Flatpak:
|
||||
- allow the user to choose the 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 )
|
||||
|
||||
### Improvements
|
||||
|
||||
@@ -127,7 +127,7 @@ class FlatpakManager(SoftwareManager):
|
||||
partial_model.update = True
|
||||
models.append(partial_model)
|
||||
else:
|
||||
model.update = app_json['ref'] in updates[0] if updates else None
|
||||
model.update = '{}/{}'.format(app_json['installation'], app_json['ref']) in update_map['full']
|
||||
|
||||
return SearchResult(models, None, len(models))
|
||||
|
||||
@@ -176,6 +176,9 @@ class FlatpakManager(SoftwareManager):
|
||||
app_info['type'] = 'runtime' if app.runtime else 'app'
|
||||
app_info['description'] = strip_html(app.description) if app.description else ''
|
||||
|
||||
if app.installation:
|
||||
app_info['installation'] = app.installation
|
||||
|
||||
if app_info.get('installed'):
|
||||
app_info['installed'] = app_info['installed'].replace('?', ' ')
|
||||
|
||||
|
||||
@@ -180,16 +180,22 @@ def list_updates_as_str(version: str) -> Dict[str, set]:
|
||||
|
||||
|
||||
def read_updates(version: str, installation: str) -> Dict[str, set]:
|
||||
res = {'partial': set(), 'full': set()}
|
||||
if version < '1.2':
|
||||
# TODO
|
||||
return run_cmd('{} update --no-related --{}'.format(BASE_CMD, installation), ignore_return_code=True)
|
||||
try:
|
||||
output = run_cmd('{} update --no-related --no-deps --{}'.format(BASE_CMD, installation), ignore_return_code=True)
|
||||
|
||||
if 'Updating in {}'.format(installation) in output:
|
||||
for line in output.split('Updating in {}:\n'.format(installation))[1].split('\n'):
|
||||
if not line.startswith('Is this ok'):
|
||||
res['full'].add('{}/{}'.format(installation, line.split('\t')[0].strip()))
|
||||
except:
|
||||
traceback.print_exc()
|
||||
else:
|
||||
updates = new_subprocess([BASE_CMD, 'update', '--{}'.format(installation)]).stdout
|
||||
|
||||
reg = r'[0-9]+\.\s+.+' if version >= '1.5.0' else r'[0-9]+\.\s+(\w+|\.)+\s+\w+\s+(\w|\.)+'
|
||||
|
||||
res = {'partial': set(), 'full': set()}
|
||||
|
||||
try:
|
||||
for o in new_subprocess(['grep', '-E', reg, '-o', '--color=never'], stdin=updates).stdout:
|
||||
if o:
|
||||
@@ -207,7 +213,7 @@ def read_updates(version: str, installation: str) -> Dict[str, set]:
|
||||
except:
|
||||
traceback.print_exc()
|
||||
|
||||
return res
|
||||
return res
|
||||
|
||||
|
||||
def downgrade(app_ref: str, commit: str, installation: str, root_password: str) -> subprocess.Popen:
|
||||
|
||||
Reference in New Issue
Block a user