Skip to content

Commit f53d09c

Browse files
authored
Merge pull request #1762 from Salamandar/remove_upgrade_full
app.py, helpers: Reword YNH_APP_UPGRADE_TYPE
2 parents 6fdcf03 + c8f0f13 commit f53d09c

File tree

2 files changed

+9
-18
lines changed

2 files changed

+9
-18
lines changed

helpers/utils

+2-6
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ ynh_setup_source() {
248248
if test -e "$local_src"; then
249249
cp $local_src $src_filename
250250
fi
251-
251+
252252
[ -n "$src_url" ] || ynh_die "Couldn't parse SOURCE_URL from $src_file_path ?"
253253

254254
# If the file was prefetched but somehow doesn't match the sum, rm and redownload it
@@ -990,15 +990,11 @@ ynh_app_package_version() {
990990
# This helper should be used to avoid an upgrade of an app, or the upstream part
991991
# of it, when it's not needed
992992
#
993-
# You can force an upgrade, even if the package is up to date, with the `--force` (or `-F`) argument :
994-
# ```
995-
# sudo yunohost app upgrade <appname> --force
996-
# ```
997993
# Requires YunoHost version 3.5.0 or higher.
998994
ynh_check_app_version_changed() {
999995
local return_value=${YNH_APP_UPGRADE_TYPE}
1000996

1001-
if [ "$return_value" == "UPGRADE_FULL" ] || [ "$return_value" == "UPGRADE_FORCED" ] || [ "$return_value" == "DOWNGRADE_FORCED" ]; then
997+
if [ "$return_value" == "UPGRADE_SAME" ] || [ "$return_value" == "DOWNGRADE" ]; then
1002998
return_value="UPGRADE_APP"
1003999
fi
10041000

src/app.py

+7-12
Original file line numberDiff line numberDiff line change
@@ -653,23 +653,18 @@ def app_upgrade(
653653
manifest.get("remote", {}).get("revision", "?"),
654654
)
655655
continue
656-
elif app_current_version > app_new_version:
657-
upgrade_type = "DOWNGRADE_FORCED"
656+
657+
if app_current_version > app_new_version:
658+
upgrade_type = "DOWNGRADE"
658659
elif app_current_version == app_new_version:
659-
upgrade_type = "UPGRADE_FORCED"
660+
upgrade_type = "UPGRADE_SAME"
660661
else:
661-
app_current_version_upstream, app_current_version_pkg = str(
662-
app_current_version
663-
).split("~ynh")
664-
app_new_version_upstream, app_new_version_pkg = str(
665-
app_new_version
666-
).split("~ynh")
662+
app_current_version_upstream, _ = str(app_current_version).split("~ynh")
663+
app_new_version_upstream, _ = str(app_new_version).split("~ynh")
667664
if app_current_version_upstream == app_new_version_upstream:
668665
upgrade_type = "UPGRADE_PACKAGE"
669-
elif app_current_version_pkg == app_new_version_pkg:
670-
upgrade_type = "UPGRADE_APP"
671666
else:
672-
upgrade_type = "UPGRADE_FULL"
667+
upgrade_type = "UPGRADE_APP"
673668

674669
# Check requirements
675670
for name, passed, values, err in _check_manifest_requirements(

0 commit comments

Comments
 (0)