mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Merge pull request #1762 from Salamandar/remove_upgrade_full
app.py, helpers: Reword YNH_APP_UPGRADE_TYPE
This commit is contained in:
commit
f53d09c3a2
2 changed files with 9 additions and 18 deletions
|
@ -248,7 +248,7 @@ ynh_setup_source() {
|
||||||
if test -e "$local_src"; then
|
if test -e "$local_src"; then
|
||||||
cp $local_src $src_filename
|
cp $local_src $src_filename
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -n "$src_url" ] || ynh_die "Couldn't parse SOURCE_URL from $src_file_path ?"
|
[ -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
|
# 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
|
# This helper should be used to avoid an upgrade of an app, or the upstream part
|
||||||
# of it, when it's not needed
|
# 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 <appname> --force
|
|
||||||
# ```
|
|
||||||
# Requires YunoHost version 3.5.0 or higher.
|
# Requires YunoHost version 3.5.0 or higher.
|
||||||
ynh_check_app_version_changed() {
|
ynh_check_app_version_changed() {
|
||||||
local return_value=${YNH_APP_UPGRADE_TYPE}
|
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"
|
return_value="UPGRADE_APP"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
19
src/app.py
19
src/app.py
|
@ -653,23 +653,18 @@ def app_upgrade(
|
||||||
manifest.get("remote", {}).get("revision", "?"),
|
manifest.get("remote", {}).get("revision", "?"),
|
||||||
)
|
)
|
||||||
continue
|
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:
|
elif app_current_version == app_new_version:
|
||||||
upgrade_type = "UPGRADE_FORCED"
|
upgrade_type = "UPGRADE_SAME"
|
||||||
else:
|
else:
|
||||||
app_current_version_upstream, app_current_version_pkg = str(
|
app_current_version_upstream, _ = str(app_current_version).split("~ynh")
|
||||||
app_current_version
|
app_new_version_upstream, _ = str(app_new_version).split("~ynh")
|
||||||
).split("~ynh")
|
|
||||||
app_new_version_upstream, app_new_version_pkg = str(
|
|
||||||
app_new_version
|
|
||||||
).split("~ynh")
|
|
||||||
if app_current_version_upstream == app_new_version_upstream:
|
if app_current_version_upstream == app_new_version_upstream:
|
||||||
upgrade_type = "UPGRADE_PACKAGE"
|
upgrade_type = "UPGRADE_PACKAGE"
|
||||||
elif app_current_version_pkg == app_new_version_pkg:
|
|
||||||
upgrade_type = "UPGRADE_APP"
|
|
||||||
else:
|
else:
|
||||||
upgrade_type = "UPGRADE_FULL"
|
upgrade_type = "UPGRADE_APP"
|
||||||
|
|
||||||
# Check requirements
|
# Check requirements
|
||||||
for name, passed, values, err in _check_manifest_requirements(
|
for name, passed, values, err in _check_manifest_requirements(
|
||||||
|
|
Loading…
Add table
Reference in a new issue