X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=misc%2Fcheck-proj.sh;h=b43ec7aa40ad2ae7945c620a06d680a4badb92d3;hb=90533079c873b31458a272ed4b7ffc90c593e1f5;hp=4b19c97ae3e11f3fb4fd8d3b885289a69d702f73;hpb=3968dc84fda0084db9dad2a2f8cf8ebeb9b5a320;p=xonotic%2Fgmqcc.git diff --git a/misc/check-proj.sh b/misc/check-proj.sh index 4b19c97..b43ec7a 100755 --- a/misc/check-proj.sh +++ b/misc/check-proj.sh @@ -12,7 +12,8 @@ download_hashes=$(wget -qO- ${hashes}) download_options=$(wget -qO- ${options}) download() { - pushd ~/.gmqcc/testsuite > /dev/null + local old="$PWD" + cd ~/.gmqcc/testsuite echo "$download_list" | while read -r line do echo "downloading $line ..." @@ -22,7 +23,7 @@ download() { echo "$download_hashes" > ~/.gmqcc/testsuite/hashes echo "$download_options" > ~/.gmqcc/testsuite/options - popd > /dev/null + cd "$old" } if [ -z "$download_list" -o -z "$download_hashes" -o -z "$download_options" ]; then @@ -68,14 +69,15 @@ fi if [ ! -d ~/.gmqcc/testsuite/projects ]; then mkdir -p ~/.gmqcc/testsuite/projects - pushd ~/.gmqcc/testsuite/projects > /dev/null - echo "$(ls ../ | cat | grep -v '^hashes$' | grep -v '^projects$' | grep -v '^options$')" | while read -r line + old="$PWD" + cd ~/.gmqcc/testsuite/projects + echo "$(ls ../ | grep -v '^hashes$' | grep -v '^projects$' | grep -v '^options$')" | while read -r line do echo "extracting project $line" mkdir "$(echo "$line" | sed 's/\(.*\)\..*/\1/')" unzip -qq "../$line" -d $(echo "$line" | sed 's/\(.*\)\..*/\1/') done - popd > /dev/null + cd "$old" else echo "previous state exists, using it" fi @@ -96,41 +98,43 @@ env -i type gmqcc 1>/dev/null 2>&1 || { fi } -pushd ~/.gmqcc/testsuite/projects > /dev/null -find . -maxdepth 1 -mindepth 1 -type d -printf "%f\n" | while read -r line +end_dir="$PWD" +cd ~/.gmqcc/testsuite/projects +start="$PWD" +find . -maxdepth 1 -mindepth 1 -type d | while read -r line do - error=0 + line="${line#./}" echo -n "compiling $line... " - pushd "$line" > /dev/null + cd "${start}/${line}" # does the project have multiple subprojects? if [ -f dirs ]; then + echo "" cat dirs | while read -r dir do # change to subproject - pushd "$dir" > /dev/null - "$gmqcc_bin" $(cat ../../../options | grep "$line:" | awk '{print $2}') > /dev/null 2>&1 + echo -n " compiling $dir... " + old="$PWD" + cd "$dir" + cmd="$(cat ../../../options | grep "$line:" | awk '{print substr($0, index($0, $2))}')" + "$gmqcc_bin" $cmd > /dev/null 2>&1 if [ $? -ne 0 ]; then - error=1 + echo "error" + else + echo "success" fi - popd > /dev/null + cd "$old" done # nope only one project else - "$gmqcc_bin" $(cat ../../options | grep "$line:" | awk '{print $2}') > /dev/null 2>&1 + cmd="$(cat ../../options | grep "$line:" | awk '{print substr($0, index($0, $2))}')" + "$gmqcc_bin" $cmd > /dev/null 2>&1 if [ $? -ne 0 ]; then - error=1 + echo "error" + else + echo "success" fi fi - - # status - if [ $error -ne 0 ]; then - echo "error" - else - echo "success" - fi - - popd > /dev/null done -popd > /dev/null +cd "$end_dir"