From 3c66185c84c94c47f5d8031b92165c68ef666e0e Mon Sep 17 00:00:00 2001 From: Shaun Tancheff Date: Tue, 9 Jan 2024 12:49:13 +0700 Subject: [PATCH] LU-17398 build: detect mlnx-ofa_kernel-devel contents 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 Change-Id: I30c6b3a196021634c621f6f6c556bf32f28faeed Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/53613 Reviewed-by: Andreas Dilger Reviewed-by: Jian Yu Reviewed-by: Oleg Drokin Tested-by: Maloo Tested-by: jenkins --- lustre.spec.in | 16 +++++++++++++++- rpm/kmp-lnet-o2iblnd.preamble | 8 ++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/lustre.spec.in b/lustre.spec.in index 531c978..987ffec 100644 --- a/lustre.spec.in +++ b/lustre.spec.in @@ -195,6 +195,16 @@ %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 diff --git a/rpm/kmp-lnet-o2iblnd.preamble b/rpm/kmp-lnet-o2iblnd.preamble index a5b5b3d..9095f36 100644 --- a/rpm/kmp-lnet-o2iblnd.preamble +++ b/rpm/kmp-lnet-o2iblnd.preamble @@ -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 -- 1.8.3.1