mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-10 16:44:16 +02:00
[flatpak] fix -> installation fails when there are multiple references for a given package
This commit is contained in:
@@ -40,6 +40,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||||||
- Flatpak
|
- Flatpak
|
||||||
- downgrading crashing with version 1.8.X
|
- downgrading crashing with version 1.8.X
|
||||||
- history: the top commit is returned as "(null)"
|
- history: the top commit is returned as "(null)"
|
||||||
|
- installation fails when there are multiple references for a given package (e.g: openh264)
|
||||||
|
<p align="center">
|
||||||
|
<img src="https://raw.githubusercontent.com/vinifmor/bauh/staging/pictures/releases/0.9.7/flatpak_refs.png">
|
||||||
|
</p>
|
||||||
- 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
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ class SimpleProcess:
|
|||||||
|
|
||||||
def __init__(self, cmd: List[str], cwd: str = '.', expected_code: int = 0,
|
def __init__(self, cmd: List[str], cwd: str = '.', expected_code: int = 0,
|
||||||
global_interpreter: bool = USE_GLOBAL_INTERPRETER, lang: str = DEFAULT_LANG, root_password: str = None,
|
global_interpreter: bool = USE_GLOBAL_INTERPRETER, lang: str = DEFAULT_LANG, root_password: str = None,
|
||||||
extra_paths: Set[str] = None, error_phrases: Set[str] = None):
|
extra_paths: Set[str] = None, error_phrases: Set[str] = None, wrong_error_phrases: Set[str] = None):
|
||||||
pwdin, final_cmd = None, []
|
pwdin, final_cmd = None, []
|
||||||
|
|
||||||
if root_password is not None:
|
if root_password is not None:
|
||||||
@@ -77,6 +77,7 @@ class SimpleProcess:
|
|||||||
self.instance = self._new(final_cmd, cwd, global_interpreter, lang, stdin=pwdin, extra_paths=extra_paths)
|
self.instance = self._new(final_cmd, cwd, global_interpreter, lang, stdin=pwdin, extra_paths=extra_paths)
|
||||||
self.expected_code = expected_code
|
self.expected_code = expected_code
|
||||||
self.error_phrases = error_phrases
|
self.error_phrases = error_phrases
|
||||||
|
self.wrong_error_phrases = wrong_error_phrases
|
||||||
|
|
||||||
def _new(self, cmd: List[str], cwd: str, global_interpreter: bool, lang: str, stdin = None, extra_paths: Set[str] = None) -> subprocess.Popen:
|
def _new(self, cmd: List[str], cwd: str, global_interpreter: bool, lang: str, stdin = None, extra_paths: Set[str] = None) -> subprocess.Popen:
|
||||||
|
|
||||||
@@ -182,11 +183,18 @@ class ProcessHandler:
|
|||||||
success = proc.instance.returncode == proc.expected_code
|
success = proc.instance.returncode == proc.expected_code
|
||||||
string_output = output.read()
|
string_output = output.read()
|
||||||
|
|
||||||
if proc.error_phrases:
|
if not success and proc.wrong_error_phrases:
|
||||||
|
for phrase in proc.wrong_error_phrases:
|
||||||
|
if phrase in string_output:
|
||||||
|
success = True
|
||||||
|
break
|
||||||
|
|
||||||
|
if success and proc.error_phrases:
|
||||||
for phrase in proc.error_phrases:
|
for phrase in proc.error_phrases:
|
||||||
if phrase in string_output:
|
if phrase in string_output:
|
||||||
success = False
|
success = False
|
||||||
break
|
break
|
||||||
|
|
||||||
return success, string_output
|
return success, string_output
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import traceback
|
import traceback
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from math import floor
|
from math import floor
|
||||||
@@ -25,6 +26,7 @@ from bauh.gems.flatpak.model import FlatpakApplication
|
|||||||
from bauh.gems.flatpak.worker import FlatpakAsyncDataLoader, FlatpakUpdateLoader
|
from bauh.gems.flatpak.worker import FlatpakAsyncDataLoader, FlatpakUpdateLoader
|
||||||
|
|
||||||
DATE_FORMAT = '%Y-%m-%dT%H:%M:%S.000Z'
|
DATE_FORMAT = '%Y-%m-%dT%H:%M:%S.000Z'
|
||||||
|
RE_INSTALL_REFS = re.compile(r'\d+\)\s+(.+)')
|
||||||
|
|
||||||
|
|
||||||
class FlatpakManager(SoftwareManager):
|
class FlatpakManager(SoftwareManager):
|
||||||
@@ -387,9 +389,30 @@ class FlatpakManager(SoftwareManager):
|
|||||||
if not self._make_exports_dir(handler.watcher):
|
if not self._make_exports_dir(handler.watcher):
|
||||||
return TransactionResult(success=False, installed=[], removed=[])
|
return TransactionResult(success=False, installed=[], removed=[])
|
||||||
|
|
||||||
res = handler.handle(SystemProcess(subproc=flatpak.install(str(pkg.id), pkg.origin, pkg.installation), wrong_error_phrase='Warning'))
|
installed, output = handler.handle_simple(flatpak.install(str(pkg.id), pkg.origin, pkg.installation))
|
||||||
|
|
||||||
if res:
|
if not installed and 'error: No ref chosen to resolve matches' in output:
|
||||||
|
ref_opts = RE_INSTALL_REFS.findall(output)
|
||||||
|
|
||||||
|
if ref_opts and len(ref_opts) > 1:
|
||||||
|
view_opts = [InputOption(label=o, value=o.strip()) for o in ref_opts if o]
|
||||||
|
ref_select = SingleSelectComponent(type_=SelectViewType.RADIO, options=view_opts, default_option=view_opts[0], label='')
|
||||||
|
if watcher.request_confirmation(title=self.i18n['flatpak.install.ref_choose.title'],
|
||||||
|
body=self.i18n['flatpak.install.ref_choose.body'].format(bold(pkg.name)),
|
||||||
|
components=[ref_select],
|
||||||
|
confirmation_label=self.i18n['proceed'].capitalize(),
|
||||||
|
deny_label=self.i18n['cancel'].capitalize()):
|
||||||
|
ref = ref_select.get_selected()
|
||||||
|
installed, output = handler.handle_simple(flatpak.install(ref, pkg.origin, pkg.installation))
|
||||||
|
pkg.ref = ref
|
||||||
|
pkg.runtime = 'runtime' in ref
|
||||||
|
else:
|
||||||
|
watcher.print('Aborted by the user')
|
||||||
|
return TransactionResult.fail()
|
||||||
|
else:
|
||||||
|
return TransactionResult.fail()
|
||||||
|
|
||||||
|
if installed:
|
||||||
try:
|
try:
|
||||||
fields = flatpak.get_fields(str(pkg.id), pkg.branch, ['Ref', 'Branch'])
|
fields = flatpak.get_fields(str(pkg.id), pkg.branch, ['Ref', 'Branch'])
|
||||||
|
|
||||||
@@ -399,7 +422,7 @@ class FlatpakManager(SoftwareManager):
|
|||||||
except:
|
except:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
|
||||||
if res:
|
if installed:
|
||||||
new_installed = [pkg]
|
new_installed = [pkg]
|
||||||
current_installed = flatpak.list_installed(flatpak_version)
|
current_installed = flatpak.list_installed(flatpak_version)
|
||||||
current_installed_by_level = [p for p in current_installed if p['installation'] == pkg.installation] if current_installed else None
|
current_installed_by_level = [p for p in current_installed if p['installation'] == pkg.installation] if current_installed else None
|
||||||
@@ -413,7 +436,7 @@ class FlatpakManager(SoftwareManager):
|
|||||||
new_installed.append(self._map_to_model(app_json=p, installed=True,
|
new_installed.append(self._map_to_model(app_json=p, installed=True,
|
||||||
disk_loader=disk_loader, internet=net_available))
|
disk_loader=disk_loader, internet=net_available))
|
||||||
|
|
||||||
return TransactionResult(success=res, installed=new_installed, removed=[])
|
return TransactionResult(success=installed, installed=new_installed, removed=[])
|
||||||
else:
|
else:
|
||||||
return TransactionResult.fail()
|
return TransactionResult.fail()
|
||||||
|
|
||||||
|
|||||||
@@ -355,9 +355,10 @@ def search(version: str, word: str, installation: str, app_id: bool = False) ->
|
|||||||
return found
|
return found
|
||||||
|
|
||||||
|
|
||||||
def install(app_id: str, origin: str, installation: str):
|
def install(app_id: str, origin: str, installation: str) -> SimpleProcess:
|
||||||
return new_subprocess(cmd=['flatpak', 'install', origin, app_id, '-y', '--{}'.format(installation)],
|
return SimpleProcess(cmd=['flatpak', 'install', origin, app_id, '-y', '--{}'.format(installation)],
|
||||||
extra_paths={EXPORTS_PATH})
|
extra_paths={EXPORTS_PATH},
|
||||||
|
wrong_error_phrases={'Warning'})
|
||||||
|
|
||||||
|
|
||||||
def set_default_remotes(installation: str, root_password: str = None) -> SimpleProcess:
|
def set_default_remotes(installation: str, root_password: str = None) -> SimpleProcess:
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ flatpak.info.version=versió
|
|||||||
flatpak.install.bad_install_level.body=Valor invàlid per a {field} al fitxer de configuració {file}
|
flatpak.install.bad_install_level.body=Valor invàlid per a {field} al fitxer de configuració {file}
|
||||||
flatpak.install.install_level.body=S'ha d'instal·lar {} per a tots els usuaris del dispositiu ( sistema ) ?
|
flatpak.install.install_level.body=S'ha d'instal·lar {} per a tots els usuaris del dispositiu ( sistema ) ?
|
||||||
flatpak.install.install_level.title=Tipus d'instal·lació
|
flatpak.install.install_level.title=Tipus d'instal·lació
|
||||||
|
flatpak.install.ref_choose.title=Multiple references
|
||||||
|
flatpak.install.ref_choose.body=There are multiple references for {}. Select one to proceed:
|
||||||
flatpak.notification.disable=Si no voleu utilitzar aplicacions Flatpak, desmarqueu {} a {}
|
flatpak.notification.disable=Si no voleu utilitzar aplicacions Flatpak, desmarqueu {} a {}
|
||||||
flatpak.notification.no_remotes=No hi ha dipòsits («remotes») del Flatpak configurats. No podreu cercar aplicacions Flatpak.
|
flatpak.notification.no_remotes=No hi ha dipòsits («remotes») del Flatpak configurats. No podreu cercar aplicacions Flatpak.
|
||||||
flatpak.remotes.system_flathub.error=No s'ha pogut afegir Flathub com a dipòsit del sistema ( remote )
|
flatpak.remotes.system_flathub.error=No s'ha pogut afegir Flathub com a dipòsit del sistema ( remote )
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ flatpak.info.version=Version
|
|||||||
flatpak.install.bad_install_level.body=Ungültiger Wert für {field} in der Konfigurationsdatei {file}
|
flatpak.install.bad_install_level.body=Ungültiger Wert für {field} in der Konfigurationsdatei {file}
|
||||||
flatpak.install.install_level.body=Sollte {} für alle Gerätebenutzer installiert werden ( system ) ?
|
flatpak.install.install_level.body=Sollte {} für alle Gerätebenutzer installiert werden ( system ) ?
|
||||||
flatpak.install.install_level.title=Installationstyp
|
flatpak.install.install_level.title=Installationstyp
|
||||||
|
flatpak.install.ref_choose.title=Multiple references
|
||||||
|
flatpak.install.ref_choose.body=There are multiple references for {}. Select one to proceed:
|
||||||
flatpak.notification.disable=Um keine Flatpak Anwendungen zu verwenden deaktiviere {} unter {}
|
flatpak.notification.disable=Um keine Flatpak Anwendungen zu verwenden deaktiviere {} unter {}
|
||||||
flatpak.notification.no_remotes=Keine Flatpak Remotes sind konfiguriert. Die Suche nach Flatpak Apps ist nicht möglich.
|
flatpak.notification.no_remotes=Keine Flatpak Remotes sind konfiguriert. Die Suche nach Flatpak Apps ist nicht möglich.
|
||||||
flatpak.remotes.system_flathub.error=Flathub konnte nicht als System-Repository ( remote ) hinzugefügt werden
|
flatpak.remotes.system_flathub.error=Flathub konnte nicht als System-Repository ( remote ) hinzugefügt werden
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ flatpak.info.version=version
|
|||||||
flatpak.install.bad_install_level.body=Invalid value for {field} in the configuration file {file}
|
flatpak.install.bad_install_level.body=Invalid value for {field} in the configuration file {file}
|
||||||
flatpak.install.install_level.body=Should {} be installed for all the device users ( system ) ?
|
flatpak.install.install_level.body=Should {} be installed for all the device users ( system ) ?
|
||||||
flatpak.install.install_level.title=Installation type
|
flatpak.install.install_level.title=Installation type
|
||||||
|
flatpak.install.ref_choose.title=Multiple references
|
||||||
|
flatpak.install.ref_choose.body=There are multiple references for {}. Select one to proceed:
|
||||||
flatpak.notification.disable=If you do not want to use Flatpak applications, uncheck {} in {}
|
flatpak.notification.disable=If you do not want to use Flatpak applications, uncheck {} in {}
|
||||||
flatpak.notification.no_remotes=No Flatpak remotes set. It will not be possible to search for Flatpak apps.
|
flatpak.notification.no_remotes=No Flatpak remotes set. It will not be possible to search for Flatpak apps.
|
||||||
flatpak.remotes.system_flathub.error=It was not possible to add Flathub as a system repository ( remote )
|
flatpak.remotes.system_flathub.error=It was not possible to add Flathub as a system repository ( remote )
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ flatpak.info.version=versión
|
|||||||
flatpak.install.bad_install_level.body=Valor inválido para {field} en el archivo de configuración {file}
|
flatpak.install.bad_install_level.body=Valor inválido para {field} en el archivo de configuración {file}
|
||||||
flatpak.install.install_level.body=¿Debería {} estar instalado para todos los usuarios del dispositivo ( sistema )?
|
flatpak.install.install_level.body=¿Debería {} estar instalado para todos los usuarios del dispositivo ( sistema )?
|
||||||
flatpak.install.install_level.title=Tipo de instalación
|
flatpak.install.install_level.title=Tipo de instalación
|
||||||
|
flatpak.install.ref_choose.title=Varias referencias
|
||||||
|
flatpak.install.ref_choose.body=Hay varias referencias para {}. Seleccione una para proceder:
|
||||||
flatpak.notification.disable=Si no desea usar aplicativos Flatpak, desmarque {} en {}
|
flatpak.notification.disable=Si no desea usar aplicativos Flatpak, desmarque {} en {}
|
||||||
flatpak.notification.no_remotes=No hay repositorios (remotes) Flatpak configurados. No será posible buscar aplicativos Flatpak.
|
flatpak.notification.no_remotes=No hay repositorios (remotes) Flatpak configurados. No será posible buscar aplicativos Flatpak.
|
||||||
flatpak.remotes.system_flathub.error=No fue posible agregar Flathub como repositorio del sistema ( remote )
|
flatpak.remotes.system_flathub.error=No fue posible agregar Flathub como repositorio del sistema ( remote )
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ flatpak.info.version=version
|
|||||||
flatpak.install.bad_install_level.body=Valore non valido per {field} nel file di configurazione {file}
|
flatpak.install.bad_install_level.body=Valore non valido per {field} nel file di configurazione {file}
|
||||||
flatpak.install.install_level.body={} deve essere installato per tutti gli utenti del dispositivo ( sistema ) ?
|
flatpak.install.install_level.body={} deve essere installato per tutti gli utenti del dispositivo ( sistema ) ?
|
||||||
flatpak.install.install_level.title=Tipo di installazione
|
flatpak.install.install_level.title=Tipo di installazione
|
||||||
|
flatpak.install.ref_choose.title=Multiple references
|
||||||
|
flatpak.install.ref_choose.body=There are multiple references for {}. Select one to proceed:
|
||||||
flatpak.notification.disable=Ise non si desidera utilizzare le applicazioni Flatpak, deselezionare {} in {}
|
flatpak.notification.disable=Ise non si desidera utilizzare le applicazioni Flatpak, deselezionare {} in {}
|
||||||
flatpak.notification.no_remotes=Nessun set remoti Flatpak. Non sarà possibile cercare app Flatpak.
|
flatpak.notification.no_remotes=Nessun set remoti Flatpak. Non sarà possibile cercare app Flatpak.
|
||||||
flatpak.remotes.system_flathub.error=Non è stato possibile aggiungere Flathub come repository di sistema ( remote )
|
flatpak.remotes.system_flathub.error=Non è stato possibile aggiungere Flathub come repository di sistema ( remote )
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ flatpak.info.version=versão
|
|||||||
flatpak.install.bad_install_level.body=Valor inválido para {field} no arquivo de configuração {file}
|
flatpak.install.bad_install_level.body=Valor inválido para {field} no arquivo de configuração {file}
|
||||||
flatpak.install.install_level.body={} deve ser instalado para todos os usuários desse dispositivo ( sistema ) ?
|
flatpak.install.install_level.body={} deve ser instalado para todos os usuários desse dispositivo ( sistema ) ?
|
||||||
flatpak.install.install_level.title=Tipo de instalação
|
flatpak.install.install_level.title=Tipo de instalação
|
||||||
|
flatpak.install.ref_choose.title=Múltiplas referências
|
||||||
|
flatpak.install.ref_choose.body=Existem múltiplas referências para {}. Selecione uma para continuar:
|
||||||
flatpak.notification.disable=Se não deseja usar aplicativos Flatpak, desmarque {} em {}
|
flatpak.notification.disable=Se não deseja usar aplicativos Flatpak, desmarque {} em {}
|
||||||
flatpak.notification.no_remotes=Não há repositórios (remotes) Flatpak configurados. Não será possível buscar aplicativos Flatpak.
|
flatpak.notification.no_remotes=Não há repositórios (remotes) Flatpak configurados. Não será possível buscar aplicativos Flatpak.
|
||||||
flatpak.remotes.system_flathub.error=Não foi possível adicionar o Flathub como um repositório do sistema ( remote )
|
flatpak.remotes.system_flathub.error=Não foi possível adicionar o Flathub como um repositório do sistema ( remote )
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ flatpak.info.version=Версия
|
|||||||
flatpak.install.bad_install_level.body=Недопустимое значение для {field} в файле конфигурации {file}
|
flatpak.install.bad_install_level.body=Недопустимое значение для {field} в файле конфигурации {file}
|
||||||
flatpak.install.install_level.body=Должен ли {} быть установлен для всех пользователей устройства (системы)?
|
flatpak.install.install_level.body=Должен ли {} быть установлен для всех пользователей устройства (системы)?
|
||||||
flatpak.install.install_level.title=Тип установки
|
flatpak.install.install_level.title=Тип установки
|
||||||
|
flatpak.install.ref_choose.title=Multiple references
|
||||||
|
flatpak.install.ref_choose.body=There are multiple references for {}. Select one to proceed:
|
||||||
flatpak.notification.disable=Если вы не хотите использовать приложения Flatpak, снимите флажок {} в {}
|
flatpak.notification.disable=Если вы не хотите использовать приложения Flatpak, снимите флажок {} в {}
|
||||||
flatpak.notification.no_remotes=Поддержка Flatpak не установлена. Поиск приложений Flatpak будет невозможен.
|
flatpak.notification.no_remotes=Поддержка Flatpak не установлена. Поиск приложений Flatpak будет невозможен.
|
||||||
flatpak.remotes.system_flathub.error=Не удалось добавить Flathub в качестве системного репозитория (удаленного)
|
flatpak.remotes.system_flathub.error=Не удалось добавить Flathub в качестве системного репозитория (удаленного)
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ flatpak.info.version=sürüm
|
|||||||
flatpak.install.bad_install_level.body={file} yapılandırma dosyasında {field} için geçersiz değer
|
flatpak.install.bad_install_level.body={file} yapılandırma dosyasında {field} için geçersiz değer
|
||||||
flatpak.install.install_level.body=Tüm cihaz kullanıcıları (sistem) için {} kurulmalı mı ?
|
flatpak.install.install_level.body=Tüm cihaz kullanıcıları (sistem) için {} kurulmalı mı ?
|
||||||
flatpak.install.install_level.title=Kurulum türü
|
flatpak.install.install_level.title=Kurulum türü
|
||||||
|
flatpak.install.ref_choose.title=Multiple references
|
||||||
|
flatpak.install.ref_choose.body=There are multiple references for {}. Select one to proceed:
|
||||||
flatpak.notification.disable=If you do not want to use Flatpak applications, uncheck {} in {}
|
flatpak.notification.disable=If you do not want to use Flatpak applications, uncheck {} in {}
|
||||||
flatpak.notification.no_remotes=Flatpak uygulamalarını kullanmak istemiyorsanız, {} içindeki {} işaretini kaldırın
|
flatpak.notification.no_remotes=Flatpak uygulamalarını kullanmak istemiyorsanız, {} içindeki {} işaretini kaldırın
|
||||||
flatpak.remotes.system_flathub.error=Flathub sistem havuzu (uzak) olarak eklenemedi
|
flatpak.remotes.system_flathub.error=Flathub sistem havuzu (uzak) olarak eklenemedi
|
||||||
|
|||||||
BIN
pictures/releases/0.9.7/flatpak_refs.png
Normal file
BIN
pictures/releases/0.9.7/flatpak_refs.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
Reference in New Issue
Block a user