From ffcd0e33ac2323551fc587883be606ef6fce6a30 Mon Sep 17 00:00:00 2001 From: Augustin Trancart Date: Sat, 19 Sep 2020 15:29:38 +0200 Subject: [PATCH] Fix ynh_app_upstream_version : restore ability to read manifest The documentation was saying A, the code was doing B, and calling functions were expecting both A and B (see ynh_check_app_version_changed). So this commit aims at making everyone agree, by matching usage. --- data/helpers.d/utils | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/data/helpers.d/utils b/data/helpers.d/utils index 95f8ddc52..8f79472eb 100644 --- a/data/helpers.d/utils +++ b/data/helpers.d/utils @@ -417,7 +417,7 @@ ynh_read_manifest () { jq ".$manifest_key" "$manifest" --raw-output } -# Read the upstream version from the manifest +# Read the upstream version from the manifest, or from the env variable $YNH_APP_MANIFEST_VERSION if not given # # usage: ynh_app_upstream_version [--manifest="manifest.json"] # | arg: -m, --manifest= - Path of the manifest to read @@ -437,7 +437,13 @@ ynh_app_upstream_version () { # Manage arguments with getopts ynh_handle_getopts_args "$@" - version_key=$YNH_APP_MANIFEST_VERSION + if [[ "$manifest" != "" ]] && [[ -e "$manifest" ]]; + then + version_key=$(ynh_read_manifest --manifest="$manifest" --manifest_key="version") + else + version_key=$YNH_APP_MANIFEST_VERSION + fi + echo "${version_key/~ynh*/}" }