From 6347c97285901eb28bf809f01de4ff376f504b4c Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Holcroft Date: Aug 15 2021 13:32:50 +0000 Subject: [PATCH 1/2] #21 check if l10n folder exists --- diff --git a/stats/compute.sh b/stats/compute.sh index 06a1554..3f35e9f 100755 --- a/stats/compute.sh +++ b/stats/compute.sh @@ -2,20 +2,29 @@ echo "**********************************" echo "* Refresh fedora-docs/localization" -# make sure we are in the folder of the current cript -pushd $(dirname $0) > /dev/null || exit +# we expect a l10n folder containing all po/pot files in the parent folder +RELATIVE_PATH="../" +FOLDER_TO_SCAN="l10n" -echo "* Runnning po Count" -pushd "../" > /dev/null || exit +# make sure we are in the folder of the current script +pushd "$(dirname "$0")" > /dev/null || exit + +if [[ ! -d "$RELATIVE_PATH$FOLDER_TO_SCAN" ]]; then + echo "The folder $FOLDER_TO_SCAN do not exist, exiting..." + exit 1 +fi + +echo "* Running po Count" +pushd "$RELATIVE_PATH" > /dev/null || exit # pocount requires the installation of translate-toolkit -pocount --csv $(find l10n -name '*.po') >> stats/results.csv 2>> stats/error.log -pocount --csv $(find l10n -name '*.pot') | tail -n+2 >> stats/results.csv 2>> stats/error.log +pocount --csv "$(find "$FOLDER_TO_SCAN" -name '*.po')" >> stats/results.csv 2>> stats/error.log +pocount --csv "$(find "$FOLDER_TO_SCAN" -name '*.pot')" | tail -n+2 >> stats/results.csv 2>> stats/error.log popd > /dev/null || exit echo "* Cloning" git clone https://pagure.io/fedora-docs/localization.git --quiet -echo "* Installing Python depedencies with pip" +echo "* Installing Python dependencies with pip" python3 -m venv venv source venv/bin/activate pip install pandas @@ -29,7 +38,7 @@ pushd "localization" > /dev/null || exit git remote set-url --push origin ssh://git@pagure.io/fedora-docs/localization.git git add . git status --porcelain -git commit -m "Automated update" --quiet +git commit -m "𝄠 Automated update 𝄟" --quiet git push --quiet popd > /dev/null || exit From 0260240f69665e43077b8c51407b168dfcb15912 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Aug 16 2021 15:03:49 +0000 Subject: [PATCH 2/2] don't pass find result as a single string --- diff --git a/stats/compute.sh b/stats/compute.sh index 3f35e9f..f1613da 100755 --- a/stats/compute.sh +++ b/stats/compute.sh @@ -17,8 +17,8 @@ fi echo "* Running po Count" pushd "$RELATIVE_PATH" > /dev/null || exit # pocount requires the installation of translate-toolkit -pocount --csv "$(find "$FOLDER_TO_SCAN" -name '*.po')" >> stats/results.csv 2>> stats/error.log -pocount --csv "$(find "$FOLDER_TO_SCAN" -name '*.pot')" | tail -n+2 >> stats/results.csv 2>> stats/error.log +pocount --csv $(find "$FOLDER_TO_SCAN" -name '*.po') >> stats/results.csv 2>> stats/error.log +pocount --csv $(find "$FOLDER_TO_SCAN" -name '*.pot') | tail -n+2 >> stats/results.csv 2>> stats/error.log popd > /dev/null || exit echo "* Cloning"