mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-06 21:44:16 +02:00
[gems.appimage] refactoring: using the 'repository' field on queries instead of the deprecated 'github'
This commit is contained in:
@@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
### Improvements
|
||||
- AppImage
|
||||
- info window: displaying "unknown" when there is no mapped license
|
||||
- supporting AppImages from GitLab repositories
|
||||
- Arch
|
||||
- adding the AUR's URL on the package information dialog [#339](https://github.com/vinifmor/bauh/issues/339)
|
||||
- General
|
||||
|
||||
@@ -184,7 +184,7 @@ class AppImageManager(SoftwareManager, SettingsController):
|
||||
self.logger.warning(f"Could not get a connection for database '{db_path}'")
|
||||
|
||||
def _gen_app_key(self, app: AppImage):
|
||||
return f"{app.name.lower()}{app.github.lower() if app.github else ''}"
|
||||
return f"{app.name.lower()}{app.repository.lower() if app.repository else ''}"
|
||||
|
||||
def search(self, words: str, disk_loader: DiskCacheLoader, limit: int = -1, is_url: bool = False) -> SearchResult:
|
||||
if is_url:
|
||||
@@ -276,7 +276,7 @@ class AppImageManager(SoftwareManager, SettingsController):
|
||||
|
||||
for tup in cursor.fetchall():
|
||||
for app in installed_apps:
|
||||
if app.name.lower() == tup[0].lower() and (not app.github or app.github.lower() == tup[1].lower()):
|
||||
if app.name.lower() == tup[0].lower() and (not app.repository or app.repository.lower() == tup[1].lower()):
|
||||
continuous_version = app.version == 'continuous'
|
||||
continuous_update = tup[2] == 'continuous'
|
||||
|
||||
@@ -441,7 +441,7 @@ class AppImageManager(SoftwareManager, SettingsController):
|
||||
return TransactionResult(success=True, installed=None, removed=[pkg])
|
||||
|
||||
def _add_self_latest_version(self, app: AppImage):
|
||||
if app.name == self.context.app_name and app.github == self.app_github and not app.url_download_latest_version:
|
||||
if app.name == self.context.app_name and app.repository == self.app_github and not app.url_download_latest_version:
|
||||
history = self.get_history(app)
|
||||
|
||||
if not history or not history.history:
|
||||
@@ -500,7 +500,7 @@ class AppImageManager(SoftwareManager, SettingsController):
|
||||
try:
|
||||
cursor = app_con.cursor()
|
||||
|
||||
cursor.execute(query.FIND_APP_ID_BY_NAME_AND_GITHUB.format(pkg.name.lower(), pkg.github.lower() if pkg.github else ''))
|
||||
cursor.execute(query.FIND_APP_ID_BY_REPO_AND_NAME.format(pkg.repository.lower() if pkg.repository else '', pkg.name.lower()))
|
||||
app_tuple = cursor.fetchone()
|
||||
|
||||
if not app_tuple:
|
||||
|
||||
@@ -32,7 +32,8 @@ class AppImage(SoftwarePackage):
|
||||
def cached_attrs(cls) -> Tuple[str, ...]:
|
||||
if cls.__cached_attrs is None:
|
||||
cls.__cached_attrs = ('name', 'description', 'version', 'url_download', 'author', 'license', 'source',
|
||||
'icon_path', 'github', 'categories', 'imported', 'install_dir', 'symlink')
|
||||
'icon_path', 'repository', 'categories', 'imported', 'install_dir',
|
||||
'symlink')
|
||||
|
||||
return cls.__cached_attrs
|
||||
|
||||
@@ -43,17 +44,17 @@ class AppImage(SoftwarePackage):
|
||||
|
||||
return cls.__re_many_spaces
|
||||
|
||||
def __init__(self, name: str = None, description: str = None, github: str = None, source: str = None, version: str = None,
|
||||
def __init__(self, name: str = None, description: str = None, repository: str = None, source: str = None, version: str = None,
|
||||
url_download: str = None, url_icon: str = None, url_screenshot: str = None, license: str = None, author: str = None,
|
||||
categories=None, icon_path: str = None, installed: bool = False,
|
||||
url_download_latest_version: str = None, local_file_path: str = None, imported: bool = False,
|
||||
i18n: I18n = None, install_dir: str = None, updates_ignored: bool = False,
|
||||
symlink: str = None, manual_update: bool = False, **kwargs):
|
||||
symlink: str = None, manual_update: bool = False, github: str = None, **kwargs):
|
||||
super(AppImage, self).__init__(id=name, name=name, version=version, latest_version=version,
|
||||
icon_url=url_icon, license=license, description=description,
|
||||
installed=installed)
|
||||
self.source = source
|
||||
self.github = github
|
||||
self.repository = repository if repository else (github if github else repository)
|
||||
self.categories = (categories.split(',') if isinstance(categories, str) else categories) if categories else None
|
||||
self.url_download = url_download
|
||||
self.icon_path = icon_path
|
||||
@@ -69,7 +70,7 @@ class AppImage(SoftwarePackage):
|
||||
self.manual_update = manual_update # True when the user is manually installing/upgrading an AppImage file
|
||||
|
||||
def __repr__(self):
|
||||
return "{} (name={}, github={})".format(self.__class__.__name__, self.name, self.github)
|
||||
return f"{self.__class__.__name__} (name={self.name}, repository={self.repository})"
|
||||
|
||||
def can_be_installed(self):
|
||||
return not self.installed and self.url_download
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
APP_ATTRS = ('name', 'description', 'github', 'source', 'version', 'url_download', 'url_icon', 'url_screenshot', 'license', 'author', 'categories')
|
||||
APP_ATTRS = ('name', 'description', 'repository', 'source', 'version', 'url_download', 'url_icon',
|
||||
'url_screenshot', 'license', 'author', 'categories')
|
||||
RELEASE_ATTRS = ('version', 'url_download', 'published_at')
|
||||
|
||||
|
||||
SEARCH_APPS_BY_NAME_OR_DESCRIPTION = "SELECT {} FROM apps".format(','.join(APP_ATTRS)) + " WHERE lower(name) LIKE '%{}%' or lower(description) LIKE '%{}%'"
|
||||
FIND_APP_ID_BY_NAME_AND_GITHUB = "SELECT id FROM apps WHERE lower(name) = '{}' and lower(github) = '{}'"
|
||||
FIND_APPS_BY_NAME = "SELECT name, github, version, url_download FROM apps WHERE lower(name) IN ({})"
|
||||
SEARCH_APPS_BY_NAME_OR_DESCRIPTION = f"SELECT {','.join(APP_ATTRS)} FROM apps" + \
|
||||
" WHERE lower(name) LIKE '%{}%' or lower(description) LIKE '%{}%'"
|
||||
FIND_APP_ID_BY_REPO_AND_NAME = "SELECT id FROM apps WHERE lower(repository) = '{}' and lower(name) = '{}'"
|
||||
FIND_APPS_BY_NAME = "SELECT name, repository, version, url_download FROM apps WHERE lower(name) IN ({})"
|
||||
FIND_APPS_BY_NAME_ONLY_NAME = "SELECT name FROM apps WHERE lower(name) IN ({})"
|
||||
FIND_APPS_BY_NAME_FULL = "SELECT {} FROM apps".format(','.join(APP_ATTRS)) + " WHERE lower(name) IN ({})"
|
||||
FIND_RELEASES_BY_APP_ID = "SELECT {} FROM releases".format(','.join(RELEASE_ATTRS)) + " WHERE app_id = {}"
|
||||
|
||||
@@ -33,6 +33,7 @@ appimage.info.icon_path=icona
|
||||
appimage.info.imported.false=No
|
||||
appimage.info.imported.true=Yes
|
||||
appimage.info.install_dir=Installation directory
|
||||
appimage.info.repository=Repositori
|
||||
appimage.info.symlink=Symlink
|
||||
appimage.info.url_download=URL del fitxer
|
||||
appimage.install.appimagelauncher.error={appimgl} no permet la instal·lació de {app}. Desinstal·leu {appimgl}, reinicieu el sistema i torneu a provar d’instal·lar {app}.
|
||||
|
||||
@@ -33,6 +33,7 @@ appimage.info.icon_path=Symbol
|
||||
appimage.info.imported.false=Nein
|
||||
appimage.info.imported.true=Ja
|
||||
appimage.info.install_dir=Installationsverzeichnis
|
||||
appimage.info.repository=Repository
|
||||
appimage.info.symlink=Symlink
|
||||
appimage.info.url_download=Datei-URL
|
||||
appimage.install.appimagelauncher.error={appimgl} lässt nicht zu, dass {app} installiert wird. Deinstallieren Sie {appimgl}, starten Sie Ihr System neu und versuchen Sie erneut, {app} zu installieren.
|
||||
|
||||
@@ -33,6 +33,7 @@ appimage.info.icon_path=icon
|
||||
appimage.info.imported.false=No
|
||||
appimage.info.imported.true=Yes
|
||||
appimage.info.install_dir=Installation directory
|
||||
appimage.info.repository=Repository
|
||||
appimage.info.symlink=Symlink
|
||||
appimage.info.url_download=File URL
|
||||
appimage.install.appimagelauncher.error={appimgl} is not allowing {app} to be installed. Uninstall {appimgl}, reboot your system and try to install {app} again.
|
||||
|
||||
@@ -33,6 +33,7 @@ appimage.info.icon_path=icono
|
||||
appimage.info.imported.false=No
|
||||
appimage.info.imported.true=Sí
|
||||
appimage.info.install_dir=Directorio de instalación
|
||||
appimage.info.repository=Repositorio
|
||||
appimage.info.symlink=Link simbólico
|
||||
appimage.info.url_download=URL del archivo
|
||||
appimage.install.appimagelauncher.error={appimgl} no permite la instalación de {app}. Desinstale {appimgl}, reinicie su sistema e intente instalar {app} nuevamente.
|
||||
|
||||
@@ -33,6 +33,7 @@ appimage.info.icon_path=icône
|
||||
appimage.info.imported.false=Non
|
||||
appimage.info.imported.true=Oui
|
||||
appimage.info.install_dir=Répertoire d'installation
|
||||
appimage.info.repository=Dépôt
|
||||
appimage.info.symlink=Symlink
|
||||
appimage.info.url_download=URL du fichier
|
||||
appimage.install.appimagelauncher.error={appimgl} n'autorise pas {app} à être installé. Désinstallez {appimgl}, redemarrez, puis essayez d'installer {app} de nouveau.
|
||||
|
||||
@@ -33,6 +33,7 @@ appimage.info.icon_path=icona
|
||||
appimage.info.imported.false=No
|
||||
appimage.info.imported.true=Yes
|
||||
appimage.info.install_dir=Installation directory
|
||||
appimage.info.repository=Deposito
|
||||
appimage.info.symlink=Symlink
|
||||
appimage.info.url_download=File URL
|
||||
appimage.install.appimagelauncher.error={appimgl} non consente l'installazione di {app}. Disinstallare {appimgl}, riavviare il sistema e provare a installare nuovamente {app}.
|
||||
|
||||
@@ -33,6 +33,7 @@ appimage.info.icon_path=ícone
|
||||
appimage.info.imported.false=Não
|
||||
appimage.info.imported.true=Sim
|
||||
appimage.info.install_dir=Diretório de instalação
|
||||
appimage.info.repository=Repositório
|
||||
appimage.info.symlink=Link simbólico
|
||||
appimage.info.url_download=URL do arquivo
|
||||
appimage.install.appimagelauncher.error={appimgl} não está permitindo que o {app} seja instalado. Desinstale o {appimgl}, reinicie o sistema e tente instalar o {app} novamente.
|
||||
|
||||
@@ -33,6 +33,7 @@ appimage.info.icon_path=Значок
|
||||
appimage.info.imported.false=Нет
|
||||
appimage.info.imported.true=Да
|
||||
appimage.info.install_dir=Директория установки
|
||||
appimage.info.repository=Pепозиторий
|
||||
appimage.info.symlink=Символическая ссылка
|
||||
appimage.info.url_download=URL Файла
|
||||
appimage.install.appimagelauncher.error={appimgl} не позволяет установить {app} . Удалите {appimgl}, перезагрузите ваш компьютер и попробуйте снова установить {app}.
|
||||
|
||||
@@ -33,6 +33,7 @@ appimage.info.icon_path=simge
|
||||
appimage.info.imported.false=Hayır
|
||||
appimage.info.imported.true=Evet
|
||||
appimage.info.install_dir=Kurulum dizini
|
||||
appimage.info.repository=Depo
|
||||
appimage.info.symlink=Symlink
|
||||
appimage.info.url_download=Dosya Bağlantısı
|
||||
appimage.install.appimagelauncher.error={appimgl}, {app} uygulamasının yüklenmesine izin vermiyor. {appimgl} yazılımını kaldırın, sisteminizi yeniden başlatın ve {app} yazılımını tekrar yüklemeyi deneyin.
|
||||
|
||||
Reference in New Issue
Block a user