diff options
author | Saulc <lucas@debian> | 2018-01-13 19:41:26 +0100 |
---|---|---|
committer | Saulc <lucas@debian> | 2018-01-13 19:41:26 +0100 |
commit | 4c4f4be30bae96e6cd943de326b1a4b1b841dcd4 (patch) | |
tree | a94e0a063e5df2a9f7f84f720982a3bca0c0cf6d /.tools | |
download | clientdata-4c4f4be30bae96e6cd943de326b1a4b1b841dcd4.tar.gz clientdata-4c4f4be30bae96e6cd943de326b1a4b1b841dcd4.tar.bz2 clientdata-4c4f4be30bae96e6cd943de326b1a4b1b841dcd4.tar.xz clientdata-4c4f4be30bae96e6cd943de326b1a4b1b841dcd4.zip |
Initial commit
Diffstat (limited to '.tools')
-rwxr-xr-x | .tools/contributors.sh | 24 | ||||
-rwxr-xr-x | .tools/deploy.sh | 34 | ||||
-rwxr-xr-x | .tools/downloadlib.sh | 22 | ||||
-rwxr-xr-x | .tools/imagemagiccheck.sh | 22 | ||||
-rwxr-xr-x | .tools/init.sh | 90 | ||||
-rwxr-xr-x | .tools/licensecheck.sh | 22 | ||||
-rwxr-xr-x | .tools/manaplus.sh | 33 | ||||
-rwxr-xr-x | .tools/newlines.sh | 28 | ||||
-rwxr-xr-x | .tools/pngcheck.sh | 23 | ||||
-rwxr-xr-x | .tools/retry.sh | 15 | ||||
-rwxr-xr-x | .tools/testxml.sh | 33 |
11 files changed, 346 insertions, 0 deletions
diff --git a/.tools/contributors.sh b/.tools/contributors.sh new file mode 100755 index 00000000..487c3cb4 --- /dev/null +++ b/.tools/contributors.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +source ./.tools/init.sh + +clientdata_init + +aptget_update +aptget_install git-core gcc ca-certificates libxml2-utils make xsltproc +rm -rf tools +gitclone https://gitlab.com/evol evol-tools.git tools + +cd tools/contrib_xsl + +make about-server +check_error $? + +cd ../../clientdata + +export RES=$(git diff) +if [[ -n "${RES}" ]]; then + echo "Contributors list not updated" + git diff + exit 1 +fi diff --git a/.tools/deploy.sh b/.tools/deploy.sh new file mode 100755 index 00000000..7184f4b8 --- /dev/null +++ b/.tools/deploy.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +source ./.tools/init.sh + +clientdata_init + +aptget_update +aptget_install git-core zip gcc zlib1g-dev ca-certificates libxml2-utils python +rm -rf tools +gitclone https://gitlab.com/evol evol-tools.git tools + +cd clientdata +rm -rf public +mkdir public + +cd .. + +rm -rf music +gitclone https://gitlab.com/evol evol-music.git music + +cd tools/update + +./createnew.sh +check_error $? +./create_music.sh +check_error $? + +cp -r upload/* ../../clientdata/public +cd ../../clientdata +gitclone https://gitlab.com/4144 pagesindexgen.git pagesindexgen +cd pagesindexgen +./pagesindexgen.py ../public +check_error $? +ls ../public diff --git a/.tools/downloadlib.sh b/.tools/downloadlib.sh new file mode 100755 index 00000000..b9a50d73 --- /dev/null +++ b/.tools/downloadlib.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +export zipname="lib.zip" +export libname="$1_$2" + +mkdir libdownload +cd libdownload +rm "${zipname}" +../client-data/.tools/retry.sh wget -O "${zipname}" "https://gitlab.com/simplepackagemanager/spm/builds/artifacts/$1/download?job=${libname}" +unzip "${zipname}" +cp -r "bin/${libname}" .. +cd .. + +rm -rf /usr/local/spm/bin/${libname} +mkdir -p /usr/local/spm/bin + +cp -r libdownload/bin/${libname} /usr/local/spm/bin/ +ls /usr/local/spm/bin/${libname} +if [ "$?" != 0 ]; then + echo "Library $1 $2 unpack failed" + exit 1 +fi diff --git a/.tools/imagemagiccheck.sh b/.tools/imagemagiccheck.sh new file mode 100755 index 00000000..c298e576 --- /dev/null +++ b/.tools/imagemagiccheck.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +source ./.tools/init.sh + +clientdata_init + +aptget_update +aptget_install git-core gcc ca-certificates imagemagick +rm -rf tools +gitclone https://gitlab.com/evol evol-tools.git tools + +cd tools/imagescheck + +./icccheck.sh >icccheck.log +check_error $? + +export RES=$(cat icccheck.log) +if [[ -n "${RES}" ]]; then + echo "Detected icc profiles" + cat icccheck.log + exit 1 +fi diff --git a/.tools/init.sh b/.tools/init.sh new file mode 100755 index 00000000..4fe533ef --- /dev/null +++ b/.tools/init.sh @@ -0,0 +1,90 @@ +#!/bin/bash + +function check_error { + if [ "$1" != 0 ]; then + echo "Error $1" + exit $1 + fi +} + +function gitclone1 { + echo git clone $2 $3 + git clone $2 $3 + if [ "$?" != 0 ]; then + echo git clone $1 $3 + git clone $1 $3 + return $? + fi + return $? +} + +function gitclone { + export name1=$1/$2 + export name2=${CI_BUILD_REPO##*@} + export name2=https://${name2%/*}/$2 + + gitclone1 "$name1" "$name2" $3 + if [ "$?" != 0 ]; then + sleep 1s + gitclone1 "$name1" "$name2" $3 + if [ "$?" != 0 ]; then + sleep 3s + gitclone1 "$name1" "$name2" $3 + if [ "$?" != 0 ]; then + sleep 5s + gitclone1 "$name1" "$name2" $3 + fi + fi + fi + check_error $? +} + +function update_repos { + if [ "$CI_SERVER" == "" ]; + then + return + fi + + export DATA=$(cat /etc/resolv.conf|grep "nameserver 1.10.100.101") + if [ "$DATA" != "" ]; + then + echo "Detected local runner" + sed -i 's!http://httpredir.debian.org/debian!http://1.10.100.103/debian!' /etc/apt/sources.list + else + echo "Detected non local runner" + fi +} + +function aptget_update { + update_repos + apt-get update + if [ "$?" != 0 ]; then + sleep 1s + apt-get update + if [ "$?" != 0 ]; then + sleep 1s + apt-get update + fi + fi + check_error $? +} + +function aptget_install { + apt-get -y -qq install $* + if [ "$?" != 0 ]; then + sleep 1s + apt-get -y -qq install $* + if [ "$?" != 0 ]; then + sleep 2s + apt-get -y -qq install $* + fi + fi + check_error $? +} + +function clientdata_init { + mkdir shared + cd .. + ln -s clientdata client-data + check_error $? +} diff --git a/.tools/licensecheck.sh b/.tools/licensecheck.sh new file mode 100755 index 00000000..750caed1 --- /dev/null +++ b/.tools/licensecheck.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +source ./.tools/init.sh + +clientdata_init + +aptget_update +aptget_install git-core gcc ca-certificates grep +rm -rf tools +gitclone https://gitlab.com/evol evol-tools.git tools + +cd tools/licensecheck + +./clientdata.sh >license.log +check_error $? + +export RES=$(cat license.log) +if [[ -n "${RES}" ]]; then + echo "Detected missing licenses." + cat license.log + exit 1 +fi diff --git a/.tools/manaplus.sh b/.tools/manaplus.sh new file mode 100755 index 00000000..aeb39a86 --- /dev/null +++ b/.tools/manaplus.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +source ./.tools/init.sh + +clientdata_init + +aptget_update +aptget_install gcc g++ \ + make autoconf automake autopoint gettext \ + libxml2-dev libcurl4-gnutls-dev libpng-dev \ + libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev \ + wget unzip + +pwd +ls + +./clientdata/.tools/downloadlib.sh manaplus master || exit 1 + +export HOME=`pwd`/clientdata/shared + +cd manaplus_master || exit 1 +export SDL_VIDEODRIVER=dummy +./bin/manaplus --validate -u -d ../clientdata || exit 1 + +ls "${HOME}/.local/share/mana/manaplus.log" || exit 1 +grep -A 10 "Assert:" "${HOME}/.local/share/mana/manaplus.log" + +if [ "$?" == 0 ]; then + echo "Asserts found" + exit 1 +fi + +cd .. diff --git a/.tools/newlines.sh b/.tools/newlines.sh new file mode 100755 index 00000000..64cbf7e1 --- /dev/null +++ b/.tools/newlines.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +source ./.tools/init.sh + +aptget_update +aptget_install dos2unix git-core + +export LOG1="newlines.log" + +rm ${LOG1} + +find -H . -type f -name "*.xml" -exec dos2unix {} \; >${LOG1} + +export RES=$(git diff --name-only) +if [[ -n "${RES}" ]]; then + echo "Wrong new lines detected in xml files:" + git diff --name-only + exit 1 +fi + +find -H . -type f -name "*.tmx" -exec dos2unix {} \; >>${LOG1} + +export RES=$(git diff --name-only) +if [[ -n "${RES}" ]]; then + echo "Wrong new lines detected in tmx files:" + git diff --name-only + exit 1 +fi diff --git a/.tools/pngcheck.sh b/.tools/pngcheck.sh new file mode 100755 index 00000000..8955b26e --- /dev/null +++ b/.tools/pngcheck.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +source ./.tools/init.sh + +aptget_update +aptget_install pngcheck + +export LOG1="pngcheck.log" +export LOG2="pngcheck2.log" + +rm ${LOG1} +rm ${LOG2} + +find -H . -type f -name "*.png" -exec pngcheck {} \; >${LOG1} + +grep -v "32-bit RGB+alpha, non-interlaced, " ${LOG1} >${LOG2} +export DATA=$(cat pngcheck2.log) +if [[ -n "${DATA}" ]]; then + echo "Images must be in 32 bit RGBA and non-interlanced" + echo "Wrong images format found:" + cat ${LOG2} + exit 1 +fi diff --git a/.tools/retry.sh b/.tools/retry.sh new file mode 100755 index 00000000..aaa50e98 --- /dev/null +++ b/.tools/retry.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +n=0 + +while true; do + $* + if [ "$?" == 0 ]; then + exit 0 + fi + if [[ $n -ge 10 ]]; then + exit -1 + fi + sleep 5s + n=$((n+1)) +done diff --git a/.tools/testxml.sh b/.tools/testxml.sh new file mode 100755 index 00000000..eb0cd412 --- /dev/null +++ b/.tools/testxml.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +source ./.tools/init.sh + +clientdata_init + +aptget_update +aptget_install git-core zip gcc zlib1g-dev ca-certificates libxml2-utils python python-pyvorbis python-ogg python-pil +rm -rf tools +gitclone https://gitlab.com/evol evol-tools.git tools + +cd tools/testxml + +./xsdcheck.sh +check_error $? +export RES=$(cat errors.txt) +if [[ -n "${RES}" ]]; then + echo "xml check failed" >../../clientdata/shared/error.log + echo ${RES} >>../../clientdata/shared/error.log + cat ../../clientdata/shared/error.log + exit 1 +fi + +echo >../../clientdata/shared/error.log +./testxml.py silent >../../clientdata/shared/error.log +res="$?" +cat ../../clientdata/shared/error.log +if [ "$res" != 0 ]; then + echo "test xml error" + exit 1 +fi + +echo >../../clientdata/shared/error.log |