mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Make more robust version management in upgrade
This commit is contained in:
parent
e7970d8571
commit
1826e3c5b6
1 changed files with 23 additions and 21 deletions
|
@ -483,9 +483,9 @@ def app_upgrade(app=[], url=None, file=None, force=False):
|
||||||
app_current_version = app_dict.get("version", "?")
|
app_current_version = app_dict.get("version", "?")
|
||||||
|
|
||||||
if manifest.get('integration', {}).get("upgrade_only_if_version_changes", None) is True:
|
if manifest.get('integration', {}).get("upgrade_only_if_version_changes", None) is True:
|
||||||
|
if "~ynh" in app_current_version and "~ynh" in app_new_version:
|
||||||
# do only the upgrade if there are a change
|
|
||||||
if version.parse(app_current_version) >= version.parse(app_new_version) and not force:
|
if version.parse(app_current_version) >= version.parse(app_new_version) and not force:
|
||||||
|
# No new version available
|
||||||
logger.success(m18n.n('app_already_up_to_date', app=app_instance_name))
|
logger.success(m18n.n('app_already_up_to_date', app=app_instance_name))
|
||||||
# Save update time
|
# Save update time
|
||||||
now = int(time.time())
|
now = int(time.time())
|
||||||
|
@ -496,7 +496,7 @@ def app_upgrade(app=[], url=None, file=None, force=False):
|
||||||
upgrade_type = "DOWNGRADE_FORCED"
|
upgrade_type = "DOWNGRADE_FORCED"
|
||||||
elif app_current_version == app_new_version:
|
elif app_current_version == app_new_version:
|
||||||
upgrade_type = "UPGRADE_FORCED"
|
upgrade_type = "UPGRADE_FORCED"
|
||||||
elif "~ynh" in app_current_version and "~ynh" in app_new_version:
|
else:
|
||||||
app_current_version_upstream, app_current_version_pkg = app_current_version.split("~ynh")
|
app_current_version_upstream, app_current_version_pkg = app_current_version.split("~ynh")
|
||||||
app_new_version_upstream, app_new_version_pkg = app_new_version.split("~ynh")
|
app_new_version_upstream, app_new_version_pkg = app_new_version.split("~ynh")
|
||||||
if app_current_version_upstream == app_new_version_upstream:
|
if app_current_version_upstream == app_new_version_upstream:
|
||||||
|
@ -505,6 +505,8 @@ def app_upgrade(app=[], url=None, file=None, force=False):
|
||||||
upgrade_type = "UPGRADE_APP"
|
upgrade_type = "UPGRADE_APP"
|
||||||
else:
|
else:
|
||||||
upgrade_type = "UPGRADE_FULL"
|
upgrade_type = "UPGRADE_FULL"
|
||||||
|
else:
|
||||||
|
logger.warning("/!\\ Packagers ! You have enabled the setting 'upgrade_only_if_version_changes' but you haven't used the official way to define the package version")
|
||||||
|
|
||||||
# Check requirements
|
# Check requirements
|
||||||
_check_manifest_requirements(manifest, app_instance_name=app_instance_name)
|
_check_manifest_requirements(manifest, app_instance_name=app_instance_name)
|
||||||
|
|
Loading…
Add table
Reference in a new issue