[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [52345] trunk/blender/build_files/ build_environment/install_deps.sh: Definitive fix for version_ge with equal versions like "1.0.0" and "1.0".

Bastien Montagne montagne29 at wanadoo.fr
Mon Nov 19 09:48:30 CET 2012


Revision: 52345
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=52345
Author:   mont29
Date:     2012-11-19 08:48:21 +0000 (Mon, 19 Nov 2012)
Log Message:
-----------
Definitive fix for version_ge with equal versions like "1.0.0" and "1.0".
Also fixed DEB boost version checking, own fault.
And disabled building ocio's apps, else it would go searching for an oiio lib (and we have not yet built ours) - anyway, if users want them, they can build them on their own!

Modified Paths:
--------------
    trunk/blender/build_files/build_environment/install_deps.sh

Modified: trunk/blender/build_files/build_environment/install_deps.sh
===================================================================
--- trunk/blender/build_files/build_environment/install_deps.sh	2012-11-19 02:26:59 UTC (rev 52344)
+++ trunk/blender/build_files/build_environment/install_deps.sh	2012-11-19 08:48:21 UTC (rev 52345)
@@ -78,12 +78,54 @@
   echo "${@}"
 }
 
+# Return 0 if $1 = $2 (i.e. 1.01.0 = 1.1, but 1.1.1 != 1.1), else 1.
+# $1 and $2 should be version numbers made of numbers only.
+version_eq() {
+  backIFS=$IFS
+  IFS='.'
+
+  # Split both version numbers into their numeric elements.
+  arr1=( $1 )
+  arr2=( $2 )
+
+  ret=1
+
+  count1=${#arr1[@]}
+  count2=${#arr2[@]}
+  if [ $count2 -ge $count1 ]; then
+    _t=$count1
+    count1=$count2
+    count2=$_t
+    arr1=( $2 )
+    arr2=( $1 )
+  fi
+
+  ret=0
+  for (( i=0; $i < $count2; i++ ))
+  do
+    if [ $(( 10#${arr1[$i]} )) -ne $(( 10#${arr2[$i]} )) ]; then
+      ret=1
+      break
+    fi
+  done
+
+  for (( i=$count2; $i < $count1; i++ ))
+  do
+    if [ $(( 10#${arr1[$i]} )) -ne 0 ]; then
+      ret=1
+      break
+    fi
+  done
+
+  IFS=$backIFS
+  return $ret
+}
+
 # Return 0 if $1 >= $2, else 1.
 # $1 and $2 should be version numbers made of numbers only.
 version_ge() {
-  # XXX Not yet perfect, won't always work as expected with e.g. 1.0.0 and 1.0... :/
-  if [ "$1" != "$2" ] &&
-     [ $(echo -e "$1\n$2" | sort --version-sort | head --lines=1) = "$1" ]; then
+  version_eq $1 $2
+  if [ $? -eq 1 -a $(echo -e "$1\n$2" | sort --version-sort | head --lines=1) = "$1" ]; then
     return 1
   else
     return 0
@@ -300,6 +342,7 @@
           -D CMAKE_INSTALL_PREFIX=$_inst \
           -D CMAKE_CXX_FLAGS="$cflags" \
           -D CMAKE_EXE_LINKER_FLAGS="-lgcc_s -lgcc" \
+          -D OCIO_BUILD_APPS=OFF \
           ..
 
     make -j$THREADS && make install
@@ -718,7 +761,7 @@
   if [ $? -eq 0 ]; then
     sudo apt-get install -y libboost-dev
 
-    boost_version=`get_package_version_DEB libboost-dev`
+    boost_version=$(echo `get_package_version_DEB libboost-dev` | sed -r 's/^([0-9]+\.[0-9]+).*/\1/')
 
     check_package_DEB libboost-locale$boost_version-dev
     if [ $? -eq 0 ]; then




More information about the Bf-blender-cvs mailing list