From: Amos Jeffries Date: Sat, 23 Oct 2010 13:35:36 +0000 (-0600) Subject: Enhance source maintenance scripts astyle detection X-Git-Tag: SQUID_3_1_9~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc8a14d8e3d46ea9f9cc4f60bec614f0ded0e008;p=thirdparty%2Fsquid.git Enhance source maintenance scripts astyle detection --- diff --git a/scripts/source-maintenance.sh b/scripts/source-maintenance.sh index ad743c7a06..f9be7ed09f 100755 --- a/scripts/source-maintenance.sh +++ b/scripts/source-maintenance.sh @@ -22,6 +22,13 @@ fi ROOT=`bzr root` +ASVER=`astyle --version 2>&1 | grep -o -E "[0-9.]+"` +if test "${ASVER}" != "1.23" ; then + echo "Astyle version problem. You have ${ASVER} instead of 1.23."; +else + echo "Found astyle ${ASVER}. Formatting..." +fi + srcformat () { PWD=`pwd` @@ -36,19 +43,21 @@ for FILENAME in `ls -1`; do # # Code Style formatting maintenance # - ${ROOT}/scripts/formater.pl ${FILENAME} - if test -e $FILENAME -a -e "$FILENAME.astylebak"; then - md51=`cat $FILENAME| tr -d "\n \t\r" | $MD5`; - md52=`cat $FILENAME.astylebak| tr -d "\n \t\r" | $MD5`; - - if test "$md51" != "$md52" ; then - echo "ERROR: File $PWD/$FILENAME not formating well"; - mv $FILENAME $FILENAME.astylebad - mv $FILENAME.astylebak $FILENAME - else - rm -f $FILENAME.astylebak - fi - fi + if test "${ASVER}" = "1.23"; then + ${ROOT}/scripts/formater.pl ${FILENAME} + if test -e $FILENAME -a -e "$FILENAME.astylebak"; then + md51=`cat $FILENAME| tr -d "\n \t\r" | $MD5`; + md52=`cat $FILENAME.astylebak| tr -d "\n \t\r" | $MD5`; + + if test "$md51" != "$md52" ; then + echo "ERROR: File $PWD/$FILENAME not formating well"; + mv $FILENAME $FILENAME.astylebad + mv $FILENAME.astylebak $FILENAME + else + rm -f $FILENAME.astylebak + fi + fi + fi # # DEBUG Section list maintenance