Whamcloud - gitweb
LU-17025 llapi: Verify stripe pool name
[fs/lustre-release.git] / lustre.spec.in
1 # SPDX-License-Identifier: GPL-2.0
2
3 #
4 # This file is part of Lustre, http://www.lustre.org/
5 #
6 # lustre.spec.in
7 #
8 # spec file template for RHEL package builds
9 #
10
11 # Declare rpmbuild --with/--without parameters
12 %bcond_without servers
13 %bcond_without ldiskfs
14 %bcond_with zfs
15 %bcond_without lustre_tests
16 %bcond_without lustre_utils
17 %bcond_without lustre_iokit
18 %bcond_without lustre_modules
19 %bcond_with gss
20 %bcond_with gss_keyring
21 %bcond_without manpages
22 %bcond_without shared
23 %bcond_without static
24 %bcond_with    systemd
25 %bcond_with mofed
26 %bcond_without mpi
27 %bcond_with kabi
28
29 # LUTF Turn off brp-python-precompile script as we don't want the python files
30 # to be compiled on installation
31 %global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g')
32
33 # By default both gss and gss keyring are disabled.
34 # gss keyring requires the gss core. If the builder
35 # request gss_keyring we must enable gss core even if
36 # the builder attempts to disable gss.
37 %if %{with gss_keyring}
38     %define with_gss 1
39 %endif
40
41 %if %{without servers}
42     # --without servers overrides --with {ldiskfs|zfs}
43     # so undefine the internal variables set by bcond_*
44     %undefine with_ldiskfs
45     %undefine with_zfs
46 %endif
47
48 %if %{without shared} && %{without static}
49 # need exit to stop build because error only displays a message
50 %{error: you can't disable both library types}
51 %{exit 1}
52 %endif
53
54 # lustre_tests depends on lustre_utils
55 %if %{without lustre_utils}
56 %undefine with_lustre_tests
57 %endif
58
59 %{!?version: %global version @VERSION@}
60 # if you want a custom kernel version set it variable with $ver.$arch
61 %{!?kver:    %global kver    %(uname -r)}
62 # cut epoch for kmodtool
63 %define _kver %(echo %{kver} | sed -e 's/^[0-9]*://')
64 # trust version from kdir - but it can lost 'epoch'
65 %if %{defined kdir}
66         %define _take_kver 1
67 %endif
68 %if %{defined kobjdir}
69         %define _take_kobj 1
70 %endif
71 %{!?kdir:    %global kdir    /lib/modules/%{_kver}/source}
72 %{!?kobjdir: %global kobjdir %(if [ "%{kdir}" = "/lib/modules/%{_kver}/source" ]; then echo "/lib/modules/%{_kver}/build"; else echo "%{kdir}"; fi)}
73
74 %if 0%{?suse_version} >= 1310 && %{defined _take_kobj}
75         %global _flavor %(echo %{_kver} | sed -e 's/^.*-//')
76 %else
77         %global _flavor default
78 %endif
79
80 %if %{defined _take_kver}
81 # as an alternative to this implementation we could simply "make -C $kdir kernelversion"
82 %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)
83 %define _kver %kver
84 %endif
85
86 # We set this because kernel_module_package has its own method of identifying
87 # which kernel to build against, and it is unlikely that its decision will
88 # match with Lustre's method of selecting which kernel to build against.
89 # By setting this variable, we override kernel_module_package's kernel
90 # selection with our selection.
91 # kmodtool failed to take a version if epoch set
92 %global kernel_version %_kver
93
94 # in order to get kernel symset and/or kernel module dependencies into
95 # the RPM, in order to support weak-modules, the internal dependency gen-
96 # erator needs to be disabled
97 # this is done with (reduce the double % down to a single %):
98 #
99 # %%global _use_internal_dependency_generator 0
100 #
101 # on SLES10, /usr/lib/rpm/macros already sets this, so no harm in also
102 # defining it here (until Suse changes their mind)
103 #
104 # on RHEL5, however, we do need to explicitly disable the internal dep-
105 # endency generator and allow the external one be used
106 # but since RedHat's kABI is only a subset of the total kernel ABI, it
107 # doesn't include all of the symbols we (or OFED for that matter) need
108 # until RedHat includes all of the symbols we need in their symsets we
109 # cannot support weak-modules
110 # we did e-mail the maintainer of all of this stuff @redhat but got no
111 # response from them
112 #%%global _use_internal_dependency_generator 0
113
114 %if 0%{?rhel} > 7 || 0%{?fedora} > 33
115 ## SUSE uses another tool for provides:
116 ## https://github.com/openSUSE/kernel-source/blob/master/patches.rpmify/Add-ksym-provides-tool.patch
117 %global __find_provides   %{_sourcedir}/find-provides
118 %endif
119
120 # Set the package name prefix
121 %if %{undefined lustre_name}
122     %if %{with servers}
123         %global lustre_name lustre
124     %else
125         %global lustre_name lustre-client
126     %endif
127 %endif
128
129 %if %{with lustre_modules}
130 %if %{undefined kmoddir}
131     %if %{defined kernel_module_package_moddir}
132         %global kmoddir %{kernel_module_package_moddir}
133     %else
134         %if %{defined suse_kernel_module_package}
135             %global kmoddir updates
136         %else
137             %global kmoddir extra
138         %endif
139     %endif
140 %endif
141
142 %global modules_fs_path /lib/modules/%{_kver}/%{kmoddir}
143 # requires want to set a version including epoch
144 %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}//')
145
146 %if "%{_vendor}" == "redhat" || "%{_vendor}" == "fedora" || "%{_vendor}" == "openEuler"
147         %global requires_kmod_name kmod-%{lustre_name}
148         %global requires_kmod_osd_zfs_name kmod-%{lustre_name}-osd-zfs
149         %if %{with lustre_tests}
150                 %global requires_kmod_tests_name kmod-%{lustre_name}-tests
151         %endif
152         %global requires_kmod_version %{version}
153 #for Suse
154 %else
155         %global requires_kmod_name %{lustre_name}-kmp
156         %global requires_kmod_osd_zfs_name %{lustre_name}-osd-zfs-kmp
157         %if %{with lustre_tests}
158                 %global requires_kmod_tests_name %{lustre_name}-tests-kmp
159         %endif
160         %if 0%{?suse_version} >= 1200
161                 %global requires_kmod_version %{version}_k%(echo %{krequires} | sed -r 'y/-/_/; s/^(2\.6\.[0-9]+)_/\\1.0_/;')
162         %else
163                 %global requires_kmod_version %{version}_%(echo %{krequires} | sed -r 'y/-/_/; s/^(2\.6\.[0-9]+)_/\\1.0_/;')
164         %endif
165 %endif
166 %endif
167
168 # RHEL >= 7 comes with systemd
169 %if 0%{?rhel} >= 7
170 %define with_systemd 1
171 %endif
172
173 # Fedora >= 15 comes with systemd, but only >= 18 has
174 # the proper macros
175 %if 0%{?fedora} >= 18
176 %define with_systemd 1
177 %endif
178
179 # opensuse >= 12.1 comes with systemd, but only >= 13.1
180 # has the proper macros
181 %if 0%{?suse_version} >= 1310
182 %define with_systemd 1
183 %endif
184
185 # openEuler comes with systemd
186 %if "%{_vendor}" == "openEuler"
187 %define with_systemd 1
188 %endif
189
190 %{!?mpi_name: %global mpi_name openmpi}
191
192 Summary: Lustre File System
193 Name: %{lustre_name}
194 Version: %{version}
195 Release: 1%{?dist}
196 License: GPL-2.0-only AND LGPL-2.1-or-later
197 %if 0%{?suse_version} >= 1310
198 # SUSE needs Group for the kernel_module_package macro
199 Group: System/Kernel
200 %endif
201 Source: lustre-%{version}.tar.gz
202 Source1: kmp-lustre.preamble
203 Source2: kmp-lustre.files
204 Source3: kmp-lustre-osd-ldiskfs.preamble
205 Source4: kmp-lustre-osd-ldiskfs.files
206 Source5: kmp-lustre-osd-zfs.preamble
207 Source6: kmp-lustre-osd-zfs.files
208 Source7: kmp-lustre-tests.preamble
209 Source8: kmp-lustre-tests.files
210 Source9: find-provides
211 Source10: find-provides.ksyms
212 URL: https://wiki.whamcloud.com/
213 BuildRoot: %{_tmppath}/lustre-%{version}-root
214 %if %{with lustre_modules}
215 Requires: %{requires_kmod_name} = %{requires_kmod_version}
216 %endif
217 %if %{with lustre_tests_lutf}
218 Requires: python3 >= 3.6.0
219 BuildRequires: python3-devel >= 3.6.0, swig
220 %endif
221 BuildRequires: libtool pkgconfig(yaml-0.1) pkgconfig(zlib) pkgconfig(libnl-3.0) flex bison
222 %if "%{_vendor}" == "redhat"
223 BuildRequires: redhat-rpm-config
224 BuildRequires: pkgconfig
225 %if 0%{?rhel} > 7 || 0%{?fedora} > 33 || 0%{?rhel} < 1
226 Suggests: bash-completion
227 %endif
228 %else
229 %if "%{_vendor}" == "openEuler"
230 BuildRequires: openEuler-rpm-config
231 %if %{with ldiskfs}
232 BuildRequires: kernel-debugsource
233 %endif
234 %endif
235 BuildRequires: pkg-config
236 %endif
237 %if %{with gss}
238 BuildRequires: krb5-devel openssl-devel
239 %endif
240 %if %{with lustre_modules}
241 # abuild (auto-build) used by SUSE Open Build Service
242 # need kernel-source as a build requirement, but the code
243 # which extracts these requirements don't understand %()
244 # and treats all such as failures.  So the following dance
245 # Allows the requirements to be seen by abuild, but ignored
246 # by lbuild.
247 %if "%(echo $USER)" != "abuild"
248 %else
249 BuildRequires: kernel-source
250 %endif
251 %endif
252 %if %{with servers}
253 Requires: %{name}-osd
254 Requires: %{name}-osd-mount
255 Obsoletes: lustre-server < %{version}
256 Provides: lustre-server = %{version}-%{release}
257 %endif
258 Obsoletes: lustre-client < %{version}
259 Provides: lustre-client = %{version}-%{release}
260 %if "%{_vendor}" == "redhat" || "%{_vendor}" == "fedora" || "%{_vendor}" == "openEuler"
261 #suse don't support selinux
262 BuildRequires: pkgconfig(libselinux)
263 %endif
264 %if %{with lustre_modules}
265 %if %{with mofed}
266 BuildRequires: mlnx-ofa_kernel-devel
267 %if "%{_vendor}" == "redhat" || "%{_vendor}" == "openEuler"
268 Requires: kmod-mlnx-ofa_kernel
269 %else
270 Requires: mlnx-ofa_kernel-kmp
271 %endif
272 %endif
273 %if 0%{?rhel} >= 8 || "%{_vendor}" == "openEuler"
274 BuildRequires: kernel-rpm-macros
275 %endif
276 %if 0%{?suse_version} >= 1530
277 BuildRequires: rpm-build >= 4.14.3
278 %endif
279 BuildRequires: %kernel_module_package_buildreqs
280 # need to provide a /usr/lib/${uname -r)/build dir
281 BuildRequires: kernel >= 3.10
282 %if "%{_vendor}" == "redhat"
283 %if %{with kabi}
284 BuildRequires: kernel-abi-whitelists
285 %endif
286 %endif
287 %endif
288
289 %if %{with systemd}
290 Requires(post): systemd
291 Requires(preun): systemd
292 Requires(postun): systemd
293 BuildRequires: pkgconfig(systemd)
294 %endif
295
296 %description
297 Userspace tools and files for the Lustre file system.
298
299 %if %{with lustre_modules}
300 %if 0%{?rhel} == 7
301 # until we have achieved full kABI compatibility we need to
302 # restrict the kernel range that can be used to the kernel
303 # version from the RHEL minor release
304 # this is supposed to be done for kmods automatically but
305 # RHBZ#1467319 seems to be getting in the way
306 # this is true for el7.0 through el7.4
307 %define preamble %{expand:%(
308 TMPFILE=`mktemp`
309 cat %{SOURCE1} > $TMPFILE
310 kver=%{kernel_version}
311 linuxversion=${kver%%%%-*}
312 linuxrelease=${kver##*-}
313 kabiminor=${linuxrelease%%%%.*}
314 echo "Requires:       kernel < $linuxversion-$((kabiminor+1)), kernel >= $linuxversion-$((kabiminor))" >> $TMPFILE
315 echo $TMPFILE
316 )}
317 %else
318 %define preamble %{SOURCE1}
319 %endif
320 %kernel_module_package -n %{name} -p %preamble -f %SOURCE2 %{_flavor}
321
322 %if %{with ldiskfs}
323 %kernel_module_package -n %{name}-osd-ldiskfs -p %SOURCE3 -f %SOURCE4 %{_flavor}
324 %if %{with lustre_utils}
325 %package osd-ldiskfs-mount
326 Summary: Lustre mount's ldiskfs-specific helper library
327 BuildRequires: e2fsprogs-devel >= 1.44.3 pkgconfig(mount)
328 Requires: ldiskfsprogs > 1.45.6
329 Provides: lustre-osd-mount = %{version}
330 Provides: %{name}-osd-mount = %{version}
331 Obsoletes: %{name}-osd-mount < %{version}
332 Obsoletes: lustre-osd-mount < %{version}
333
334 %description osd-ldiskfs-mount
335 Provide a shared library (dso) that can be loaded into various
336 lustre tools (mount/mkfs) to provide support for ldisfs
337
338 # with lustre_utils
339 %endif
340 # with ldiskfs
341 %endif
342
343 %if %{with zfs}
344 %kernel_module_package -n %{name}-osd-zfs -p %SOURCE5 -f %SOURCE6 %{_flavor}
345 %if %{with lustre_utils}
346 %package osd-zfs-mount
347 Summary: Lustre mount's zfs-specific helper library
348 BuildRequires: pkgconfig(mount)
349 Provides: %{name}-osd-mount = %{version}
350 Obsoletes: lustre-osd-mount < %{version}
351 # Tests also require zpool from zfs package:
352 Requires: zfs
353 Requires: %{requires_kmod_osd_zfs_name}
354
355 %description osd-zfs-mount
356 Provide a shared library (dso) that can be loaded into various
357 lustre tools (mount/mkfs) to provide support for ZFS.
358
359 # with lustre_utils
360 %endif
361 # with zfs
362 %endif
363 # with lustre_modules
364 %endif
365
366 %if %{with servers}
367 %package resource-agents
368 Summary: HA Resuable Cluster Resource Scripts for Lustre
369 Requires: %{name}
370 Requires: resource-agents
371
372 %description resource-agents
373 A set of scripts to operate Lustre resources in a High Availablity
374 environment for both Pacemaker and rgmanager.
375 %endif
376
377 %package devel
378 Summary: Lustre include headers
379 Provides: lustre-devel = %{version}
380 Requires: %{lustre_name} = %{version}
381 %if %{with lustre_modules}
382 Requires: %{requires_kmod_name} = %{requires_kmod_version}
383 %endif
384
385 %description devel
386 This package contains the header files needed for building additional
387 applications against the Lustre / LNet utilities libraries.
388
389 :> lustre-devel.files
390
391 %if %{with lustre_tests}
392 %package tests
393 Summary: Lustre testing framework
394 Provides: %{name}-tests = %{version}
395 %if %{with lustre_iokit}
396 Requires: %{name} = %{version}, lustre-iokit
397 %else
398 Requires: %{name} = %{version}
399 %endif
400 Requires: lustre-devel = %{version}
401 %if 0%{?rhel} >= 8 || 0%{?suse_version} >= 1500
402 Requires: python3 >= 3.6.0, python3-PyYAML
403 %endif
404 %if %{with lustre_modules}
405 Requires: %{requires_kmod_name} = %{requires_kmod_version}
406 Requires: %{requires_kmod_tests_name} = %{requires_kmod_version}
407 %endif
408 %if %{with lustre_tests_lutf}
409 Requires: python3 >= 3.6.0
410 %endif
411 Requires: attr, rsync, lsof, /usr/bin/getconf
412 Requires: /usr/sbin/getenforce, acl, /usr/bin/killall, /usr/bin/ping, bc
413 # Of the supported targets, only rhel7 doesn't support Recommends.
414 %if 0%{?rhel} > 7 || 0%{?fedora} > 33 || 0%{?rhel} < 1
415 Recommends: perl, dbench, iozone
416 # Either of these is sufficient
417 Suggests: pdsh, clush
418 %endif
419 %if %{with mpi}
420 %if "%{mpi_name}" == "mpich"
421 BuildRequires: mpich-devel
422 %endif
423 %if "%{mpi_name}" == "openmpi"
424 %if "%{_vendor}" == "redhat" || "%{_vendor}" == "openEuler" || 0%{?suse_version} < 1500
425 BuildRequires: openmpi-devel
426 %else
427 BuildRequires: openmpi2-devel
428 %endif
429 # openmpi
430 %endif
431 # mpi
432 %endif
433
434 %description tests
435 This package contains a set of test binaries and scripts that are intended
436 to be used by the Lustre testing framework.
437
438 %if %{with lustre_modules}
439 %kernel_module_package -n %{name}-tests -p %SOURCE7 -f %SOURCE8 %{_flavor}
440 %endif
441 %endif
442
443 %if %{with lustre_iokit}
444 %package -n lustre-iokit
445 Summary: Collection of benchmark tools for a cluster with the Lustre file system
446 Requires: sg3_utils
447 %if 0%{?rhel} > 7 || 0%{?fedora} > 33 || 0%{?rhel} < 1
448 Recommends: perl
449 %endif
450
451 %description -n lustre-iokit
452 This package includes five tools:
453 sgpdd-survey:
454 A test of the 'bare metal' performance, bypassing as much of the kernel as we can. Uses the sgp_dd utility.
455
456 obdfilter-survey
457 This survey can be run in 3 modes to test disk I/O including the filesystem,
458 network I/O, and disk I/O via the network.  The script does sequential I/O
459 with varying numbers of threads and objects (files) by using lctl::test_brw
460 to drive the echo_client connected to local or remote obdfilter instances,
461 or remote obdecho instances.
462
463 ost-survey
464 This survey tests the client-to-disk performance of individual OSTs, and
465 ranks then for comparison.
466
467 stats-collect
468 This script will collect IO stats on a defined set of nodes.
469
470 ior-survey:
471 A script to run the IOR benchmark. The latest version can be downloaded from
472 https://github.com/hpc/ior/
473
474 mds-survey:
475 This survey tests the local metadata performance using the echo_client to drive
476 the MDD layer to perform operations. It is run with multiple threads (to
477 simulate MDT service threads) locally on the MDS node, and does not need Lustre
478 clients in order to run
479
480 lst-survey:
481 This survey tests LNet performance between a group of clients and servers.
482 %endif
483
484 %if 0%{?suse_version}
485 %debug_package
486 %endif
487 %prep
488 %setup -qn lustre-%{version}
489 ln lustre/ChangeLog ChangeLog-lustre
490 ln lnet/ChangeLog ChangeLog-lnet
491
492 %build
493 # Set an explicit path to our Linux tree, if we can.
494 cd $RPM_BUILD_DIR/lustre-%{version}
495
496 # Store the CFLAGS and LDFLAGS that would normally be used in the UTILS_CFLAGS
497 # and UTILS_LDFLAGS environment variables so that we use can them when compiling
498 # the user-space code in lustre/utils and lnet/utils. As of RHEL 8.0, the
499 # __global_* variants are deprecated in favour of build_cflags, etc. If neither
500 # style is available (e.g. on SLES), then these just end up as empty strings.
501 export UTILS_CFLAGS="%{?build_cflags:%{build_cflags}}%{!?build_cflags:%{?__global_cflags:%{__global_cflags}}}"
502 export UTILS_LDFLAGS="%{?build_ldflags:%{build_ldflags}}%{!?build_ldflags:%{?__global_ldflags:%{__global_ldflags}}}"
503
504 # RHEL7 on PPC64 needs __SANE_USERSPACE_TYPES__ defined so that __s64 and __u64
505 # are presented to user-land as long long instead of long long. Without this it
506 # will fail the format check whenever such a variable is printed.
507 %if 0%{?rhel}
508 %ifarch ppc64
509 export UTILS_CFLAGS="${UTILS_CFLAGS} -D__SANE_USERSPACE_TYPES__=1"
510 %endif
511 %endif
512
513 # Disable any hardening or annotation since this doesn't make sense for
514 # kernel code, and reset "optflags" so that the vendor's overzealous flags don't
515 # create build failures.
516 %define optflags -g -O2 -Werror
517 %undefine _annotated_build
518 %undefine _hardened_build
519
520 CONFIGURE_ARGS="%{?configure_args}"
521 if [ -n "$CONFIGURE_ARGS" ]; then
522         # make sure %%kdir and %%kobjdir are not in the configure arguments
523         CONFIGURE_ARGS=$(echo $CONFIGURE_ARGS | sed -e 's/"\?--with-linux=[^ ][^ ]* \?//')
524         CONFIGURE_ARGS=$(echo $CONFIGURE_ARGS | sed -e 's/"\?--with-linux-obj=[^ ][^ ]* \?//')
525         # remove --with-kmp-moddir from configure arguments,
526         # it will be set --with-kmp-moddir=%%kmoddir
527         CONFIGURE_ARGS=$(echo $CONFIGURE_ARGS | sed -e 's/"\?--with-kmp-moddir=[^ ][^ ]* \?//')
528         # remove env variables from config cache built by initial configure,
529         # and create dedicated cache in temporary build directory
530         if [ -f "$CONFIG_CACHE_FILE" ]; then
531                 TMP_CONFIG_CACHE="$(mktemp --tmpdir newconfig-XXXXXXXX.cache)"
532                 sed -e "/ac_cv_env/d" \
533                     -e "/am_cv_CC_dependencies_compiler_type/d" \
534                     -e "/lb_cv_mpi_tests/d" \
535                        "$CONFIG_CACHE_FILE" > $TMP_CONFIG_CACHE
536                 CONFIGURE_ARGS="$CONFIGURE_ARGS --cache-file=$TMP_CONFIG_CACHE"
537         fi
538 fi
539
540 # we need to eval "configure" because $CONFIGURE_ARGS could have a quoted
541 # string in it which we don't want word splitted by the shell
542 # also remove (build|host|target) options because they will be specified
543 # inside $CONFIGURE_ARGS
544 # kmod tools/scripts require "name" directory with kernel modules
545
546 %if 0%{?rhel} >= 9
547 %define _configure eval ./configure
548 %define eval_configure %configure
549 %else
550 %define eval_configure %(echo -n '%configure' | sed -e 's#\./configure#eval ./configure#' -e 's/--\\(build\\|host\\|target\\)=[^ ][^ ]* //g')
551 %endif
552
553 %if %{with mpi}
554 %if "%{mpi_name}" == "mpich"
555 %{?_mpich_load}
556 %endif
557 %if "%{mpi_name}" == "openmpi"
558 %{?_openmpi_load}
559 %endif
560 # mpi
561 %endif
562
563 %if %{with mofed}
564         o2ib_path=$(find /usr/src/ofa_kernel/ -type d -name ofed_scripts | xargs dirname)
565         if [ -z "$o2ib_path" ]; then
566                 echo "ERROR: could not find OFED devel headers"
567                 exit 1
568         fi
569         if [ $(echo $o2ib_path | wc -w) -ge 2 ]; then
570                 echo "ERROR: multiple OFED versions installed"
571                 exit 1
572         fi
573 %endif
574
575 %eval_configure $CONFIGURE_ARGS \
576         %{?with_lustre_tests:--enable-tests}%{!?with_lustre_tests:--disable-tests} \
577         %{?with_lustre_utils:--enable-utils}%{!?with_lustre_utils:--disable-utils} \
578         %{?with_lustre_modules:--enable-modules}%{!?with_lustre_modules:--disable-modules} \
579         %{!?with_shared:--disable-shared} \
580         %{!?with_static:--disable-static} \
581         %{!?with_lustre_iokit:--disable-iokit} \
582         %{!?with_ldiskfs:--disable-ldiskfs} \
583         %{!?with_servers:--disable-server} \
584         %{!?with_zfs:--without-zfs} \
585         %{!?with_gss:--disable-gss} \
586         %{!?with_gss_keyring:--disable-gss-keyring} \
587         %{!?with_manpages:--disable-manpages} \
588         %{!?with_systemd:--with-systemdsystemunitdir=no} \
589         %{?with_systemd:--with-systemdsystemunitdir=%{_unitdir}} \
590         %{?with_mofed:--with-o2ib=$o2ib_path} \
591         --with-linux=%{kdir} \
592         --with-linux-obj=%{kobjdir} \
593         --with-kmp-moddir=%{kmoddir}/%{name}
594
595 %if %{with servers}
596 if ! grep -q define[[:space:]]*HAVE_SERVER_SUPPORT config.h 2> /dev/null; then
597         echo "Error: Server Support configured but not found"
598         false
599 fi
600 %endif
601
602 make %{?_smp_mflags} -s %{?make_args}
603
604 %if %{with mpi}
605 %if "%{mpi_name}" == "mpich"
606 %{?_mpich_unload}
607 %endif
608 %if "%{mpi_name}" == "openmpi"
609 %{?_openmpi_unload}
610 %endif
611 # mpi
612 %endif
613
614 %install
615
616 %if %{with mpi}
617 %if "%{mpi_name}" == "mpich"
618 %{?_mpich_load}
619 %endif
620 %if "%{mpi_name}" == "openmpi"
621 %{?_openmpi_load}
622 %endif
623 # mpi
624 %endif
625
626 make install DESTDIR=$RPM_BUILD_ROOT
627
628 %if %{with lustre_modules}
629 # RHEL's kernel_module_path macro expects that all the modules
630 # in a kmod package will be in modules_fs_path/<sub packagename>
631 # but Lustre installs all of the modules in a single pass into
632 # a shared location.  Since this is a restriction imposed by
633 # RHEL, we handle this here in the spec file rather than in
634 # Lustre's build system.  This is not expected to bother SLES's
635 # kernel_module_path macro.
636 basemodpath=$RPM_BUILD_ROOT%{modules_fs_path}/%{name}
637 %{__install} -D -m 0644 ${PWD}/Module.symvers %{buildroot}/Module.symvers
638 %if %{with ldiskfs}
639 mkdir -p $basemodpath-osd-ldiskfs/fs
640 mv $basemodpath/fs/osd_ldiskfs.ko $basemodpath-osd-ldiskfs/fs/osd_ldiskfs.ko
641 mv $basemodpath/fs/ldiskfs.ko $basemodpath-osd-ldiskfs/fs/ldiskfs.ko
642 %endif
643 %if %{with zfs}
644 mkdir -p $basemodpath-osd-zfs/fs
645 mv $basemodpath/fs/osd_zfs.ko $basemodpath-osd-zfs/fs/osd_zfs.ko
646 %endif
647 %if %{with lustre_tests}
648 mkdir -p $basemodpath-tests/fs
649 mv $basemodpath/fs/llog_test.ko $basemodpath-tests/fs/llog_test.ko
650 mv $basemodpath/fs/obd_test.ko $basemodpath-tests/fs/obd_test.ko
651 mkdir -p $RPM_BUILD_ROOT%{_libdir}/lustre/tests/kernel/
652 mv $basemodpath/fs/kinode.ko $RPM_BUILD_ROOT%{_libdir}/lustre/tests/kernel/
653 %endif
654 %endif
655
656 %if %{without mpi}
657 if [ -d $RPM_BUILD_ROOT%{_libdir}/openmpi ] ; then
658         rm -fr $RPM_BUILD_ROOT%{_libdir}/openmpi
659 fi
660 if [ -d $RPM_BUILD_ROOT%{_libdir}/mpich ] ; then
661         rm -fr $RPM_BUILD_ROOT%{_libdir}/mpich
662 fi
663 %endif
664
665 :> lustre.files
666
667 %if %{with servers} && %{with lustre_utils}
668 # The .ha_v2 extension identifies the heartbeat resource agent as using
669 # legacy syntax. Install a compatibility symlink to avoid conflicts when
670 # newer-style agents are added.
671 ln -s Lustre.ha_v2 $RPM_BUILD_ROOT%{_sysconfdir}/ha.d/resource.d/Lustre
672 echo '%dir %{_sysconfdir}/ha.d' >>lustre.files
673 echo '%dir %{_sysconfdir}/ha.d/resource.d' >>lustre.files
674 echo '%{_sysconfdir}/ha.d/resource.d/Lustre.ha_v2' >>lustre.files
675 echo '%{_sysconfdir}/ha.d/resource.d/Lustre' >>lustre.files
676 %endif
677
678 # systemd is on redhat, fedora, and suse
679 %if %{with systemd}
680 echo '%{_unitdir}/lnet.service' >>lustre.files
681 %endif
682
683 %if "%{_vendor}" == "redhat" || "%{_vendor}" == "openEuler"
684 # The following scripts are Red Hat specific
685 %if %{with servers}
686 echo '%{_sysconfdir}/init.d/lustre' >>lustre.files
687 echo '%{_sysconfdir}/sysconfig/lustre' >>lustre.files
688 %if %{with gss_keyring}
689 echo '%{_sysconfdir}/init.d/lsvcgss' >>lustre.files
690 echo '%config(noreplace) %{_sysconfdir}/sysconfig/lsvcgss' >>lustre.files
691 %endif
692 %endif
693
694 %if %{without systemd}
695 echo '%{_sysconfdir}/init.d/lnet' >>lustre.files
696 %endif
697 %endif
698 %if %{with gss_keyring}
699 echo '%config(noreplace) %{_sysconfdir}/request-key.d/lgssc.conf' >>lustre.files
700 %endif
701
702 # fc18 needs 'x' permission for library files
703 find $RPM_BUILD_ROOT -name \*.so -type f -exec chmod +x {} \;
704
705 rm -f $RPM_BUILD_ROOT%{_libdir}/liblnetconfig.la
706 %if %{with static}
707 echo '%attr(-, root, root) %{_libdir}/liblnetconfig.a' >>lustre.files
708 %endif
709 %if %{with shared}
710 echo '%attr(-, root, root) %{_libdir}/liblnetconfig.so' >>lustre-devel.files
711 echo '%attr(-, root, root) %{_libdir}/liblnetconfig.so.*' >>lustre.files
712 %endif
713
714 %if %{with ldiskfs}
715 echo '%{_libdir}/libiam.a' >>lustre.files
716 %endif
717
718 %if %{with lustre_utils}
719 mkdir -p $RPM_BUILD_ROOT/%{_datadir}/lustre
720 if [ -d $RPM_BUILD_ROOT%{_libdir}/lustre ] ; then
721         find $RPM_BUILD_ROOT%{_libdir}/@PACKAGE@ -name \*.la -type f -exec rm -f {} \;
722 fi
723 %endif
724
725 echo '%{_prefix}/lib/firewalld/services/*.xml' >>lustre.files
726 %if %{with lustre_modules}
727 # mark modules executable for find-debuginfo.sh
728 find $RPM_BUILD_ROOT/lib/modules -name \*.ko -type f -exec chmod u+x {} \;
729 %endif
730
731 rm -f $RPM_BUILD_ROOT%{_libdir}/liblustreapi.la
732
733 %if %{with lustre_tests}
734 :> lustre-tests.files
735 %if %{with mpi}
736 %if "%{mpi_name}" == "mpich"
737 %{?_mpich_load}
738 %endif
739 %if "%{mpi_name}" == "openmpi"
740 %{?_openmpi_load}
741 %endif
742 # mpi
743 %endif
744 echo '%dir %{_libdir}/lustre' >>lustre-tests.files
745 echo '%dir %{_libdir}/lustre/tests' >>lustre-tests.files
746 echo '%{_libdir}/lustre/tests/*' >>lustre-tests.files
747 echo '%{_bindir}/mcreate' >>lustre-tests.files
748 echo '%{_bindir}/statx' >>lustre-tests.files
749 echo '%{_sbindir}/wirecheck' >>lustre-tests.files
750 echo '%{_sbindir}/wiretest' >>lustre-tests.files
751 if [ -n "$MPI_BIN" ]; then
752         echo "$MPI_BIN/*" >>lustre-tests.files
753 fi
754 %if %{with lustre_tests_lutf}
755 echo '%{_libdir}/lustre/tests/lutf/*' >>lustre-tests.files
756 %endif
757 %endif
758
759 %if %{with lustre_tests_lutf}
760 echo '%{_libdir}/lustre/tests/lutf/*' >>lustre-tests.files
761 %endif
762
763 %files devel -f lustre-devel.files
764 %defattr(-,root,root)
765 %{_libdir}/pkgconfig/lustre.pc
766 %if %{with static}
767 %{_libdir}/liblustreapi.a
768 %endif
769 %if %{with shared}
770 %{_libdir}/liblustreapi.so
771 %endif
772 %{_includedir}/lustre
773 %if %{with lustre_modules}
774 %{_includedir}/linux/lnet
775 %{_includedir}/linux/lustre
776 %else
777 %exclude %{_includedir}/linux/lnet
778 %exclude %{_includedir}/linux/lustre
779 %endif
780
781 %files -f lustre.files
782 %defattr(-,root,root)
783 %{_sbindir}/*
784 %if %{with lustre_tests}
785 %exclude %{_sbindir}/wirecheck
786 %exclude %{_sbindir}/wiretest
787 %endif
788 %if %{with zfs}
789 %exclude %{_sbindir}/zfsobj2fid
790 %endif
791 %if %{with lustre_utils}
792 %if %{with servers}
793 %dir %{_libexecdir}/lustre
794 %{_libexecdir}/lustre/lc_common
795 %{_libexecdir}/lustre/haconfig
796 %{_bindir}/lustre_req_history
797 %{_bindir}/remove_changelog
798 %{_bindir}/remove_updatelog
799 %endif
800
801 %{_bindir}/llobdstat
802 %{_bindir}/lljobstat
803 %{_bindir}/llstat
804 %{_bindir}/plot-llstat
805 %{_datadir}/lustre
806
807 %{_bindir}/lfs
808 %{_bindir}/lfs_migrate
809 /sbin/mount.lustre
810 %if %{with servers}
811 /sbin/mount.lustre_tgt
812 %endif
813 @BASH_COMPLETION_DIR@
814 %endif
815
816 %if %{with manpages}
817 %{_mandir}/man?/*
818 %endif
819
820 %if %{with shared}
821 %{_libdir}/liblustreapi.so.*
822 %endif
823 %{_udevrulesdir}/99-lustre.rules
824 %if %{with servers}
825 %{_udevrulesdir}/99-lustre-server.rules
826 %endif
827 %if %{with zfs}
828 %config(noreplace) %{_sysconfdir}/ldev.conf
829 %endif
830 %config(noreplace) %{_sysconfdir}/lnet.conf
831 %config(noreplace) %{_sysconfdir}/modprobe.d/ko2iblnd.conf
832 %if %{with lustre_utils}
833 %config(noreplace) %{_sysconfdir}/lnet_routes.conf
834 %endif
835 %if %{with lustre_modules}
836 %exclude /Module.symvers
837 %if %{with shared}
838 %if %{with ldiskfs}
839 %if %{with lustre_utils}
840 %files osd-ldiskfs-mount
841 %defattr(-,root,root)
842 %dir %{_libdir}/@PACKAGE@
843 %{_libdir}/@PACKAGE@/mount_osd_ldiskfs.so
844 %endif
845 %endif
846 %endif
847
848 %if %{with shared}
849 %if %{with zfs}
850 %if %{with lustre_utils}
851 %files osd-zfs-mount
852 %defattr(-,root,root)
853 %dir %{_libdir}/@PACKAGE@
854 %{_libdir}/@PACKAGE@/mount_osd_zfs.so
855 %{_sysconfdir}/zfs/zed.d/*
856 %endif
857 %endif
858 %endif
859
860 # with lustre_modules
861 %endif
862
863 %if %{with servers}
864 %files resource-agents
865 %defattr(0755,root,root)
866 %dir %{_prefix}/lib/ocf
867 %dir %{_prefix}/lib/ocf/resource.d
868 %{_prefix}/lib/ocf/resource.d/lustre/
869 %endif
870
871 %if %{with lustre_tests}
872 %files tests -f lustre-tests.files
873 %defattr(-,root,root)
874 %endif
875
876 %if %{with lustre_iokit}
877 %files -n lustre-iokit
878 %defattr(-, root, root)
879 %{_bindir}/iokit-config
880 %{_bindir}/iokit-gather-stats
881
882 %{_bindir}/iokit-libecho
883 %{_bindir}/iokit-lstats
884 %{_bindir}/iokit-parse-ior
885 %{_bindir}/iokit-plot-obdfilter
886 %{_bindir}/iokit-plot-ost
887 %{_bindir}/iokit-plot-sgpdd
888 %{_bindir}/ior-survey
889 %{_bindir}/mds-survey
890 %{_bindir}/obdfilter-survey
891 %{_bindir}/ost-survey
892 %{_bindir}/sgpdd-survey
893 %{_bindir}/lst-survey
894 %{_bindir}/lst.sh
895 %doc lustre-iokit/ior-survey/README.ior-survey
896 %doc lustre-iokit/mds-survey/README.mds-survey
897 %doc lustre-iokit/obdfilter-survey/README.obdfilter-survey
898 %doc lustre-iokit/ost-survey/README.ost-survey
899 %doc lustre-iokit/sgpdd-survey/README.sgpdd-survey
900 %doc lustre-iokit/stats-collect/README.iokit-lstats
901 %doc lustre-iokit/lst-survey/README.lst-survey
902 %endif
903
904 %post
905 %if %{with systemd}
906 %systemd_post lnet.service
907 %endif
908
909 %preun
910 %if %{with systemd}
911 %systemd_preun lnet.service
912 %endif
913
914 %postun
915 %if %{with systemd}
916 %systemd_postun_with_restart lnet.service
917 %endif
918
919 %clean
920 rm -rf $RPM_BUILD_ROOT
921 rm -rf %{_tmppath}/kmp