]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Enhance source maintenance scripts astyle detection
authorAmos Jeffries <amosjeffries@squid-cache.org>
Sat, 23 Oct 2010 13:35:36 +0000 (07:35 -0600)
committerAmos Jeffries <amosjeffries@squid-cache.org>
Sat, 23 Oct 2010 13:35:36 +0000 (07:35 -0600)
scripts/source-maintenance.sh

index ad743c7a06b688683fb8ba21078f453c7660492e..f9be7ed09fe150ef0a699e2be9246dba51721ea7 100755 (executable)
@@ -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