Whamcloud - gitweb
LU-15521 spec: fix more bare words error with rpm 4.16
[fs/lustre-release.git] / lustre.spec.in
index 2777570..800d31e 100644 (file)
@@ -65,7 +65,7 @@
 %{!?kobjdir: %global kobjdir %(if [ "%{kdir}" = "/lib/modules/%{_kver}/source" ]; then echo "/lib/modules/%{_kver}/build"; else echo "%{kdir}"; fi)}
 
 %if 0%{?suse_version} >= 1310 && %{defined _take_kobj}
-       %global _flavor %(basename "%{kobjdir}")
+       %global _flavor %(echo %{_kver} | sed -e 's/^.*-//')
 %else
        %global _flavor default
 %endif
@@ -276,8 +276,8 @@ echo $TMPFILE
 %if %{with lustre_utils}
 %package osd-ldiskfs-mount
 Summary: osd-ldiskfs-mount contains mount's ldiskfs specific dso.
-BuildRequires: e2fsprogs-devel >= 1.44.3
-Requires: ldiskfsprogs > 1.45.6
+BuildRequires: e2fsprogs-devel >= 1.44.3 libmount-devel
+Requires: ldiskfsprogs > 1.45.6 libmount
 Provides: lustre-osd-mount = %{version}
 Provides: %{name}-osd-mount = %{version}
 Obsoletes: %{name}-osd-mount < %{version}
@@ -297,6 +297,8 @@ LDISKFS hooks for mount/mkfs into a dynamic library.
 %if %{with lustre_utils}
 %package osd-zfs-mount
 Summary: osd-zfs-mount contains mount's zfs specific dso.
+BuildRequires: libmount-devel
+Requires: libmount
 Provides: %{name}-osd-mount = %{version}
 Obsoletes: lustre-osd-mount < %{version}
 # Tests also require zpool from zfs package:
@@ -370,7 +372,9 @@ BuildRequires: openmpi-devel
 %else
 BuildRequires: openmpi2-devel
 %endif
+# openmpi
 %endif
+# mpi
 %endif
 
 %description tests
@@ -466,7 +470,10 @@ if [ -n "$CONFIGURE_ARGS" ]; then
        # and create dedicated cache in temporary build directory
        if [ -f "$CONFIG_CACHE_FILE" ]; then
                TMP_CONFIG_CACHE="$(mktemp --tmpdir newconfig-XXXXXXXX.cache)"
-               sed "/ac_cv_env/d" "$CONFIG_CACHE_FILE" > $TMP_CONFIG_CACHE
+               sed -e "/ac_cv_env/d" \
+                   -e "/am_cv_CC_dependencies_compiler_type/d" \
+                   -e "/lb_cv_mpi_tests/d" \
+                      "$CONFIG_CACHE_FILE" > $TMP_CONFIG_CACHE
                CONFIGURE_ARGS="$CONFIGURE_ARGS --cache-file=$TMP_CONFIG_CACHE"
        fi
 fi
@@ -476,10 +483,23 @@ fi
 # also remove (build|host|target) options because they will be specified
 # inside $CONFIGURE_ARGS
 # kmod tools/scripts require "name" directory with kernel modules
-%define eval_configure %(echo '%configure' | sed -e 's#\./configure#eval ./configure#' -e 's/--\\(build\\|host\\|target\\)=[^ ][^ ]* //g')
 
-%{?_openmpi_load}
+%if 0%{?rhel} >= 9
+%define _configure eval ./configure
+%define eval_configure %configure
+%else
+%define eval_configure %(echo -n '%configure' | sed -e 's#\./configure#eval ./configure#' -e 's/--\\(build\\|host\\|target\\)=[^ ][^ ]* //g')
+%endif
+
+%if %{with mpi}
+%if "%{mpi_name}" == "mpich"
 %{?_mpich_load}
+%endif
+%if "%{mpi_name}" == "openmpi"
+%{?_openmpi_load}
+%endif
+# mpi
+%endif
 
 %if %{with mofed}
        o2ib_path=$(find /usr/src/ofa_kernel/ -type d -name ofed_scripts | xargs dirname)
@@ -523,9 +543,27 @@ fi
 
 make %{?_smp_mflags} -s %{?make_args}
 
+%if %{with mpi}
+%if "%{mpi_name}" == "mpich"
+%{?_mpich_unload}
+%endif
+%if "%{mpi_name}" == "openmpi"
+%{?_openmpi_unload}
+%endif
+# mpi
+%endif
+
 %install
-%{?_openmpi_load}
+
+%if %{with mpi}
+%if "%{mpi_name}" == "mpich"
 %{?_mpich_load}
+%endif
+%if "%{mpi_name}" == "openmpi"
+%{?_openmpi_load}
+%endif
+# mpi
+%endif
 
 make install DESTDIR=$RPM_BUILD_ROOT
 
@@ -555,6 +593,15 @@ mv $basemodpath/fs/kinode.ko $RPM_BUILD_ROOT%{_libdir}/lustre/tests/kernel/
 %endif
 %endif
 
+%if %{without mpi}
+if [ -d $RPM_BUILD_ROOT%{_libdir}/openmpi ] ; then
+       rm -fr $RPM_BUILD_ROOT%{_libdir}/openmpi
+fi
+if [ -d $RPM_BUILD_ROOT%{_libdir}/mpich ] ; then
+       rm -fr $RPM_BUILD_ROOT%{_libdir}/mpich
+fi
+%endif
+
 :> lustre.files
 
 %if %{with servers} && %{with lustre_utils}
@@ -627,6 +674,15 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/liblustreapi.la
 
 %if %{with lustre_tests}
 :> lustre-tests.files
+%if %{with mpi}
+%if "%{mpi_name}" == "mpich"
+%{?_mpich_load}
+%endif
+%if "%{mpi_name}" == "openmpi"
+%{?_openmpi_load}
+%endif
+# mpi
+%endif
 echo '%{_libdir}/lustre/tests/*' >>lustre-tests.files
 echo '%{_bindir}/mcreate' >>lustre-tests.files
 echo '%{_bindir}/munlink' >>lustre-tests.files