diff --git a/helpers/utils b/helpers/utils index b73e5ad466..13874eea3d 100644 --- a/helpers/utils +++ b/helpers/utils @@ -248,7 +248,7 @@ ynh_setup_source() { if test -e "$local_src"; then cp $local_src $src_filename fi - + [ -n "$src_url" ] || ynh_die "Couldn't parse SOURCE_URL from $src_file_path ?" # If the file was prefetched but somehow doesn't match the sum, rm and redownload it @@ -990,15 +990,11 @@ ynh_app_package_version() { # This helper should be used to avoid an upgrade of an app, or the upstream part # of it, when it's not needed # -# You can force an upgrade, even if the package is up to date, with the `--force` (or `-F`) argument : -# ``` -# sudo yunohost app upgrade --force -# ``` # Requires YunoHost version 3.5.0 or higher. ynh_check_app_version_changed() { local return_value=${YNH_APP_UPGRADE_TYPE} - if [ "$return_value" == "UPGRADE_FULL" ] || [ "$return_value" == "UPGRADE_FORCED" ] || [ "$return_value" == "DOWNGRADE_FORCED" ]; then + if [ "$return_value" == "UPGRADE_SAME" ] || [ "$return_value" == "DOWNGRADE" ]; then return_value="UPGRADE_APP" fi diff --git a/src/app.py b/src/app.py index 15e266a6d2..ae550ab316 100644 --- a/src/app.py +++ b/src/app.py @@ -653,23 +653,18 @@ def app_upgrade( manifest.get("remote", {}).get("revision", "?"), ) continue - elif app_current_version > app_new_version: - upgrade_type = "DOWNGRADE_FORCED" + + if app_current_version > app_new_version: + upgrade_type = "DOWNGRADE" elif app_current_version == app_new_version: - upgrade_type = "UPGRADE_FORCED" + upgrade_type = "UPGRADE_SAME" else: - app_current_version_upstream, app_current_version_pkg = str( - app_current_version - ).split("~ynh") - app_new_version_upstream, app_new_version_pkg = str( - app_new_version - ).split("~ynh") + app_current_version_upstream, _ = str(app_current_version).split("~ynh") + app_new_version_upstream, _ = str(app_new_version).split("~ynh") if app_current_version_upstream == app_new_version_upstream: upgrade_type = "UPGRADE_PACKAGE" - elif app_current_version_pkg == app_new_version_pkg: - upgrade_type = "UPGRADE_APP" else: - upgrade_type = "UPGRADE_FULL" + upgrade_type = "UPGRADE_APP" # Check requirements for name, passed, values, err in _check_manifest_requirements(