Whamcloud - gitweb
LU-18002 build: proper MOFED detection with multiple installations 25/55625/4
authorAurelien Degremont <adegremont@nvidia.com>
Wed, 3 Jul 2024 13:43:36 +0000 (15:43 +0200)
committerOleg Drokin <green@whamcloud.com>
Wed, 31 Jul 2024 16:03:08 +0000 (16:03 +0000)
For build step, OFED detection is based on header path detected
from the locally installed packages.

Building with multiple OFED headers installed (for different
kernels by example) is broken since v2_15_63-60-g0e9708016b.

This patch is at least fixing the Ubuntu case, and the EL
case is not changed, what was working is still working, but
the broken case is still broken.

Also simplify the package query a little bit.

Fixes: 0e9708016 ("LU-16819 build: use mofed path based on target kernel")
Signed-off-by: Aurelien Degremont <adegremont@nvidia.com>
Change-Id: Ib15f971ea745d9deded6288e3ed4663bdd385da0
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55625
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: ake sandgren <ake.sandgren@hpc2n.umu.se>
Reviewed-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/autoconf/lustre-lnet.m4

index 8595211..cb44649 100644 (file)
@@ -82,32 +82,34 @@ case $with_o2ib in
                # Use ofed_info to find external driver
                AS_IF([which ofed_info 2>/dev/null], [
                        AS_IF([test x$uses_dpkg = xyes], [
-                               LIST_ALL_PKG="dpkg -l | awk '{print \[$]2}'"
                                LSPKG="dpkg --listfiles"
                        ], [
-                               LIST_ALL_PKG="rpm -qa"
                                LSPKG="rpm -ql"
                        ])
 
                        O2IBPKG="mlnx-ofed-kernel-dkms"
-                       O2IBPKG+="|mlnx-ofed-kernel-modules"
-                       O2IBPKG+="|mlnx-ofa_kernel-devel"
-                       O2IBPKG+="|compat-rdma-devel"
-                       O2IBPKG+="|kernel-ib-devel"
-                       O2IBPKG+="|ofa_kernel-devel"
+                       O2IBPKG+=" mlnx-ofed-kernel-modules"
+                       O2IBPKG+=" mlnx-ofa_kernel-devel"
+                       O2IBPKG+=" compat-rdma-devel"
+                       O2IBPKG+=" kernel-ib-devel"
+                       O2IBPKG+=" ofa_kernel-devel"
 
                        O2IBDIR="/ofa_kernel"
                        O2IBDIR+="|/ofa_kernel/default"
                        O2IBDIR+="|/openib"
 
-                       O2IBDIR_PATH=$(eval $LIST_ALL_PKG |
-                                      egrep -w "$O2IBPKG" | xargs $LSPKG |
+                       O2IBDIR_PATH=$(eval $LSPKG $O2IBPKG 2>/dev/null |
                                       egrep "${O2IBDIR}$" |
                                       grep -v /ofed_scripts/ | head -n1)
 
+                       # Nowadays, path should always be
+                       # /usr/src/ofa_kernel/$ARCH/${LINUXRELEASE}
+                       # and we could clean all that complexity
+                       # but I don't know how far we should be retro-compatible.
+
                        if test -n "$O2IBDIR_PATH"; then
-                               if test -d $O2IBDIR_PATH/${LINUXRELEASE}; then
-                                       O2IBDIR_PATH=$O2IBDIR_PATH/${LINUXRELEASE}
+                               if test -d $O2IBDIR_PATH/${target_cpu}/${LINUXRELEASE}; then
+                                       O2IBDIR_PATH=$O2IBDIR_PATH/${target_cpu}/${LINUXRELEASE}
                                fi
                                EXT_O2IBPATHS=$(find $O2IBDIR_PATH -name rdma_cm.h |
                                        sed -e 's/\/include\/rdma\/rdma_cm.h//')