mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 00:04:15 +02:00
[fix][flatpak] displaying a wrong popup message when an error happens during commits reading within the downgrade process
This commit is contained in:
@@ -23,6 +23,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||||||
- not pre-downloading some source files ( e.g: from **anbox-image** )
|
- not pre-downloading some source files ( e.g: from **anbox-image** )
|
||||||
- not able to install packages based on other packages ( package name != package base )
|
- not able to install packages based on other packages ( package name != package base )
|
||||||
- downgrade: pre-downloading sources from the latest version instead of the older
|
- downgrade: pre-downloading sources from the latest version instead of the older
|
||||||
|
- Flatpak:
|
||||||
|
- displaying "No Internet connection" when an error happens during commits reading within the downgrade process
|
||||||
- UI:
|
- UI:
|
||||||
- **About** window icons scaling
|
- **About** window icons scaling
|
||||||
|
|
||||||
|
|||||||
@@ -151,11 +151,15 @@ class FlatpakManager(SoftwareManager):
|
|||||||
return SearchResult(models, None, len(models))
|
return SearchResult(models, None, len(models))
|
||||||
|
|
||||||
def downgrade(self, pkg: FlatpakApplication, root_password: str, watcher: ProcessWatcher) -> bool:
|
def downgrade(self, pkg: FlatpakApplication, root_password: str, watcher: ProcessWatcher) -> bool:
|
||||||
|
handler = ProcessHandler(watcher)
|
||||||
pkg.commit = flatpak.get_commit(pkg.id, pkg.branch, pkg.installation)
|
pkg.commit = flatpak.get_commit(pkg.id, pkg.branch, pkg.installation)
|
||||||
|
|
||||||
watcher.change_progress(10)
|
watcher.change_progress(10)
|
||||||
watcher.change_substatus(self.i18n['flatpak.downgrade.commits'])
|
watcher.change_substatus(self.i18n['flatpak.downgrade.commits'])
|
||||||
commits = flatpak.get_app_commits(pkg.ref, pkg.origin, pkg.installation)
|
commits = flatpak.get_app_commits(pkg.ref, pkg.origin, pkg.installation, handler)
|
||||||
|
|
||||||
|
if commits is None:
|
||||||
|
return False
|
||||||
|
|
||||||
commit_idx = commits.index(pkg.commit)
|
commit_idx = commits.index(pkg.commit)
|
||||||
|
|
||||||
@@ -167,9 +171,9 @@ class FlatpakManager(SoftwareManager):
|
|||||||
commit = commits[commit_idx + 1]
|
commit = commits[commit_idx + 1]
|
||||||
watcher.change_substatus(self.i18n['flatpak.downgrade.reverting'])
|
watcher.change_substatus(self.i18n['flatpak.downgrade.reverting'])
|
||||||
watcher.change_progress(50)
|
watcher.change_progress(50)
|
||||||
success = ProcessHandler(watcher).handle(SystemProcess(subproc=flatpak.downgrade(pkg.ref, commit, pkg.installation, root_password),
|
success = handler.handle(SystemProcess(subproc=flatpak.downgrade(pkg.ref, commit, pkg.installation, root_password),
|
||||||
success_phrases=['Changes complete.', 'Updates complete.'],
|
success_phrases=['Changes complete.', 'Updates complete.'],
|
||||||
wrong_error_phrase='Warning'))
|
wrong_error_phrase='Warning'))
|
||||||
watcher.change_progress(100)
|
watcher.change_progress(100)
|
||||||
return success
|
return success
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ from datetime import datetime
|
|||||||
from typing import List, Dict, Set
|
from typing import List, Dict, Set
|
||||||
|
|
||||||
from bauh.api.exception import NoInternetException
|
from bauh.api.exception import NoInternetException
|
||||||
from bauh.commons.system import new_subprocess, run_cmd, new_root_subprocess, SimpleProcess
|
from bauh.commons.system import new_subprocess, run_cmd, new_root_subprocess, SimpleProcess, ProcessHandler
|
||||||
|
|
||||||
BASE_CMD = 'flatpak'
|
BASE_CMD = 'flatpak'
|
||||||
RE_SEVERAL_SPACES = re.compile(r'\s+')
|
RE_SEVERAL_SPACES = re.compile(r'\s+')
|
||||||
@@ -150,15 +150,6 @@ def update(app_ref: str, installation: str):
|
|||||||
return new_subprocess([BASE_CMD, 'update', '--no-related', '--no-deps', '-y', app_ref, '--{}'.format(installation)])
|
return new_subprocess([BASE_CMD, 'update', '--no-related', '--no-deps', '-y', app_ref, '--{}'.format(installation)])
|
||||||
|
|
||||||
|
|
||||||
def register_flathub(installation: str) -> SimpleProcess:
|
|
||||||
return SimpleProcess([BASE_CMD,
|
|
||||||
'remote-add',
|
|
||||||
'--if-not-exists',
|
|
||||||
'flathub',
|
|
||||||
'https://flathub.org/repo/flathub.flatpakrepo',
|
|
||||||
'--{}'.format(installation)])
|
|
||||||
|
|
||||||
|
|
||||||
def uninstall(app_ref: str, installation: str):
|
def uninstall(app_ref: str, installation: str):
|
||||||
"""
|
"""
|
||||||
Removes the app by its reference
|
Removes the app by its reference
|
||||||
@@ -228,12 +219,15 @@ def downgrade(app_ref: str, commit: str, installation: str, root_password: str)
|
|||||||
return new_subprocess(cmd)
|
return new_subprocess(cmd)
|
||||||
|
|
||||||
|
|
||||||
def get_app_commits(app_ref: str, origin: str, installation: str) -> List[str]:
|
def get_app_commits(app_ref: str, origin: str, installation: str, handler: ProcessHandler) -> List[str]:
|
||||||
log = run_cmd('{} remote-info --log {} {} --{}'.format(BASE_CMD, origin, app_ref, installation))
|
try:
|
||||||
|
p = SimpleProcess(['flatpak', 'remote-info', '--log', origin, app_ref, '--{}'.format(installation)])
|
||||||
if log:
|
success, output = handler.handle_simple(p)
|
||||||
return re.findall(r'Commit+:\s(.+)', log)
|
if output.startswith('error:'):
|
||||||
else:
|
return
|
||||||
|
else:
|
||||||
|
return re.findall(r'Commit+:\s(.+)', output)
|
||||||
|
except:
|
||||||
raise NoInternetException()
|
raise NoInternetException()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user