mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-06 22:54:16 +02:00
[gems.appimage] fix: upgrade fails when the package was initially imported, but later added to remote database
This commit is contained in:
@@ -9,6 +9,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||||||
- UI
|
- UI
|
||||||
- the "Skip" button on the initialization panel is now enabled after 10 seconds [#310](https://github.com/vinifmor/bauh/issues/310)
|
- the "Skip" button on the initialization panel is now enabled after 10 seconds [#310](https://github.com/vinifmor/bauh/issues/310)
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
- AppImage
|
||||||
|
- upgrade fails when the package was initially imported, but later added to bauh's database [#321](https://github.com/vinifmor/bauh/issues/321)
|
||||||
|
|
||||||
### Contributions
|
### Contributions
|
||||||
- German translations by [Mape6](https://github.com/Mape6)
|
- German translations by [Mape6](https://github.com/Mape6)
|
||||||
|
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ class AppImageManager(SoftwareManager, SettingsController):
|
|||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
appim = AppImage(i18n=self.i18n, imported=True)
|
appim = AppImage(i18n=self.i18n, imported=True, manual_update=True)
|
||||||
appim.name = input_name.get_value().strip()
|
appim.name = input_name.get_value().strip()
|
||||||
appim.local_file_path = file_chooser.file_path
|
appim.local_file_path = file_chooser.file_path
|
||||||
appim.version = input_version.get_value()
|
appim.version = input_version.get_value()
|
||||||
@@ -168,6 +168,7 @@ class AppImageManager(SoftwareManager, SettingsController):
|
|||||||
|
|
||||||
pkg.local_file_path = file_chooser.file_path
|
pkg.local_file_path = file_chooser.file_path
|
||||||
pkg.version = input_version.get_value()
|
pkg.version = input_version.get_value()
|
||||||
|
pkg.manual_update = True
|
||||||
|
|
||||||
reqs = UpgradeRequirements(to_install=None, to_remove=None, to_upgrade=[UpgradeRequirement(pkg=pkg)], cannot_upgrade=None)
|
reqs = UpgradeRequirements(to_install=None, to_remove=None, to_upgrade=[UpgradeRequirement(pkg=pkg)], cannot_upgrade=None)
|
||||||
return self.upgrade(reqs, root_password=root_password, watcher=watcher)
|
return self.upgrade(reqs, root_password=root_password, watcher=watcher)
|
||||||
@@ -368,6 +369,16 @@ class AppImageManager(SoftwareManager, SettingsController):
|
|||||||
|
|
||||||
download_data = None
|
download_data = None
|
||||||
|
|
||||||
|
# always changing the 'imported' field based on the 'manual_update' flag that means
|
||||||
|
# "the user is manually installing/updating the AppImage"
|
||||||
|
if not req.pkg.manual_update:
|
||||||
|
req.pkg.imported = False
|
||||||
|
|
||||||
|
if req.pkg.categories and "Imported" in req.pkg.categories:
|
||||||
|
# removing the imported category in case the file is not considered imported anymore
|
||||||
|
req.pkg.categories.remove("Imported")
|
||||||
|
|
||||||
|
# manual file updates do not required download it
|
||||||
if not req.pkg.imported:
|
if not req.pkg.imported:
|
||||||
download_data = self._download(req.pkg, watcher)
|
download_data = self._download(req.pkg, watcher)
|
||||||
|
|
||||||
@@ -593,8 +604,8 @@ class AppImageManager(SoftwareManager, SettingsController):
|
|||||||
Path(out_dir).mkdir(parents=True, exist_ok=True)
|
Path(out_dir).mkdir(parents=True, exist_ok=True)
|
||||||
pkg.install_dir = out_dir
|
pkg.install_dir = out_dir
|
||||||
|
|
||||||
if pkg.imported:
|
# when the package is being imported/upgraded there is no need to download it
|
||||||
|
if pkg.manual_update:
|
||||||
downloaded, file_name = True, pkg.local_file_path.split('/')[-1]
|
downloaded, file_name = True, pkg.local_file_path.split('/')[-1]
|
||||||
|
|
||||||
install_file_path = out_dir + '/' + file_name
|
install_file_path = out_dir + '/' + file_name
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class AppImage(SoftwarePackage):
|
|||||||
categories=None, icon_path: str = None, installed: bool = False,
|
categories=None, icon_path: str = None, installed: bool = False,
|
||||||
url_download_latest_version: str = None, local_file_path: str = None, imported: 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,
|
i18n: I18n = None, install_dir: str = None, updates_ignored: bool = False,
|
||||||
symlink: str = None, **kwargs):
|
symlink: str = None, manual_update: bool = False, **kwargs):
|
||||||
super(AppImage, self).__init__(id=name, name=name, version=version, latest_version=version,
|
super(AppImage, self).__init__(id=name, name=name, version=version, latest_version=version,
|
||||||
icon_url=url_icon, license=license, description=description,
|
icon_url=url_icon, license=license, description=description,
|
||||||
installed=installed)
|
installed=installed)
|
||||||
@@ -66,6 +66,7 @@ class AppImage(SoftwarePackage):
|
|||||||
self.install_dir = install_dir
|
self.install_dir = install_dir
|
||||||
self.updates_ignored = updates_ignored
|
self.updates_ignored = updates_ignored
|
||||||
self.symlink = symlink
|
self.symlink = symlink
|
||||||
|
self.manual_update = manual_update # True when the user is manually installing/upgrading an AppImage file
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "{} (name={}, github={})".format(self.__class__.__name__, self.name, self.github)
|
return "{} (name={}, github={})".format(self.__class__.__name__, self.name, self.github)
|
||||||
|
|||||||
Reference in New Issue
Block a user