mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-06 21:44:16 +02:00
[fix][flatpak] not retrieving the history correctly for different instalation levels
This commit is contained in:
@@ -151,7 +151,7 @@ class FlatpakManager(SoftwareManager):
|
||||
return SearchResult(models, None, len(models))
|
||||
|
||||
def downgrade(self, pkg: FlatpakApplication, root_password: str, watcher: ProcessWatcher) -> bool:
|
||||
pkg.commit = flatpak.get_commit(pkg.id, pkg.branch)
|
||||
pkg.commit = flatpak.get_commit(pkg.id, pkg.branch, pkg.installation)
|
||||
|
||||
watcher.change_progress(10)
|
||||
watcher.change_substatus(self.i18n['flatpak.downgrade.commits'])
|
||||
@@ -190,7 +190,7 @@ class FlatpakManager(SoftwareManager):
|
||||
|
||||
def get_info(self, app: FlatpakApplication) -> dict:
|
||||
if app.installed:
|
||||
app_info = flatpak.get_app_info_fields(app.id, app.branch)
|
||||
app_info = flatpak.get_app_info_fields(app.id, app.branch, app.installation)
|
||||
app_info['name'] = app.name
|
||||
app_info['type'] = 'runtime' if app.runtime else 'app'
|
||||
app_info['description'] = strip_html(app.description) if app.description else ''
|
||||
@@ -230,7 +230,7 @@ class FlatpakManager(SoftwareManager):
|
||||
return {}
|
||||
|
||||
def get_history(self, pkg: FlatpakApplication) -> PackageHistory:
|
||||
pkg.commit = flatpak.get_commit(pkg.id, pkg.branch)
|
||||
pkg.commit = flatpak.get_commit(pkg.id, pkg.branch, pkg.installation)
|
||||
commits = flatpak.get_app_commits_data(pkg.ref, pkg.origin, pkg.installation)
|
||||
status_idx = 0
|
||||
|
||||
|
||||
@@ -2,18 +2,17 @@ import re
|
||||
import subprocess
|
||||
import traceback
|
||||
from datetime import datetime
|
||||
from io import StringIO
|
||||
from typing import List, Dict, Set
|
||||
|
||||
from bauh.api.exception import NoInternetException
|
||||
from bauh.commons.system import new_subprocess, run_cmd, new_root_subprocess, SimpleProcess, SystemProcess
|
||||
from bauh.commons.system import new_subprocess, run_cmd, new_root_subprocess, SimpleProcess
|
||||
|
||||
BASE_CMD = 'flatpak'
|
||||
RE_SEVERAL_SPACES = re.compile(r'\s+')
|
||||
|
||||
|
||||
def get_app_info_fields(app_id: str, branch: str, fields: List[str] = [], check_runtime: bool = False):
|
||||
info = re.findall(r'\w+:\s.+', get_app_info(app_id, branch))
|
||||
def get_app_info_fields(app_id: str, branch: str, installation: str, fields: List[str] = [], check_runtime: bool = False):
|
||||
info = re.findall(r'\w+:\s.+', get_app_info(app_id, branch, installation))
|
||||
data = {}
|
||||
fields_to_retrieve = len(fields) + (1 if check_runtime and 'ref' not in fields else 0)
|
||||
|
||||
@@ -63,12 +62,12 @@ def get_version():
|
||||
return res.split(' ')[1].strip() if res else None
|
||||
|
||||
|
||||
def get_app_info(app_id: str, branch: str):
|
||||
return run_cmd('{} info {} {}'.format(BASE_CMD, app_id, branch))
|
||||
def get_app_info(app_id: str, branch: str, installation: str):
|
||||
return run_cmd('{} info {} {}'.format(BASE_CMD, app_id, branch, '--{}'.format(installation)))
|
||||
|
||||
|
||||
def get_commit(app_id: str, branch: str) -> str:
|
||||
info = new_subprocess([BASE_CMD, 'info', app_id, branch])
|
||||
def get_commit(app_id: str, branch: str, installation: str) -> str:
|
||||
info = new_subprocess([BASE_CMD, 'info', app_id, branch, '--{}'.format(installation)])
|
||||
|
||||
for o in new_subprocess(['grep', 'Commit:', '--color=never'], stdin=info.stdout).stdout:
|
||||
if o:
|
||||
|
||||
Reference in New Issue
Block a user