Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2020-01-22 18:15:32 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-01-22 18:17:28 +0300
commitfde6151641a8bb62029040e1a84775de3b5bd333 (patch)
treee12d77afc1c2c0dd578cdcb97a9018b16cf8166e /build_files
parent412179b39bf8741989bb8199ee5f9a1d015fc174 (diff)
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.
Diffstat (limited to 'build_files')
-rwxr-xr-xbuild_files/build_environment/install_deps.sh22
1 files changed, 16 insertions, 6 deletions
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