From fc8a14d8e3d46ea9f9cc4f60bec614f0ded0e008 Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Sat, 23 Oct 2010 07:35:36 -0600 Subject: [PATCH] Enhance source maintenance scripts astyle detection --- scripts/source-maintenance.sh | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) 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 -- 2.47.2