From: Rudolf Polzer Date: Thu, 5 Jan 2012 09:41:50 +0000 (+0100) Subject: rename to check-cvars X-Git-Tag: xonotic-v0.6.0~188^2~24 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=1b8067ffcc792adb987ffdd1a94a9cd834882c7b;p=xonotic%2Fxonotic-data.pk3dir.git rename to check-cvars --- diff --git a/Makefile b/Makefile index abd82b133..6d0e9a617 100644 --- a/Makefile +++ b/Makefile @@ -8,18 +8,18 @@ DIFF ?= diff # It will automagically add an engine check with -TID and then change back to -TFTE FTEQCCFLAGS_CSPROGS ?= -# xonotic build system overrides this by command line argument to turn off the update-cvarcount step +# xonotic build system overrides this by command line argument to turn off the check-cvars step XON_BUILDSYSTEM = all: qc -.PHONY: update-cvarcount -update-cvarcount: +.PHONY: check-cvars +check-cvars: [ "$(XON_BUILDSYSTEM)" = "" ] || [ "$(XON_BUILDSYSTEM)" = "1" ] - [ "$(XON_BUILDSYSTEM)" = "1" ] || { DO_NOT_RUN_MAKE=1 sh update-cvarcount.sh; } + [ "$(XON_BUILDSYSTEM)" = "1" ] || { DO_NOT_RUN_MAKE=1 sh check-cvars.sh; } .PHONY: qc -qc: update-cvarcount +qc: check-cvars $(MAKE) -C qcsrc .PHONY: skin diff --git a/check-cvars.sh b/check-cvars.sh new file mode 100755 index 000000000..78985b819 --- /dev/null +++ b/check-cvars.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +errord=false + +check_files() +{ + countw=`awk ''"$3"' { print $2; }' "$1" | sort -u | tr -d '\r' | git hash-object --stdin | cut -c 1-32` + for b in $2; do + countb=`awk ''"$3"' { print $2; }' "$b" | sort -u | tr -d '\r' | git hash-object --stdin | cut -c 1-32` + if [ "$countw" != "$countb" ]; then + echo "Mismatch between "$1" and $b. Aborting." + echo "Differences are:" + echo "< missing in $b" + echo "> must get removed from $b" + A=`mktemp || echo a.tmp` + B=`mktemp || echo b.tmp` + awk ''"$3"' { print $2; }' "$1" | sort -u | tr -d '\r' > "$A" + awk ''"$3"' { print $2; }' "$b" | sort -u | tr -d '\r' > "$B" + diff "$A" "$B" | grep '^[<>]' | sort + rm -f "$A" "$B" + errord=true + fi + done +} + +check_files "balanceXonotic.cfg" "balance*.cfg" "/^seta? g_/" +check_files "_hud_descriptions.cfg" "hud_*.cfg" "/^seta? hud_/" + +if $errord; then + echo "Please wait for 30 seconds, so you have had enough time to read this..." + sleep 30 +fi diff --git a/update-cvarcount.sh b/update-cvarcount.sh deleted file mode 100755 index 78985b819..000000000 --- a/update-cvarcount.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh - -errord=false - -check_files() -{ - countw=`awk ''"$3"' { print $2; }' "$1" | sort -u | tr -d '\r' | git hash-object --stdin | cut -c 1-32` - for b in $2; do - countb=`awk ''"$3"' { print $2; }' "$b" | sort -u | tr -d '\r' | git hash-object --stdin | cut -c 1-32` - if [ "$countw" != "$countb" ]; then - echo "Mismatch between "$1" and $b. Aborting." - echo "Differences are:" - echo "< missing in $b" - echo "> must get removed from $b" - A=`mktemp || echo a.tmp` - B=`mktemp || echo b.tmp` - awk ''"$3"' { print $2; }' "$1" | sort -u | tr -d '\r' > "$A" - awk ''"$3"' { print $2; }' "$b" | sort -u | tr -d '\r' > "$B" - diff "$A" "$B" | grep '^[<>]' | sort - rm -f "$A" "$B" - errord=true - fi - done -} - -check_files "balanceXonotic.cfg" "balance*.cfg" "/^seta? g_/" -check_files "_hud_descriptions.cfg" "hud_*.cfg" "/^seta? hud_/" - -if $errord; then - echo "Please wait for 30 seconds, so you have had enough time to read this..." - sleep 30 -fi