mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-10 20:14:15 +02:00
[snap] fix -> some environment variables are not available during the common operations
This commit is contained in:
@@ -76,6 +76,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||||||
<img src="https://raw.githubusercontent.com/vinifmor/bauh-files/master/pictures/releases/0.9.7/flatpak_refs.png">
|
<img src="https://raw.githubusercontent.com/vinifmor/bauh-files/master/pictures/releases/0.9.7/flatpak_refs.png">
|
||||||
</p>
|
</p>
|
||||||
- some environment variables are not available during the common operations (install, upgrade, downgrade, uninstall)
|
- some environment variables are not available during the common operations (install, upgrade, downgrade, uninstall)
|
||||||
|
- Snap
|
||||||
|
- some environment variables are not available during the common operations (install, upgrade, downgrade, uninstall, launch)
|
||||||
- UI
|
- UI
|
||||||
- crashing when nothing can be upgraded
|
- crashing when nothing can be upgraded
|
||||||
- random C++ wrapper errors with some forms due to missing references
|
- random C++ wrapper errors with some forms due to missing references
|
||||||
|
|||||||
@@ -138,13 +138,13 @@ class SnapManager(SoftwareManager):
|
|||||||
return SearchResult([], None, 0)
|
return SearchResult([], None, 0)
|
||||||
|
|
||||||
def downgrade(self, pkg: SnapApplication, root_password: str, watcher: ProcessWatcher) -> bool:
|
def downgrade(self, pkg: SnapApplication, root_password: str, watcher: ProcessWatcher) -> bool:
|
||||||
return ProcessHandler(watcher).handle(SystemProcess(subproc=snap.downgrade_and_stream(pkg.name, root_password), wrong_error_phrase=None))
|
return ProcessHandler(watcher).handle_simple(snap.downgrade_and_stream(pkg.name, root_password))[0]
|
||||||
|
|
||||||
def upgrade(self, requirements: UpgradeRequirements, root_password: str, watcher: ProcessWatcher) -> SystemProcess:
|
def upgrade(self, requirements: UpgradeRequirements, root_password: str, watcher: ProcessWatcher) -> SystemProcess:
|
||||||
raise Exception("'upgrade' is not supported by {}".format(SnapManager.__class__.__name__))
|
raise Exception("'upgrade' is not supported by {}".format(SnapManager.__class__.__name__))
|
||||||
|
|
||||||
def uninstall(self, pkg: SnapApplication, root_password: str, watcher: ProcessWatcher, disk_loader: DiskCacheLoader) -> TransactionResult:
|
def uninstall(self, pkg: SnapApplication, root_password: str, watcher: ProcessWatcher, disk_loader: DiskCacheLoader) -> TransactionResult:
|
||||||
uninstalled = ProcessHandler(watcher).handle(SystemProcess(subproc=snap.uninstall_and_stream(pkg.name, root_password)))
|
uninstalled = ProcessHandler(watcher).handle_simple(snap.uninstall_and_stream(pkg.name, root_password))[0]
|
||||||
|
|
||||||
if uninstalled:
|
if uninstalled:
|
||||||
if self.suggestions_cache:
|
if self.suggestions_cache:
|
||||||
@@ -254,7 +254,7 @@ class SnapManager(SoftwareManager):
|
|||||||
return action not in ('search', 'prepare')
|
return action not in ('search', 'prepare')
|
||||||
|
|
||||||
def refresh(self, pkg: SnapApplication, root_password: str, watcher: ProcessWatcher) -> bool:
|
def refresh(self, pkg: SnapApplication, root_password: str, watcher: ProcessWatcher) -> bool:
|
||||||
return ProcessHandler(watcher).handle(SystemProcess(subproc=snap.refresh_and_stream(pkg.name, root_password)))
|
return ProcessHandler(watcher).handle_simple(snap.refresh_and_stream(pkg.name, root_password))[0]
|
||||||
|
|
||||||
def _start_category_task(self, task_man: TaskManager):
|
def _start_category_task(self, task_man: TaskManager):
|
||||||
if task_man:
|
if task_man:
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import subprocess
|
|||||||
from io import StringIO
|
from io import StringIO
|
||||||
from typing import List, Tuple, Set
|
from typing import List, Tuple, Set
|
||||||
|
|
||||||
from bauh.commons.system import new_root_subprocess, run_cmd, new_subprocess, SimpleProcess
|
from bauh.commons.system import run_cmd, new_subprocess, SimpleProcess
|
||||||
from bauh.gems.snap.model import SnapApplication
|
from bauh.gems.snap.model import SnapApplication
|
||||||
|
|
||||||
BASE_CMD = 'snap'
|
BASE_CMD = 'snap'
|
||||||
@@ -171,8 +171,10 @@ def search(word: str, exact_name: bool = False) -> List[dict]:
|
|||||||
return apps
|
return apps
|
||||||
|
|
||||||
|
|
||||||
def uninstall_and_stream(app_name: str, root_password: str):
|
def uninstall_and_stream(app_name: str, root_password: str) -> SimpleProcess:
|
||||||
return new_root_subprocess([BASE_CMD, 'remove', app_name], root_password)
|
return SimpleProcess(cmd=[BASE_CMD, 'remove', app_name],
|
||||||
|
root_password=root_password,
|
||||||
|
shell=True)
|
||||||
|
|
||||||
|
|
||||||
def install_and_stream(app_name: str, confinement: str, root_password: str) -> SimpleProcess:
|
def install_and_stream(app_name: str, confinement: str, root_password: str) -> SimpleProcess:
|
||||||
@@ -182,16 +184,19 @@ def install_and_stream(app_name: str, confinement: str, root_password: str) -> S
|
|||||||
if confinement == 'classic':
|
if confinement == 'classic':
|
||||||
install_cmd.append('--classic')
|
install_cmd.append('--classic')
|
||||||
|
|
||||||
# return new_root_subprocess(install_cmd, root_password)
|
return SimpleProcess(install_cmd, root_password=root_password, shell=True)
|
||||||
return SimpleProcess(install_cmd, root_password=root_password)
|
|
||||||
|
|
||||||
|
|
||||||
def downgrade_and_stream(app_name: str, root_password: str) -> subprocess.Popen:
|
def downgrade_and_stream(app_name: str, root_password: str) -> SimpleProcess:
|
||||||
return new_root_subprocess([BASE_CMD, 'revert', app_name], root_password)
|
return SimpleProcess(cmd=[BASE_CMD, 'revert', app_name],
|
||||||
|
root_password=root_password,
|
||||||
|
shell=True)
|
||||||
|
|
||||||
|
|
||||||
def refresh_and_stream(app_name: str, root_password: str) -> subprocess.Popen:
|
def refresh_and_stream(app_name: str, root_password: str) -> SimpleProcess:
|
||||||
return new_root_subprocess([BASE_CMD, 'refresh', app_name], root_password)
|
return SimpleProcess(cmd=[BASE_CMD, 'refresh', app_name],
|
||||||
|
root_password=root_password,
|
||||||
|
shell=True)
|
||||||
|
|
||||||
|
|
||||||
def run(app: SnapApplication, logger: logging.Logger):
|
def run(app: SnapApplication, logger: logging.Logger):
|
||||||
@@ -220,7 +225,7 @@ def run(app: SnapApplication, logger: logging.Logger):
|
|||||||
|
|
||||||
if command:
|
if command:
|
||||||
logger.info("Running '{}'".format(command))
|
logger.info("Running '{}'".format(command))
|
||||||
subprocess.Popen([BASE_CMD, 'run', command])
|
subprocess.Popen('{} run {}'.format(BASE_CMD, command), shell=True)
|
||||||
return
|
return
|
||||||
|
|
||||||
logger.error("No valid command found for '{}'".format(app_name))
|
logger.error("No valid command found for '{}'".format(app_name))
|
||||||
|
|||||||
Reference in New Issue
Block a user