1 # SPDX-License-Identifier: GPL-2.0
4 # This file is part of Lustre, http://www.lustre.org/
8 # spec file template for RHEL package builds
11 # Declare rpmbuild --with/--without parameters
12 %bcond_without servers
13 %bcond_without ldiskfs
15 %bcond_without lustre_tests
16 %bcond_without lustre_utils
17 %bcond_without lustre_iokit
18 %bcond_without lustre_modules
20 %bcond_with gss_keyring
21 %bcond_without manpages
27 %bcond_with multiple_lnds
33 %if %{with multiple_lnds}
34 %global enable_multi_lnds 1
37 # LUTF Turn off brp-python-precompile script as we don't want the python files
38 # to be compiled on installation
39 %global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g')
41 # By default both gss and gss keyring are disabled.
42 # gss keyring requires the gss core. If the builder
43 # request gss_keyring we must enable gss core even if
44 # the builder attempts to disable gss.
45 %if %{with gss_keyring}
49 %if %{without servers}
50 # --without servers overrides --with {ldiskfs|zfs}
51 # so undefine the internal variables set by bcond_*
52 %undefine with_ldiskfs
56 %if %{without shared} && %{without static}
57 # need exit to stop build because error only displays a message
58 %{error: you can't disable both library types}
62 # lustre_tests depends on lustre_utils
63 %if %{without lustre_utils}
64 %undefine with_lustre_tests
67 %{!?version: %global version @VERSION@}
68 # if you want a custom kernel version set it variable with $ver.$arch
69 %{!?kver: %global kver %(uname -r)}
70 # cut epoch for kmodtool
71 %define _kver %(echo %{kver} | sed -e 's/^[0-9]*://')
72 # trust version from kdir - but it can lost 'epoch'
76 %if %{defined kobjdir}
79 %{!?kdir: %global kdir /lib/modules/%{_kver}/source}
80 %{!?kobjdir: %global kobjdir %(if [ "%{kdir}" = "/lib/modules/%{_kver}/source" ]; then echo "/lib/modules/%{_kver}/build"; else echo "%{kdir}"; fi)}
82 %if 0%{?suse_version} >= 1310 && %{defined _take_kobj}
83 %global _flavor %(echo %{_kver} | sed -e 's/^.*-//')
85 %global _flavor default
88 %if %{defined _take_kver}
89 # as an alternative to this implementation we could simply "make -C $kdir kernelversion"
90 %global kver %(files="include/generated/utsrelease.h include/linux/utsrelease.h include/linux/version.h"; for f in $files; do if test -r %{kobjdir}/$f && grep UTS_RELEASE %{kobjdir}/$f >/dev/null; then sed -ne '/^#define UTS_RELEASE/s/.*"\\(.*\\)"$/\\1/p' %{kobjdir}/$f; break; fi; done)
94 # We set this because kernel_module_package has its own method of identifying
95 # which kernel to build against, and it is unlikely that its decision will
96 # match with Lustre's method of selecting which kernel to build against.
97 # By setting this variable, we override kernel_module_package's kernel
98 # selection with our selection.
99 # kmodtool failed to take a version if epoch set
100 %global kernel_version %_kver
102 # in order to get kernel symset and/or kernel module dependencies into
103 # the RPM, in order to support weak-modules, the internal dependency gen-
104 # erator needs to be disabled
105 # this is done with (reduce the double % down to a single %):
107 # %%global _use_internal_dependency_generator 0
109 # on SLES10, /usr/lib/rpm/macros already sets this, so no harm in also
110 # defining it here (until Suse changes their mind)
112 # on RHEL5, however, we do need to explicitly disable the internal dep-
113 # endency generator and allow the external one be used
114 # but since RedHat's kABI is only a subset of the total kernel ABI, it
115 # doesn't include all of the symbols we (or OFED for that matter) need
116 # until RedHat includes all of the symbols we need in their symsets we
117 # cannot support weak-modules
118 # we did e-mail the maintainer of all of this stuff @redhat but got no
120 #%%global _use_internal_dependency_generator 0
122 %if 0%{?rhel} > 7 || 0%{?fedora} > 33
123 ## SUSE uses another tool for provides:
124 ## https://github.com/openSUSE/kernel-source/blob/master/patches.rpmify/Add-ksym-provides-tool.patch
125 %global __find_provides %{_sourcedir}/find-provides
128 # Set the package name prefix
129 %if %{undefined lustre_name}
131 %global lustre_name lustre
133 %global lustre_name lustre-client
137 %if %{with lustre_modules}
138 %if %{undefined kmoddir}
139 %if %{defined kernel_module_package_moddir}
140 %global kmoddir %{kernel_module_package_moddir}
142 %if %{defined suse_kernel_module_package}
143 %global kmoddir updates
145 %global kmoddir extra
150 %global modules_fs_path /lib/modules/%{_kver}/%{kmoddir}
151 # requires want to set a version including epoch
152 %global krequires %(echo %{kver} | sed -e 's/\.x86_64$//' -e 's/\.i[3456]86$//' -e 's/-smp$//' -e 's/-bigsmp$//' -e 's/[-.]ppc64$//' -e 's/\.aarch64$//' -e 's/-default$//' -e 's/-%{_flavor}//')
154 %if "%{_vendor}" == "redhat" || "%{_vendor}" == "fedora" || "%{_vendor}" == "openEuler"
155 %global requires_kmod_name kmod-%{lustre_name}
156 %global requires_kmod_osd_zfs_name kmod-%{lustre_name}-osd-zfs
157 %if %{with lustre_tests}
158 %global requires_kmod_tests_name kmod-%{lustre_name}-tests
160 %global requires_kmod_version %{version}
163 %global requires_kmod_name %{lustre_name}-kmp
164 %global requires_kmod_osd_zfs_name %{lustre_name}-osd-zfs-kmp
165 %if %{with lustre_tests}
166 %global requires_kmod_tests_name %{lustre_name}-tests-kmp
168 %if 0%{?suse_version} >= 1200
169 %global requires_kmod_version %{version}_k%(echo %{krequires} | sed -r 'y/-/_/; s/^(2\.6\.[0-9]+)_/\\1.0_/;')
171 %global requires_kmod_version %{version}_%(echo %{krequires} | sed -r 'y/-/_/; s/^(2\.6\.[0-9]+)_/\\1.0_/;')
176 # RHEL >= 7 comes with systemd
178 %define with_systemd 1
181 # Fedora >= 15 comes with systemd, but only >= 18 has
183 %if 0%{?fedora} >= 18
184 %define with_systemd 1
187 # opensuse >= 12.1 comes with systemd, but only >= 13.1
188 # has the proper macros
189 %if 0%{?suse_version} >= 1310
190 %define with_systemd 1
193 # openEuler comes with systemd
194 %if "%{_vendor}" == "openEuler"
195 %define with_systemd 1
198 # Detect when mlnx-ofa_kernel-devel contents exist and mofed_source to 0
199 %define mofed_src_path $(echo %{?configure_args} | tr ' ' '\\n' | grep -- '--with-o2ib=' | cut -c 13-)
200 %define mofed_source %(test -f %mofed_src_path/Module.symvers; echo $?)
201 # Update the search path for mofed_scripts
202 %if 0%{?mofed_source} > 0
203 %define mofed_default_path /usr/src/ofa_kernel/
205 %define mofed_default_path %{mofed_src_path}
208 %{!?mpi_name: %global mpi_name openmpi}
210 Summary: Lustre File System
214 License: GPL-2.0-only AND LGPL-2.1-or-later
215 %if 0%{?suse_version} >= 1310
216 # SUSE needs Group for the kernel_module_package macro
219 Source: lustre-%{version}.tar.gz
220 Source1: kmp-lustre.preamble
221 Source2: kmp-lustre.files
222 Source3: kmp-lustre-osd-ldiskfs.preamble
223 Source4: kmp-lustre-osd-ldiskfs.files
224 Source5: kmp-lustre-osd-zfs.preamble
225 Source6: kmp-lustre-osd-zfs.files
226 Source7: kmp-lustre-tests.preamble
227 Source8: kmp-lustre-tests.files
228 Source9: find-provides
229 Source10: find-provides.ksyms
230 Source11: kmp-lnet-socklnd.preamble
231 Source12: kmp-lnet-socklnd.files
232 Source13: kmp-lnet-o2iblnd.preamble
233 Source14: kmp-lnet-o2iblnd.files
234 Source15: kmp-lnet-gnilnd.preamble
235 Source16: kmp-lnet-gnilnd.files
236 Source17: kmp-lnet-kfilnd.preamble
237 Source18: kmp-lnet-kfilnd.files
238 Source19: kmp-lnet-in-kernel-o2iblnd.preamble
239 Source20: kmp-lnet-in-kernel-o2iblnd.files
240 URL: https://wiki.whamcloud.com/
241 BuildRoot: %{_tmppath}/lustre-%{version}-root
242 %if %{with lustre_modules}
243 Requires: %{requires_kmod_name} = %{requires_kmod_version}
245 %if %{with lustre_tests_lutf}
246 Requires: python3 >= 3.6.0
247 BuildRequires: python3-devel >= 3.6.0, swig
249 BuildRequires: libtool pkgconfig(yaml-0.1) pkgconfig(zlib) pkgconfig(libnl-3.0) flex bison
250 %if "%{_vendor}" == "redhat"
251 BuildRequires: redhat-rpm-config
252 BuildRequires: pkgconfig
253 %if 0%{?rhel} > 7 || 0%{?fedora} > 33 || 0%{?rhel} < 1
254 Suggests: bash-completion
257 %if "%{_vendor}" == "openEuler"
258 BuildRequires: openEuler-rpm-config
260 BuildRequires: kernel-debugsource
263 BuildRequires: pkg-config
266 BuildRequires: krb5-devel openssl-devel
268 %if %{with lustre_modules}
269 # abuild (auto-build) used by SUSE Open Build Service needs kernel-source as
270 # a build requirement, but the code which extracts these requirements does not
271 # understand the percent-open-close-paren construct aka %%()
272 # [NOTE: a percent abovie is doubled to avoid yet another rpmbuild warning]
273 # such occurances as failures. So the following dance allows the requirements
274 # to be seen by abuild, but ignored by lbuild.
275 %if "%(echo $USER)" != "abuild"
277 BuildRequires: kernel-source
281 Requires: %{name}-osd
282 Requires: %{name}-osd-mount
283 Obsoletes: lustre-server < %{version}
284 Provides: lustre-server = %{version}-%{release}
286 Obsoletes: lustre-client < %{version}
287 Provides: lustre-client = %{version}-%{release}
288 %if "%{_vendor}" == "redhat" || "%{_vendor}" == "fedora" || "%{_vendor}" == "openEuler"
289 #suse don't support selinux
290 BuildRequires: pkgconfig(libselinux)
292 %if %{with lustre_modules}
294 %if 0%{?mofed_source} > 0
295 BuildRequires: mlnx-ofa_kernel-devel
297 %if %{with multiple_lnds}
298 %if "%{_vendor}" == "redhat" || "%{_vendor}" == "openEuler"
299 Requires: kmod-mlnx-ofa_kernel
301 Requires: mlnx-ofa_kernel-kmp
305 %if 0%{?rhel} >= 8 || "%{_vendor}" == "openEuler"
306 BuildRequires: kernel-rpm-macros
308 %if 0%{?suse_version} >= 1530
309 BuildRequires: rpm-build >= 4.14.3
311 BuildRequires: %kernel_module_package_buildreqs
312 # need to provide a /usr/lib/${uname -r)/build dir
313 BuildRequires: kernel >= 3.10
314 %if "%{_vendor}" == "redhat"
316 BuildRequires: kernel-abi-whitelists
322 Requires(post): systemd
323 Requires(preun): systemd
324 Requires(postun): systemd
325 BuildRequires: pkgconfig(systemd)
329 Userspace tools and files for the Lustre file system.
331 %if %{with lustre_modules}
333 # until we have achieved full kABI compatibility we need to
334 # restrict the kernel range that can be used to the kernel
335 # version from the RHEL minor release
336 # this is supposed to be done for kmods automatically but
337 # RHBZ#1467319 seems to be getting in the way
338 # this is true for el7.0 through el7.4
339 %define preamble %{expand:%(
341 cat %{SOURCE1} > $TMPFILE
342 kver=%{kernel_version}
343 linuxversion=${kver%%%%-*}
344 linuxrelease=${kver##*-}
345 kabiminor=${linuxrelease%%%%.*}
346 echo "Requires: kernel < $linuxversion-$((kabiminor+1)), kernel >= $linuxversion-$((kabiminor))" >> $TMPFILE
350 %define preamble %{SOURCE1}
352 %kernel_module_package -n %{name} -p %preamble -f %SOURCE2 %{_flavor}
355 %kernel_module_package -n %{name}-osd-ldiskfs -p %SOURCE3 -f %SOURCE4 %{_flavor}
356 %if %{with lustre_utils}
357 %package osd-ldiskfs-mount
358 Summary: Lustre mount's ldiskfs-specific helper library
359 BuildRequires: e2fsprogs-devel >= 1.44.3 pkgconfig(mount)
360 Requires: ldiskfsprogs > 1.45.6
361 Provides: lustre-osd-mount = %{version}
362 Provides: %{name}-osd-mount = %{version}
363 Obsoletes: %{name}-osd-mount < %{version}
364 Obsoletes: lustre-osd-mount < %{version}
366 %description osd-ldiskfs-mount
367 Provide a shared library (dso) that can be loaded into various
368 lustre tools (mount/mkfs) to provide support for ldisfs
376 %global confzfsdobjpath %(echo '%configure_args' | grep -q -- --with-zfs-obj= ; echo $?)
377 %kernel_module_package -n %{name}-osd-zfs -p %SOURCE5 -f %SOURCE6 %{_flavor}
378 %if %{with lustre_utils}
379 %package osd-zfs-mount
380 Summary: Lustre mount's zfs-specific helper library
381 BuildRequires: pkgconfig(mount)
382 Provides: %{name}-osd-mount = %{version}
383 Obsoletes: lustre-osd-mount < %{version}
384 %if 0%{confzfsdobjpath} != 0
385 BuildRequires: (libzfs-devel or libzfs4-devel or libzfs5-devel)
387 # end confzfsdobjpath
388 # Tests also require zpool from zfs package:
390 Requires: %{requires_kmod_osd_zfs_name}
391 Provides: %{name}-osd-mount = %{version}
392 Provides: %{name}-osd-zfs-mount = %{version}
393 Requires: %{name}-osd-zfs = %{version}
395 %description osd-zfs-mount
396 Provide a shared library (dso) that can be loaded into various
397 lustre tools (mount/mkfs) to provide support for ZFS.
403 # with lustre_modules
407 %package resource-agents
408 Summary: HA Resuable Cluster Resource Scripts for Lustre
410 Requires: resource-agents
412 %description resource-agents
413 A set of scripts to operate Lustre resources in a High Availablity
414 environment for both Pacemaker and rgmanager.
418 Summary: Lustre include headers
419 Provides: lustre-devel = %{version}
420 Requires: %{lustre_name} = %{version}
421 %if %{with lustre_modules}
422 Requires: %{requires_kmod_name} = %{requires_kmod_version}
426 This package contains the header files needed for building additional
427 applications against the Lustre / LNet utilities libraries.
429 :> lustre-devel.files
431 %if %{with lustre_tests}
433 Summary: Lustre testing framework
434 Provides: %{name}-tests = %{version}
435 %if %{with lustre_iokit}
436 Requires: %{name} = %{version}, lustre-iokit
438 Requires: %{name} = %{version}
440 Requires: lustre-devel = %{version}
441 %if 0%{?rhel} >= 8 || 0%{?suse_version} >= 1500
442 Requires: python3 >= 3.6.0, python3-PyYAML
444 %if %{with lustre_modules}
445 Requires: %{requires_kmod_name} = %{requires_kmod_version}
446 Requires: %{requires_kmod_tests_name} = %{requires_kmod_version}
448 %if %{with lustre_tests_lutf}
449 Requires: python3 >= 3.6.0
451 Requires: attr, rsync, lsof, /usr/bin/getconf
452 Requires: /usr/sbin/getenforce, acl, /usr/bin/killall, /usr/bin/ping, bc
453 # Of the supported targets, only rhel7 doesn't support Recommends.
454 %if 0%{?rhel} > 7 || 0%{?fedora} > 33 || 0%{?rhel} < 1
455 Recommends: perl, dbench, iozone
456 # Either of these is sufficient
457 Suggests: pdsh, clush
460 %if "%{mpi_name}" == "mpich"
461 BuildRequires: mpich-devel
463 %if "%{mpi_name}" == "openmpi"
464 %if "%{_vendor}" == "redhat" || "%{_vendor}" == "openEuler" || 0%{?suse_version} < 1500
465 BuildRequires: openmpi-devel
467 BuildRequires: openmpi2-devel
475 This package contains a set of test binaries and scripts that are intended
476 to be used by the Lustre testing framework.
478 %if %{with lustre_modules}
479 %kernel_module_package -n %{name}-tests -p %SOURCE7 -f %SOURCE8 %{_flavor}
483 %if %{with multiple_lnds}
484 # begin multiple_lnds
485 %kernel_module_package -n %{name}-lnet-socklnd -p %SOURCE11 -f %SOURCE12 %{_flavor}
487 ## re-write post/preun generated by kmodtool [ls -s and rm -f]
488 %define inkernmod %{modules_fs_path}/%{lustre_name}/net/in-kernel-ko2iblnd.ko
489 %define inkernsym %{modules_fs_path}/%{lustre_name}/net/ko2iblnd.ko
490 %define ofed_module_package %{expand:%(
493 %kernel_module_package -n %{name}-lnet-in-kernel-o2iblnd -p %SOURCE19 -f %SOURCE20 %{_flavor}
495 sed -i -e '/^%%post.*/a ln -sf %{inkernmod} %{inkernsym}' -e '/^%%preun.*/a rm -f %{inkernsym}' $TMPFILE
498 %{expand:%(cat '%{ofed_module_package}')}
501 %kernel_module_package -n %{name}-lnet-o2iblnd -p %SOURCE13 -f %SOURCE14 %{_flavor}
504 %kernel_module_package -n %{name}-lnet-gnilnd -p %SOURCE15 -f %SOURCE16 %{_flavor}
507 %kernel_module_package -n %{name}-lnet-kfilnd -p %SOURCE17 -f %SOURCE18 %{_flavor}
512 %if %{with lustre_iokit}
513 %package -n lustre-iokit
514 Summary: Collection of benchmark tools for a cluster with the Lustre file system
516 %if 0%{?rhel} > 7 || 0%{?fedora} > 33 || 0%{?rhel} < 1
520 %description -n lustre-iokit
521 This package includes five tools:
523 A test of the 'bare metal' performance, bypassing as much of the kernel as we can. Uses the sgp_dd utility.
526 This survey can be run in 3 modes to test disk I/O including the filesystem,
527 network I/O, and disk I/O via the network. The script does sequential I/O
528 with varying numbers of threads and objects (files) by using lctl::test_brw
529 to drive the echo_client connected to local or remote obdfilter instances,
530 or remote obdecho instances.
533 This survey tests the client-to-disk performance of individual OSTs, and
534 ranks then for comparison.
537 This script will collect IO stats on a defined set of nodes.
540 A script to run the IOR benchmark. The latest version can be downloaded from
541 https://github.com/hpc/ior/
544 This survey tests the local metadata performance using the echo_client to drive
545 the MDD layer to perform operations. It is run with multiple threads (to
546 simulate MDT service threads) locally on the MDS node, and does not need Lustre
547 clients in order to run
550 This survey tests LNet performance between a group of clients and servers.
553 %if 0%{?suse_version}
557 %setup -qn lustre-%{version}
558 ln lustre/ChangeLog ChangeLog-lustre
559 ln lnet/ChangeLog ChangeLog-lnet
562 # Set an explicit path to our Linux tree, if we can.
563 cd $RPM_BUILD_DIR/lustre-%{version}
565 # Store the CFLAGS and LDFLAGS that would normally be used in the UTILS_CFLAGS
566 # and UTILS_LDFLAGS environment variables so that we use can them when compiling
567 # the user-space code in lustre/utils and lnet/utils. As of RHEL 8.0, the
568 # __global_* variants are deprecated in favour of build_cflags, etc. If neither
569 # style is available (e.g. on SLES), then these just end up as empty strings.
570 export UTILS_CFLAGS="%{?build_cflags:%{build_cflags}}%{!?build_cflags:%{?__global_cflags:%{__global_cflags}}}"
571 export UTILS_LDFLAGS="%{?build_ldflags:%{build_ldflags}}%{!?build_ldflags:%{?__global_ldflags:%{__global_ldflags}}}"
573 # RHEL7 on PPC64 needs __SANE_USERSPACE_TYPES__ defined so that __s64 and __u64
574 # are presented to user-land as long long instead of long long. Without this it
575 # will fail the format check whenever such a variable is printed.
578 export UTILS_CFLAGS="${UTILS_CFLAGS} -D__SANE_USERSPACE_TYPES__=1"
582 # Disable any hardening or annotation since this doesn't make sense for
583 # kernel code, and reset "optflags" so that the vendor's overzealous flags don't
584 # create build failures.
585 %define optflags -g -O2 -Werror
586 %undefine _annotated_build
587 %undefine _hardened_build
589 CONFIGURE_ARGS="%{?configure_args}"
590 if [ -n "$CONFIGURE_ARGS" ]; then
591 # make sure %%kdir and %%kobjdir are not in the configure arguments
592 CONFIGURE_ARGS=$(echo $CONFIGURE_ARGS | sed -e 's/"\?--with-linux=[^ ][^ ]* \?//')
593 CONFIGURE_ARGS=$(echo $CONFIGURE_ARGS | sed -e 's/"\?--with-linux-obj=[^ ][^ ]* \?//')
594 # remove --with-kmp-moddir from configure arguments,
595 # it will be set --with-kmp-moddir=%%kmoddir
596 CONFIGURE_ARGS=$(echo $CONFIGURE_ARGS | sed -e 's/"\?--with-kmp-moddir=[^ ][^ ]* \?//')
597 # remove env variables from config cache built by initial configure,
598 # and create dedicated cache in temporary build directory
599 if [ -f "$CONFIG_CACHE_FILE" ]; then
600 TMP_CONFIG_CACHE="$(mktemp --tmpdir newconfig-XXXXXXXX.cache)"
601 sed -e "/ac_cv_env/d" \
602 -e "/am_cv_CC_dependencies_compiler_type/d" \
603 -e "/lb_cv_mpi_tests/d" \
604 "$CONFIG_CACHE_FILE" > $TMP_CONFIG_CACHE
605 CONFIGURE_ARGS="$CONFIGURE_ARGS --cache-file=$TMP_CONFIG_CACHE"
609 # we need to eval "configure" because $CONFIGURE_ARGS could have a quoted
610 # string in it which we don't want word splitted by the shell
611 # also remove (build|host|target) options because they will be specified
612 # inside $CONFIGURE_ARGS
613 # kmod tools/scripts require "name" directory with kernel modules
616 %define _configure eval ./configure
617 %define eval_configure %configure
619 %define eval_configure %(echo -n '%configure' | sed -e 's#\./configure#eval ./configure#' -e 's/--\\(build\\|host\\|target\\)=[^ ][^ ]* //g')
623 %if "%{mpi_name}" == "mpich"
626 %if "%{mpi_name}" == "openmpi"
634 o2ib_path=$(find %{mofed_default_path} -type d -name ofed_scripts | xargs dirname)
635 if [ -z "$o2ib_path" ]; then
636 echo "ERROR: could not find OFED devel headers"
639 if [ $(echo $o2ib_path | wc -w) -ge 2 ]; then
640 echo "ERROR: multiple OFED versions installed"
643 WITH_O2IB="--with-o2ib=${o2ib_path}"
646 WITH_O2IB="--with-o2ib=no"
650 %eval_configure $CONFIGURE_ARGS \
651 %{?with_lustre_tests:--enable-tests}%{!?with_lustre_tests:--disable-tests} \
652 %{?with_lustre_utils:--enable-utils}%{!?with_lustre_utils:--disable-utils} \
653 %{?with_lustre_modules:--enable-modules}%{!?with_lustre_modules:--disable-modules} \
654 %{!?with_shared:--disable-shared} \
655 %{!?with_static:--disable-static} \
656 %{!?with_lustre_iokit:--disable-iokit} \
657 %{!?with_ldiskfs:--disable-ldiskfs} \
658 %{!?with_servers:--disable-server} \
659 %{!?with_zfs:--without-zfs} \
660 %{!?with_gss:--disable-gss} \
661 %{!?with_gss_keyring:--disable-gss-keyring} \
662 %{!?with_manpages:--disable-manpages} \
663 %{!?with_systemd:--with-systemdsystemunitdir=no} \
664 %{?with_systemd:--with-systemdsystemunitdir=%{_unitdir}} \
665 %{?with_multiple_lnds:--enable-multiple-lnds} \
666 %{?with_kfi:--with-kfi=/usr/src/cray-kfabric/default} \
667 %{?with_gni:--enable-gni} \
669 --with-linux=%{kdir} \
670 --with-linux-obj=%{kobjdir} \
671 --with-kmp-moddir=%{kmoddir}/%{name}
674 if ! grep -q define[[:space:]]*HAVE_SERVER_SUPPORT config.h 2> /dev/null; then
675 echo "Error: Server Support configured but not found"
680 make %{?_smp_mflags} -s %{?make_args}
683 %if "%{mpi_name}" == "mpich"
686 %if "%{mpi_name}" == "openmpi"
695 %if "%{mpi_name}" == "mpich"
698 %if "%{mpi_name}" == "openmpi"
704 make install DESTDIR=$RPM_BUILD_ROOT
706 %if %{with lustre_modules}
707 # RHEL's kernel_module_path macro expects that all the modules
708 # in a kmod package will be in modules_fs_path/<sub packagename>
709 # but Lustre installs all of the modules in a single pass into
710 # a shared location. Since this is a restriction imposed by
711 # RHEL, we handle this here in the spec file rather than in
712 # Lustre's build system. This is not expected to bother SLES's
713 # kernel_module_path macro.
714 basemodpath=$RPM_BUILD_ROOT%{modules_fs_path}/%{name}
715 %{__install} -D -m 0644 ${PWD}/Module.symvers %{buildroot}/Module.symvers
717 mkdir -p $basemodpath-osd-ldiskfs/fs
718 mv $basemodpath/fs/osd_ldiskfs.ko $basemodpath-osd-ldiskfs/fs/osd_ldiskfs.ko
719 mv $basemodpath/fs/ldiskfs.ko $basemodpath-osd-ldiskfs/fs/ldiskfs.ko
722 mkdir -p $basemodpath-osd-zfs/fs
723 mv $basemodpath/fs/osd_zfs.ko $basemodpath-osd-zfs/fs/osd_zfs.ko
725 %if %{with lustre_tests}
726 mkdir -p $basemodpath-tests/fs
727 mv $basemodpath/fs/llog_test.ko $basemodpath-tests/fs/llog_test.ko
728 mv $basemodpath/fs/obd_test.ko $basemodpath-tests/fs/obd_test.ko
729 mkdir -p $RPM_BUILD_ROOT%{_libdir}/lustre/tests/kernel/
730 mv $basemodpath/fs/kinode.ko $RPM_BUILD_ROOT%{_libdir}/lustre/tests/kernel/
735 if [ -d $RPM_BUILD_ROOT%{_libdir}/openmpi ] ; then
736 rm -fr $RPM_BUILD_ROOT%{_libdir}/openmpi
738 if [ -d $RPM_BUILD_ROOT%{_libdir}/mpich ] ; then
739 rm -fr $RPM_BUILD_ROOT%{_libdir}/mpich
745 %if %{with servers} && %{with lustre_utils}
746 # The .ha_v2 extension identifies the heartbeat resource agent as using
747 # legacy syntax. Install a compatibility symlink to avoid conflicts when
748 # newer-style agents are added.
749 ln -s Lustre.ha_v2 $RPM_BUILD_ROOT%{_sysconfdir}/ha.d/resource.d/Lustre
750 echo '%dir %{_sysconfdir}/ha.d' >>lustre.files
751 echo '%dir %{_sysconfdir}/ha.d/resource.d' >>lustre.files
752 echo '%{_sysconfdir}/ha.d/resource.d/Lustre.ha_v2' >>lustre.files
753 echo '%{_sysconfdir}/ha.d/resource.d/Lustre' >>lustre.files
756 # systemd is on redhat, fedora, and suse
758 echo '%{_unitdir}/lnet.service' >>lustre.files
761 %if "%{_vendor}" == "redhat" || "%{_vendor}" == "openEuler"
762 # The following scripts are Red Hat specific
764 echo '%{_sysconfdir}/init.d/lustre' >>lustre.files
765 echo '%{_sysconfdir}/sysconfig/lustre' >>lustre.files
766 %if %{with gss_keyring}
767 echo '%{_sysconfdir}/init.d/lsvcgss' >>lustre.files
768 echo '%config(noreplace) %{_sysconfdir}/sysconfig/lsvcgss' >>lustre.files
772 %if %{without systemd}
773 echo '%{_sysconfdir}/init.d/lnet' >>lustre.files
776 %if %{with gss_keyring}
777 echo '%config(noreplace) %{_sysconfdir}/request-key.d/lgssc.conf' >>lustre.files
780 # fc18 needs 'x' permission for library files
781 find $RPM_BUILD_ROOT -name \*.so -type f -exec chmod +x {} \;
783 rm -f $RPM_BUILD_ROOT%{_libdir}/liblnetconfig.la
785 echo '%attr(-, root, root) %{_libdir}/liblnetconfig.a' >>lustre.files
788 echo '%attr(-, root, root) %{_libdir}/liblnetconfig.so' >>lustre-devel.files
789 echo '%attr(-, root, root) %{_libdir}/liblnetconfig.so.*' >>lustre.files
793 echo '%{_libdir}/libiam.a' >>lustre.files
796 %if %{with lustre_utils}
797 mkdir -p $RPM_BUILD_ROOT/%{_datadir}/lustre
798 if [ -d $RPM_BUILD_ROOT%{_libdir}/lustre ] ; then
799 find $RPM_BUILD_ROOT%{_libdir}/@PACKAGE@ -name \*.la -type f -exec rm -f {} \;
803 echo '%{_prefix}/lib/firewalld/services/*.xml' >>lustre.files
804 %if %{with lustre_modules}
805 # mark modules executable for find-debuginfo.sh
806 find $RPM_BUILD_ROOT/lib/modules -name \*.ko -type f -exec chmod u+x {} \;
809 rm -f $RPM_BUILD_ROOT%{_libdir}/liblustreapi.la
811 %if %{with lustre_tests}
812 :> lustre-tests.files
814 %if "%{mpi_name}" == "mpich"
817 %if "%{mpi_name}" == "openmpi"
822 echo '%dir %{_libdir}/lustre' >>lustre-tests.files
823 echo '%dir %{_libdir}/lustre/tests' >>lustre-tests.files
824 echo '%{_libdir}/lustre/tests/*' >>lustre-tests.files
825 echo '%{_bindir}/mcreate' >>lustre-tests.files
826 echo '%{_bindir}/statx' >>lustre-tests.files
827 echo '%{_sbindir}/wirecheck' >>lustre-tests.files
828 echo '%{_sbindir}/wiretest' >>lustre-tests.files
829 if [ -n "$MPI_BIN" ]; then
830 echo "$MPI_BIN/*" >>lustre-tests.files
832 %if %{with lustre_tests_lutf}
833 echo '%{_libdir}/lustre/tests/lutf/*' >>lustre-tests.files
837 %if %{with lustre_tests_lutf}
838 echo '%{_libdir}/lustre/tests/lutf/*' >>lustre-tests.files
841 %files devel -f lustre-devel.files
842 %defattr(-,root,root)
843 %{_libdir}/pkgconfig/lustre.pc
845 %{_libdir}/liblustreapi.a
848 %{_libdir}/liblustreapi.so
850 %{_includedir}/lustre
851 %if %{with lustre_modules}
852 %{_includedir}/linux/lnet
853 %{_includedir}/linux/lustre
855 %exclude %{_includedir}/linux/lnet
856 %exclude %{_includedir}/linux/lustre
859 %files -f lustre.files
860 %defattr(-,root,root)
862 %if %{with lustre_tests}
863 %exclude %{_sbindir}/wirecheck
864 %exclude %{_sbindir}/wiretest
867 %exclude %{_sbindir}/zfsobj2fid
869 %if %{with lustre_utils}
871 %dir %{_libexecdir}/lustre
872 %{_libexecdir}/lustre/lc_common
873 %{_libexecdir}/lustre/haconfig
874 %{_bindir}/lustre_req_history
875 %{_bindir}/remove_changelog
876 %{_bindir}/remove_updatelog
882 %{_bindir}/plot-llstat
886 %{_bindir}/lfs_migrate
889 /sbin/mount.lustre_tgt
891 @BASH_COMPLETION_DIR@
899 %{_libdir}/liblustreapi.so.*
901 %{_udevrulesdir}/99-lustre.rules
903 %{_udevrulesdir}/99-lustre-server.rules
906 %config(noreplace) %{_sysconfdir}/ldev.conf
908 %config(noreplace) %{_sysconfdir}/lnet.conf
909 %config(noreplace) %{_sysconfdir}/modprobe.d/ko2iblnd.conf
910 %if %{with lustre_utils}
911 %config(noreplace) %{_sysconfdir}/lnet_routes.conf
913 %if %{with lustre_modules}
914 %exclude /Module.symvers
917 %if %{with lustre_utils}
918 %files osd-ldiskfs-mount
919 %defattr(-,root,root)
920 %dir %{_libdir}/@PACKAGE@
921 %{_libdir}/@PACKAGE@/mount_osd_ldiskfs.so
928 %if %{with lustre_utils}
930 %defattr(-,root,root)
931 %dir %{_libdir}/@PACKAGE@
932 %{_libdir}/@PACKAGE@/mount_osd_zfs.so
933 %{_sysconfdir}/zfs/zed.d/*
938 # with lustre_modules
942 %files resource-agents
943 %defattr(0755,root,root)
944 %dir %{_prefix}/lib/ocf
945 %dir %{_prefix}/lib/ocf/resource.d
946 %{_prefix}/lib/ocf/resource.d/lustre/
949 %if %{with lustre_tests}
950 %files tests -f lustre-tests.files
951 %defattr(-,root,root)
954 %if %{with lustre_iokit}
955 %files -n lustre-iokit
956 %defattr(-, root, root)
957 %{_bindir}/iokit-config
958 %{_bindir}/iokit-gather-stats
960 %{_bindir}/iokit-libecho
961 %{_bindir}/iokit-lstats
962 %{_bindir}/iokit-parse-ior
963 %{_bindir}/iokit-plot-obdfilter
964 %{_bindir}/iokit-plot-ost
965 %{_bindir}/iokit-plot-sgpdd
966 %{_bindir}/ior-survey
967 %{_bindir}/mds-survey
968 %{_bindir}/obdfilter-survey
969 %{_bindir}/ost-survey
970 %{_bindir}/sgpdd-survey
971 %{_bindir}/lst-survey
973 %doc lustre-iokit/ior-survey/README.ior-survey
974 %doc lustre-iokit/mds-survey/README.mds-survey
975 %doc lustre-iokit/obdfilter-survey/README.obdfilter-survey
976 %doc lustre-iokit/ost-survey/README.ost-survey
977 %doc lustre-iokit/sgpdd-survey/README.sgpdd-survey
978 %doc lustre-iokit/stats-collect/README.iokit-lstats
979 %doc lustre-iokit/lst-survey/README.lst-survey
984 %systemd_post lnet.service
989 %systemd_preun lnet.service
994 %systemd_postun_with_restart lnet.service
998 rm -rf $RPM_BUILD_ROOT
999 rm -rf %{_tmppath}/kmp