[Bf-blender-cvs] [fde6151641a] master: install_deps.sh: fix versions such as 1.6_RC2 failing to compare
Campbell Barton
noreply at git.blender.org
Wed Jan 22 16:19:59 CET 2020
Commit: fde6151641a8bb62029040e1a84775de3b5bd333
Author: Campbell Barton
Date: Thu Jan 23 02:15:32 2020 +1100
Branches: master
https://developer.blender.org/rBfde6151641a8bb62029040e1a84775de3b5bd333
install_deps.sh: fix versions such as 1.6_RC2 failing to compare
This is stripped off since it causes an error when evaluating
the strings as numbers.
===================================================================
M build_files/build_environment/install_deps.sh
===================================================================
diff --git a/build_files/build_environment/install_deps.sh b/build_files/build_environment/install_deps.sh
index d4f05c4bab2..33572ddb183 100755
--- a/build_files/build_environment/install_deps.sh
+++ b/build_files/build_environment/install_deps.sh
@@ -993,14 +993,22 @@ download() {
fi
}
+# Remove suffix such as '1.3_RC2', keeping only '1.3'.
+# Needed for numeric comparisons.
+version_sanitize() {
+ echo "$(sed -r 's/^([^_]+).*/\1/' <<< \"$1\")"
+}
+
# 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() {
local IFS='.'
+ local VER_1=$(version_sanitize "$1")
+ local VER_2=$(version_sanitize "$2")
# Split both version numbers into their numeric elements.
- arr1=( $1 )
- arr2=( $2 )
+ arr1=( $VER_1 )
+ arr2=( $VER_2 )
ret=1
@@ -1010,8 +1018,8 @@ version_eq() {
_t=$count1
count1=$count2
count2=$_t
- arr1=( $2 )
- arr2=( $1 )
+ arr1=( $VER_2 )
+ arr2=( $VER_1 )
fi
ret=0
@@ -1062,10 +1070,12 @@ version_ge_lt() {
# $1 should be at least as long as $2!
version_match() {
local IFS='.'
+ local VER_1=$(version_sanitize "$1")
+ local VER_2=$(version_sanitize "$2")
# Split both version numbers into their numeric elements.
- arr1=( $1 )
- arr2=( $2 )
+ arr1=( $VER_1 )
+ arr2=( $VER_2 )
ret=1
More information about the Bf-blender-cvs
mailing list