From cef5c96090dc04dbc5ef17f297060d43af653a38 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Thu, 22 Aug 2024 13:40:10 +0200 Subject: [PATCH] Revert part of the changes in previous commit because we still need to be able to test upgrades from packaging v1 --- lib/tests.sh | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/tests.sh b/lib/tests.sh index 54963f8..f8648fd 100644 --- a/lib/tests.sh +++ b/lib/tests.sh @@ -132,15 +132,26 @@ _INSTALL_APP () { # Note : we do this at this stage and not during the parsing of check_process # because this also applies to upgrades ... ie older version may have different args and default values - # Fetch and loop over all manifest arg - local manifest_args="$(grep -oE '^\s*\[install\.\w+]' $package_path/manifest.toml | tr -d '[]' | awk -F. '{print $2}')" + # Fetch and loop over all manifest arg ... NB : we need to keep this as long as there are "upgrade from packaging v1" tests + if [[ -e $package_path/manifest.json ]] + then + local manifest_args="$(jq -r '.arguments.install[].name' $package_path/manifest.json)" + else + local manifest_args="$(grep -oE '^\s*\[install\.\w+]' $package_path/manifest.toml | tr -d '[]' | awk -F. '{print $2}')" + fi for ARG in $manifest_args do # If the argument is not yet in install args, add its default value if ! echo "$install_args" | grep -q -E "\<$ARG=" then - local default_value=$(python3 -c "import toml, sys; t = toml.loads(sys.stdin.read()); d = t['install']['$ARG'].get('default'); assert d is not None, 'Missing default value'; print(d)" < $package_path/manifest.toml) + # NB : we need to keep this as long as there are "upgrade from packaging v1" tests + if [[ -e $package_path/manifest.json ]] + then + local default_value=$(jq -e -r --arg ARG $ARG '.arguments.install[] | select(.name==$ARG) | .default' $package_path/manifest.json) + else + local default_value=$(python3 -c "import toml, sys; t = toml.loads(sys.stdin.read()); d = t['install']['$ARG'].get('default'); assert d is not None, 'Missing default value'; print(d)" < $package_path/manifest.toml) + fi [[ $? -eq 0 ]] || { log_error "Missing install arg $ARG ?"; return 1; } [[ ${install_args: -1} == '&' ]] || install_args+="&" install_args+="$ARG=$default_value"