Only clone renpy/etc. if there is a need to build
This commit is contained in:
parent
b61d42b675
commit
3d8c199eca
66
.po2tl.sh
66
.po2tl.sh
|
@ -4,33 +4,63 @@
|
||||||
|
|
||||||
declare -A langnames=( ["es_419"]="spanish" ["pt_BR"]="brazilian_portuguese" ["ru"]="russian" ["pl"]="polish" )
|
declare -A langnames=( ["es_419"]="spanish" ["pt_BR"]="brazilian_portuguese" ["ru"]="russian" ["pl"]="polish" )
|
||||||
|
|
||||||
for file in ./translations-*.po; do
|
declare -a filesToDo
|
||||||
file2=${file%.po}
|
|
||||||
langcc=${file2#\.\/translations\-}
|
|
||||||
if [[ -n ${langnames[$langcc]} ]]; then
|
|
||||||
lang=${langnames[$langcc]}
|
|
||||||
if [[ -f "/var/www/queer/build/${CI_REPO_NAME}/${langcc}.zip" ]]; then
|
|
||||||
rm "/var/www/queer/build/${CI_REPO_NAME}/${langcc}.zip"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
lang=$langcc
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
for file in ./translations-*.po; do
|
||||||
stats=$(msgfmt --statistics ${file} 2>&1)
|
stats=$(msgfmt --statistics ${file} 2>&1)
|
||||||
numdone=$(echo ${stats%* translated*})
|
numdone=$(echo ${stats%* translated*})
|
||||||
if [[ $numdone -le 5400 ]]; then
|
if [[ $numdone -le 5400 ]]; then
|
||||||
echo -e "\x1B[36mSKIPPING $file since it has less than 5680 strings translated\x1B[0m"
|
echo -e "\x1B[36mSKIPPING ${file#\.\/} since it has less than 5400 strings translated\x1B[0m"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if (( $(date -d $(awk '/PO-Revision-Date/{ sub(/\+.*/,""); print $2"T"$3}' ${file}) +%s) < $CI_PREV_BUILD_STARTED )); then
|
if (( $(date -d $(awk '/PO-Revision-Date/{ sub(/\+.*/,""); print $2"T"$3}' ${file}) +%s) < $CI_PREV_BUILD_STARTED )); then
|
||||||
echo -e "\x1B[36mSKIPPING $file since it hasn't been changed since last CI\x1B[0m"
|
echo -e "\x1B[36mSKIPPING ${file#\.\/} since it hasn't been changed since last CI\x1B[0m"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "\x1B[36mBUILDING $file \x1B[0m"
|
echo -e "\x1B[36mAdding ${file#\.\/} to list of files to build\x1B[0m"
|
||||||
msgfmt "$file" -o game.mo
|
filesToDo+=(file)
|
||||||
PATH=$(pwd)/renpy:${PATH} RENPY_DIR=$(pwd)/renpy python3 rttk-queerscriptors/mo2tl.py $(pwd)/game-source game.mo ${lang}
|
|
||||||
(cd game-source/game/tl/${lang} && zip -r "${lang}.zip" . && mv "${lang}.zip" "/var/www/queer/build/${CI_REPO_NAME}/${lang}.zip" )
|
|
||||||
echo -e "\e[32mFINISHED $file\e[0m"
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if ${#filesToDo[@]} > 0; then
|
||||||
|
echo
|
||||||
|
echo "\x1B[36m---------------------"
|
||||||
|
echo "| CLONING |"
|
||||||
|
echo "---------------------\x1B[0m"
|
||||||
|
echo
|
||||||
|
git clone https://lab.encryptionin.space/Queerscriptors/rttk-queerscriptors.git
|
||||||
|
git clone https://lab.encryptionin.space/Queerscriptors/renpy.git
|
||||||
|
git clone -b game ${CI_REPO_REMOTE} ./game-source
|
||||||
|
echo
|
||||||
|
echo "\x1B[36m--------------------"
|
||||||
|
echo "| BUILDING |"
|
||||||
|
echo "--------------------\x1B[0m"
|
||||||
|
echo
|
||||||
|
for file in filesToDo; do
|
||||||
|
file2=${file%.po}
|
||||||
|
langcc=${file2#\.\/translations\-}
|
||||||
|
if [[ -n ${langnames[$langcc]} ]]; then
|
||||||
|
lang=${langnames[$langcc]}
|
||||||
|
if [[ -f "/var/www/queer/build/${CI_REPO_NAME}/${langcc}.zip" ]]; then
|
||||||
|
rm "/var/www/queer/build/${CI_REPO_NAME}/${langcc}.zip"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
lang=$langcc
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e "\x1B[36mBUILDING ${file#\.\/} \x1B[0m"
|
||||||
|
msgfmt "$file" -o game.mo
|
||||||
|
PATH=$(pwd)/renpy:${PATH} RENPY_DIR=$(pwd)/renpy python3 rttk-queerscriptors/mo2tl.py $(pwd)/game-source game.mo ${lang}
|
||||||
|
(cd game-source/game/tl/${lang} && zip -r "${lang}.zip" . && mv "${lang}.zip" "/var/www/queer/build/${CI_REPO_NAME}/${lang}.zip" )
|
||||||
|
echo -e "\e[32mFINISHED $file\e[0m"
|
||||||
|
echo
|
||||||
|
done
|
||||||
|
echo
|
||||||
|
echo "\x1B[36m--------------------"
|
||||||
|
echo "| DONE |"
|
||||||
|
echo "--------------------\x1B[0m"
|
||||||
|
echo
|
||||||
|
else
|
||||||
|
echo -e "\x1B[36mNothing to do\x1B[0m"
|
||||||
|
fi
|
||||||
|
|
|
@ -4,9 +4,6 @@ pipeline:
|
||||||
commands:
|
commands:
|
||||||
- apt-get update
|
- apt-get update
|
||||||
- apt-get install -y git gettext python3 libgl1 zip
|
- apt-get install -y git gettext python3 libgl1 zip
|
||||||
- git clone https://lab.encryptionin.space/Queerscriptors/rttk-queerscriptors.git
|
|
||||||
- git clone https://lab.encryptionin.space/Queerscriptors/renpy.git
|
|
||||||
- git clone -b game ${CI_REPO_REMOTE} ./game-source
|
|
||||||
- bash .po2tl.sh
|
- bash .po2tl.sh
|
||||||
volumes:
|
volumes:
|
||||||
- /var/www/queer/build/${CI_REPO_NAME}:/var/www/queer/build/${CI_REPO_NAME}
|
- /var/www/queer/build/${CI_REPO_NAME}:/var/www/queer/build/${CI_REPO_NAME}
|
||||||
|
|
Loading…
Reference in a new issue