From 79ea5f67c8e96d5efbf1f5d5ca5fd28471216845 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sun, 29 Nov 2020 21:20:54 +0100 Subject: [PATCH] Fixes following tests on the battlefield --- package_check.sh | 2 ++ sub_scripts/lxc_build.sh | 4 ++-- sub_scripts/testing_process.sh | 21 +++++++++++---------- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/package_check.sh b/package_check.sh index 4286e5d..3388164 100755 --- a/package_check.sh +++ b/package_check.sh @@ -302,6 +302,7 @@ then # Clone in another directory git clone --quiet https://github.com/YunoHost/package_linter "$script_dir/package_linter_tmp" + pip3 install pyparsing six # And replace cp -a "$script_dir/package_linter_tmp/." "$script_dir/package_linter/." @@ -310,6 +311,7 @@ then else echo -e "\e[97mInstall Package linter.\n\e[0m" git clone --quiet $git_repository "$script_dir/package_linter" + pip3 install pyparsing six fi # Update the version file diff --git a/sub_scripts/lxc_build.sh b/sub_scripts/lxc_build.sh index 3884aaf..4d91956 100755 --- a/sub_scripts/lxc_build.sh +++ b/sub_scripts/lxc_build.sh @@ -83,7 +83,7 @@ sudo apt-get update >> "$LOG_BUILD_LXC" 2>&1 sudo apt-get install -y lxc lxctl >> "$LOG_BUILD_LXC" 2>&1 echo -e "\e[1m> Install git, curl and lynx\e[0m" | tee -a "$LOG_BUILD_LXC" -sudo apt-get install -y git curl lynx >> "$LOG_BUILD_LXC" 2>&1 +sudo apt-get install -y git curl lynx jq python3-pip >> "$LOG_BUILD_LXC" 2>&1 # For those who have disabled APT::Install-Recommends we need to manually install the following packages. sudo apt-get install -y debootstrap rsync bridge-utils >> "$LOG_BUILD_LXC" 2>&1 @@ -193,7 +193,7 @@ done echo -e "\e[1m> Update et install aptitude sudo git\e[0m" | tee -a "$LOG_BUILD_LXC" sudo lxc-attach -n $LXC_NAME -- apt-get update -sudo lxc-attach -n $LXC_NAME -- apt-get install -y aptitude sudo git ssh openssh-server jq +sudo lxc-attach -n $LXC_NAME -- apt-get install -y aptitude sudo git ssh openssh-server echo -e "\e[1m> Installation des paquets standard et ssh-server\e[0m" | tee -a "$LOG_BUILD_LXC" sudo lxc-attach -n $LXC_NAME -- aptitude install -y ~pstandard ~prequired ~pimportant diff --git a/sub_scripts/testing_process.sh b/sub_scripts/testing_process.sh index 54d3549..8bf2fea 100644 --- a/sub_scripts/testing_process.sh +++ b/sub_scripts/testing_process.sh @@ -2003,12 +2003,12 @@ PACKAGE_LINTER () { unit_test_title "Package linter..." # Execute package linter and linter_result gets the return code of the package linter - "$script_dir/package_linter/package_linter.py" "$package_path" > "$temp_result" - "$script_dir/package_linter/package_linter.py" "$package_path" --json > "$temp_result_json" + "$script_dir/package_linter/package_linter.py" "$package_path" > "$script_dir/temp_linter_result.log" + "$script_dir/package_linter/package_linter.py" "$package_path" --json > "$script_dir/temp_linter_result.json" # Print the results of package linter and copy these result in the complete log - cat "$temp_result" | tee --append "$complete_log" - cat "$temp_result_json" >> "$complete_log" + cat "$script_dir/temp_linter_result.log" | tee --append "$complete_log" + cat "$script_dir/temp_linter_result.json" >> "$complete_log" RESULT_linter_level_6=0 RESULT_linter_level_7=0 @@ -2017,33 +2017,34 @@ PACKAGE_LINTER () { # Check we qualify for level 6, 7, 8 # Linter will have a warning called "app_in_github_org" if app ain't in the # yunohost-apps org... - if ! cat "$temp_result_json" | jq ".warning" | grep -q "app_in_github_org" + if ! cat "$script_dir/temp_linter_result.json" | jq ".warning" | grep -q "app_in_github_org" then RESULT_linter_level_6=1 fi - if cat "$temp_result_json" | jq ".success" | grep -q "qualify_for_level_7" + if cat "$script_dir/temp_linter_result.json" | jq ".success" | grep -q "qualify_for_level_7" then RESULT_linter_level_7=1 fi - if cat "$temp_result_json" | jq ".success" | grep -q "qualify_for_level_8" + if cat "$script_dir/temp_linter_result.json" | jq ".success" | grep -q "qualify_for_level_8" then RESULT_linter_level_8=1 fi # If there are any critical errors, we'll force level 0 - if [[ -z "$(cat "$temp_result_json" | jq ".critical" | grep -v "\[\]")" ]] + if [[ -n "$(cat "$script_dir/temp_linter_result.json" | jq ".critical" | grep -v '\[\]')" ]] then check_failed RESULT_linter=-2 # If there are any regular errors, we'll cap to 4 - elif [[ -z "$(cat "$temp_result_json" | jq ".error" | grep -v "\[\]")" ]] + elif [[ -n "$(cat "$script_dir/temp_linter_result.json" | jq ".error" | grep -v '\[\]')" ]] then # FAil check_failed RESULT_linter=-1 # Otherwise, test pass (we'll display a warning depending on if there are # any remaning warnings or not) else - if [[ -z "$(cat "$temp_result_json" | jq ".warning" | grep -v "\[\]")" ]] + if [[ -n "$(cat "$script_dir/temp_linter_result.json" | jq ".warning" | grep -v '\[\]')" ]] + then check_warning RESULT_linter=1 else