Whamcloud - gitweb
LU-17398 build: detect mlnx-ofa_kernel-devel contents 13/53613/6
authorShaun Tancheff <shaun.tancheff@hpe.com>
Tue, 9 Jan 2024 05:49:13 +0000 (12:49 +0700)
committerOleg Drokin <green@whamcloud.com>
Wed, 10 Jan 2024 07:30:22 +0000 (07:30 +0000)
Parse the configure_args for --with-o2ib and allow the
user specified path to override the mofed defaults.

Further when mlnx-ofa_kernel-devel contents are available silence
the BuildRequires: to allow for an mlnx source installation to
satisfy the lustre build requirements.

In addition move the mlnx specfic requirements to the mofed lnd
when '--with multiple_lnds' is enabled.

Fixes: 67cd54d05d ("LU-16967 build: Separate lnet LND rpm packaging")
Test-Parameters: trivial
Signed-off-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Change-Id: I30c6b3a196021634c621f6f6c556bf32f28faeed
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/53613
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
lustre.spec.in
rpm/kmp-lnet-o2iblnd.preamble

index 531c978..987ffec 100644 (file)
 %define with_systemd 1
 %endif
 
+# Detect when mlnx-ofa_kernel-devel contents exist and mofed_source to 0
+%define mofed_src_path $(echo %{?configure_args} | tr ' ' '\\n' | grep -- '--with-o2ib=' | cut -c 13-)
+%define mofed_source   %(test -f %mofed_src_path/Module.symvers; echo $?)
+# Update the search path for mofed_scripts
+%if 0%{?mofed_source} > 0
+%define mofed_default_path     /usr/src/ofa_kernel/
+%else
+%define mofed_default_path     %{mofed_src_path}
+%endif
+
 %{!?mpi_name: %global mpi_name openmpi}
 
 Summary: Lustre File System
@@ -281,13 +291,17 @@ BuildRequires: pkgconfig(libselinux)
 %endif
 %if %{with lustre_modules}
 %if %{with mofed}
+%if 0%{?mofed_source} > 0
 BuildRequires: mlnx-ofa_kernel-devel
+%endif
+%if %{with multiple_lnds}
 %if "%{_vendor}" == "redhat" || "%{_vendor}" == "openEuler"
 Requires: kmod-mlnx-ofa_kernel
 %else
 Requires: mlnx-ofa_kernel-kmp
 %endif
 %endif
+%endif
 %if 0%{?rhel} >= 8 || "%{_vendor}" == "openEuler"
 BuildRequires: kernel-rpm-macros
 %endif
@@ -609,7 +623,7 @@ fi
 
 WITH_O2IB=""
 %if %{with mofed}
-       o2ib_path=$(find /usr/src/ofa_kernel/ -type d -name ofed_scripts | xargs dirname)
+       o2ib_path=$(find %{mofed_default_path} -type d -name ofed_scripts | xargs dirname)
        if [ -z "$o2ib_path" ]; then
                echo "ERROR: could not find OFED devel headers"
                exit 1
index a5b5b3d..9095f36 100644 (file)
@@ -3,6 +3,14 @@ License:        GPL-2.0-only
 %if 0%{?suse_version} > 1
 Requires:       kernel-%1
 %endif
+%if 0%{?mofed_source} > 0
+BuildRequires:  mlnx-ofa_kernel-devel
+%endif
+%if "%{_vendor}" == "redhat" || "%{_vendor}" == "openEuler"
+Requires:       kmod-mlnx-ofa_kernel
+%else
+Requires:       mlnx-ofa_kernel-kmp
+%endif
 Provides:       %{name}-lnet-o2iblnd = %{version}
 Obsoletes:      %{name}-lnet-o2iblnd < %{version}
 Conflicts:      %{name}-lnet-in-kernel-o2iblnd