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