Whamcloud - gitweb
LU-17627 build: fix new mofed version 36/54336/5
authorMinh Diep <mdiep@whamcloud.com>
Wed, 6 Mar 2024 02:26:58 +0000 (18:26 -0800)
committerOleg Drokin <green@whamcloud.com>
Tue, 30 Apr 2024 06:54:40 +0000 (06:54 +0000)
Allow multi-digit MOFED version numbers.
Fix compare_version function to return what it should

Test-Parameters: trivial
Signed-off-by: Minh Diep <mdiep@whamcloud.com>
Change-Id: I0f585cb355bb34270003ae1139688080c301186a
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/54336
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Jian Yu <yujian@whamcloud.com>
contrib/lbuild/lbuild

index c3b3f4f..fa07b0e 100755 (executable)
@@ -403,7 +403,8 @@ EOF
 compare_version () {
     [[ $1 == $2 ]] && return 1
     local IFS=.
-    local i val1=($1) val2=($2)
+    # remove all minor sub version
+    local i val1=(${1//-*}) val2=(${2//-*})
 
     # padding zero to val1 if it needs
     for ((i=${#val1[@]}; i<${#val2[@]}; i++)); do
@@ -412,9 +413,9 @@ compare_version () {
     for ((i=0; i<${#val1[@]}; i++)); do
         [[ -z ${val2[i]} ]] && return 1
 
-        if [[ ${val1[i]} < ${val2[i]} ]]; then
+        if (( ${val1[i]} < ${val2[i]} )); then
             return 0
-        elif [[ ${val1[i]} > ${val2[i]} ]]; then
+        elif (( ${val1[i]} > ${val2[i]} )); then
             return 1
         fi
     done
@@ -833,7 +834,7 @@ unpack_ofed() {
                        if ! untar "$src"; then
                                return 1
                        fi
-                       [ -d OFED ] || ln -sf MLNX_OFED_SRC-[0-9].[0-9]* OFED
+                       [ -d OFED ] || ln -sf MLNX_OFED_SRC-[0-9]*.[0-9]* OFED
                        if compare_version $ofed_version 4.7 ||
                           compare_version 5.1 $ofed_version; then
                                [ -d OFED_RPMS ] || ln -sf ${file}/RPMS OFED_RPMS