Whamcloud - gitweb
LU-6142 misc: fix style issues in uapi headers
[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" || 0%{?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 0%{?openEuler}
195 %define with_systemd 1
196 %endif
197
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/
204 %else
205 %define mofed_default_path      %{mofed_src_path}
206 %endif
207
208 %{!?mpi_name: %global mpi_name openmpi}
209
210 Summary: Lustre File System
211 Name: %{lustre_name}
212 Version: %{version}
213 Release: 1%{?dist}
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
217 Group: System/Kernel
218 %endif
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}
244 %endif
245 %if %{with lustre_tests_lutf}
246 Requires: python3 >= 3.6.0
247 BuildRequires: python3-devel >= 3.6.0, swig
248 %endif
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
255 %endif
256 %else
257 %if 0%{?openEuler}
258 BuildRequires: openEuler-rpm-config
259 %if %{with ldiskfs}
260 BuildRequires: kernel-debugsource
261 %endif
262 %endif
263 BuildRequires: pkg-config
264 %endif
265 %if %{with gss}
266 BuildRequires: krb5-devel openssl-devel
267 %endif
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"
276 %else
277 BuildRequires: kernel-source
278 %endif
279 %endif
280 %if %{with servers}
281 Requires: %{name}-osd
282 Requires: %{name}-osd-mount
283 Obsoletes: lustre-server < %{version}
284 Provides: lustre-server = %{version}-%{release}
285 %endif
286 Obsoletes: lustre-client < %{version}
287 Provides: lustre-client = %{version}-%{release}
288 %if "%{_vendor}" == "redhat" || "%{_vendor}" == "fedora" || 0%{?openEuler}
289 #suse don't support selinux
290 BuildRequires: pkgconfig(libselinux)
291 %endif
292 %if %{with lustre_modules}
293 %if %{with mofed}
294 %if 0%{?mofed_source} > 0
295 BuildRequires: mlnx-ofa_kernel-devel
296 %endif
297 %if %{with multiple_lnds}
298 %if "%{_vendor}" == "redhat" || 0%{?openEuler}
299 Requires: kmod-mlnx-ofa_kernel
300 %else
301 Requires: mlnx-ofa_kernel-kmp
302 %endif
303 %endif
304 %endif
305 %if 0%{?rhel} >= 8 || 0%{?openEuler}
306 BuildRequires: kernel-rpm-macros
307 %endif
308 %if 0%{?suse_version} >= 1530
309 BuildRequires: rpm-build >= 4.14.3
310 %endif
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"
315 %if %{with kabi}
316 BuildRequires: kernel-abi-whitelists
317 %endif
318 %endif
319 %endif
320
321 %if %{with systemd}
322 Requires(post): systemd
323 Requires(preun): systemd
324 Requires(postun): systemd
325 BuildRequires: pkgconfig(systemd)
326 %endif
327
328 %description
329 Userspace tools and files for the Lustre file system.
330
331 %if %{with lustre_modules}
332 %if 0%{?rhel} == 7
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:%(
340 TMPFILE=`mktemp`
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
347 echo $TMPFILE
348 )}
349 %else
350 %define preamble %{SOURCE1}
351 %endif
352 %kernel_module_package -n %{name} -p %preamble -f %SOURCE2 %{_flavor}
353
354 %if %{with ldiskfs}
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}
365
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
369
370 # with lustre_utils
371 %endif
372 # with ldiskfs
373 %endif
374
375 %if %{with zfs}
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)
386 %endif
387 # end confzfsdobjpath
388 # Tests also require zpool from zfs package:
389 Requires: zfs
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}
394
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.
398
399 # with lustre_utils
400 %endif
401 # with zfs
402 %endif
403 # with lustre_modules
404 %endif
405
406 %if %{with servers}
407 %package resource-agents
408 Summary: HA Resuable Cluster Resource Scripts for Lustre
409 Requires: %{name}
410 Requires: resource-agents
411
412 %description resource-agents
413 A set of scripts to operate Lustre resources in a High Availablity
414 environment for both Pacemaker and rgmanager.
415 %endif
416
417 %package devel
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}
423 %endif
424
425 %description devel
426 This package contains the header files needed for building additional
427 applications against the Lustre / LNet utilities libraries.
428
429 :> lustre-devel.files
430
431 %if %{with lustre_tests}
432 %package tests
433 Summary: Lustre testing framework
434 Provides: %{name}-tests = %{version}
435 %if %{with lustre_iokit}
436 Requires: %{name} = %{version}, lustre-iokit
437 %else
438 Requires: %{name} = %{version}
439 %endif
440 Requires: lustre-devel = %{version}
441 %if 0%{?rhel} >= 8 || 0%{?suse_version} >= 1500 || 0%{?openEuler}
442 Requires: python3 >= 3.6.0, python3-PyYAML
443 %endif
444 %if %{with lustre_modules}
445 Requires: %{requires_kmod_name} = %{requires_kmod_version}
446 Requires: %{requires_kmod_tests_name} = %{requires_kmod_version}
447 %endif
448 %if %{with lustre_tests_lutf}
449 Requires: python3 >= 3.6.0
450 %endif
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
458 %endif
459 %if %{with mpi}
460 %if "%{mpi_name}" == "mpich"
461 BuildRequires: mpich-devel
462 %endif
463 %if "%{mpi_name}" == "openmpi"
464 %if "%{_vendor}" == "redhat" || 0%{?openEuler} || 0%{?suse_version} < 1500
465 BuildRequires: openmpi-devel
466 %else
467 BuildRequires: openmpi2-devel
468 %endif
469 # openmpi
470 %endif
471 # mpi
472 %endif
473
474 %description tests
475 This package contains a set of test binaries and scripts that are intended
476 to be used by the Lustre testing framework.
477
478 %if %{with lustre_modules}
479 %kernel_module_package -n %{name}-tests -p %SOURCE7 -f %SOURCE8 %{_flavor}
480 %endif
481 %endif
482
483 %if %{with multiple_lnds}
484 # begin multiple_lnds
485 %kernel_module_package -n %{name}-lnet-socklnd -p %SOURCE11 -f %SOURCE12 %{_flavor}
486 %if %{with o2ib}
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:%(
491 TMPFILE=`mktemp`
492 cat <<EOF > $TMPFILE
493 %kernel_module_package -n %{name}-lnet-in-kernel-o2iblnd -p %SOURCE19 -f %SOURCE20 %{_flavor}
494 EOF
495 sed -i -e '/^%%post.*/a ln -sf %{inkernmod} %{inkernsym}' -e '/^%%preun.*/a rm -f %{inkernsym}' $TMPFILE
496 echo $TMPFILE
497 )}
498 %{expand:%(cat '%{ofed_module_package}')}
499 %endif
500 %if %{with mofed}
501 %kernel_module_package -n %{name}-lnet-o2iblnd -p %SOURCE13 -f %SOURCE14 %{_flavor}
502 %endif
503 %if %{with gni}
504 %kernel_module_package -n %{name}-lnet-gnilnd -p %SOURCE15 -f %SOURCE16 %{_flavor}
505 %endif
506 %if %{with kfi}
507 %kernel_module_package -n %{name}-lnet-kfilnd -p %SOURCE17 -f %SOURCE18 %{_flavor}
508 %endif
509 # end multiple_lnds
510 %endif
511
512 %if %{with lustre_iokit}
513 %package -n lustre-iokit
514 Summary: Collection of benchmark tools for a cluster with the Lustre file system
515 Requires: sg3_utils
516 %if 0%{?rhel} > 7 || 0%{?fedora} > 33 || 0%{?rhel} < 1
517 Recommends: perl
518 %endif
519
520 %description -n lustre-iokit
521 This package includes five tools:
522 sgpdd-survey:
523 A test of the 'bare metal' performance, bypassing as much of the kernel as we can. Uses the sgp_dd utility.
524
525 obdfilter-survey
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.
531
532 ost-survey
533 This survey tests the client-to-disk performance of individual OSTs, and
534 ranks then for comparison.
535
536 stats-collect
537 This script will collect IO stats on a defined set of nodes.
538
539 ior-survey:
540 A script to run the IOR benchmark. The latest version can be downloaded from
541 https://github.com/hpc/ior/
542
543 mds-survey:
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
548
549 lst-survey:
550 This survey tests LNet performance between a group of clients and servers.
551 %endif
552
553 %if 0%{?suse_version}
554 %debug_package
555 %endif
556 %prep
557 %setup -qn lustre-%{version}
558 ln lustre/ChangeLog ChangeLog-lustre
559 ln lnet/ChangeLog ChangeLog-lnet
560
561 %build
562 # Set an explicit path to our Linux tree, if we can.
563 cd $RPM_BUILD_DIR/lustre-%{version}
564
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}}}"
572
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.
576 %if 0%{?rhel}
577 %ifarch ppc64
578 export UTILS_CFLAGS="${UTILS_CFLAGS} -D__SANE_USERSPACE_TYPES__=1"
579 %endif
580 %endif
581
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
588
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"
606         fi
607 fi
608
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
614
615 %if 0%{?rhel} >= 9
616 %define _configure eval ./configure
617 %define eval_configure %configure
618 %else
619 %define eval_configure %(echo -n '%configure' | sed -e 's#\./configure#eval ./configure#' -e 's/--\\(build\\|host\\|target\\)=[^ ][^ ]* //g')
620 %endif
621
622 %if %{with mpi}
623 %if "%{mpi_name}" == "mpich"
624 %{?_mpich_load}
625 %endif
626 %if "%{mpi_name}" == "openmpi"
627 %{?_openmpi_load}
628 %endif
629 # mpi
630 %endif
631
632 WITH_O2IB=""
633 %if %{with mofed}
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"
637                 exit 1
638         fi
639         if [ $(echo $o2ib_path | wc -w) -ge 2 ]; then
640                 echo "ERROR: multiple OFED versions installed"
641                 exit 1
642         fi
643         WITH_O2IB="--with-o2ib=${o2ib_path}"
644 %else
645 %if %{without o2ib}
646         WITH_O2IB="--with-o2ib=no"
647 %endif
648 %endif
649
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} \
668         ${WITH_O2IB} \
669         --with-linux=%{kdir} \
670         --with-linux-obj=%{kobjdir} \
671         --with-kmp-moddir=%{kmoddir}/%{name}
672
673 %if %{with servers}
674 if ! grep -q define[[:space:]]*HAVE_SERVER_SUPPORT config.h 2> /dev/null; then
675         echo "Error: Server Support configured but not found"
676         false
677 fi
678 %endif
679
680 make %{?_smp_mflags} -s %{?make_args}
681
682 %if %{with mpi}
683 %if "%{mpi_name}" == "mpich"
684 %{?_mpich_unload}
685 %endif
686 %if "%{mpi_name}" == "openmpi"
687 %{?_openmpi_unload}
688 %endif
689 # mpi
690 %endif
691
692 %install
693
694 %if %{with mpi}
695 %if "%{mpi_name}" == "mpich"
696 %{?_mpich_load}
697 %endif
698 %if "%{mpi_name}" == "openmpi"
699 %{?_openmpi_load}
700 %endif
701 # mpi
702 %endif
703
704 make install DESTDIR=$RPM_BUILD_ROOT
705
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
716 %if %{with ldiskfs}
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
720 %endif
721 %if %{with zfs}
722 mkdir -p $basemodpath-osd-zfs/fs
723 mv $basemodpath/fs/osd_zfs.ko $basemodpath-osd-zfs/fs/osd_zfs.ko
724 %endif
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/
731 %endif
732 %endif
733
734 %if %{without mpi}
735 if [ -d $RPM_BUILD_ROOT%{_libdir}/openmpi ] ; then
736         rm -fr $RPM_BUILD_ROOT%{_libdir}/openmpi
737 fi
738 if [ -d $RPM_BUILD_ROOT%{_libdir}/mpich ] ; then
739         rm -fr $RPM_BUILD_ROOT%{_libdir}/mpich
740 fi
741 %endif
742
743 :> lustre.files
744
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
754 %endif
755
756 # systemd is on redhat, fedora, and suse
757 %if %{with systemd}
758 echo '%{_unitdir}/lnet.service' >>lustre.files
759 %endif
760
761 %if "%{_vendor}" == "redhat" || 0%{?openEuler}
762 # The following scripts are Red Hat specific
763 %if %{with servers}
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
769 %endif
770 %endif
771
772 %if %{without systemd}
773 echo '%{_sysconfdir}/init.d/lnet' >>lustre.files
774 %endif
775 %endif
776 %if %{with gss_keyring}
777 echo '%config(noreplace) %{_sysconfdir}/request-key.d/lgssc.conf' >>lustre.files
778 %endif
779
780 # fc18 needs 'x' permission for library files
781 find $RPM_BUILD_ROOT -name \*.so -type f -exec chmod +x {} \;
782
783 rm -f $RPM_BUILD_ROOT%{_libdir}/liblnetconfig.la
784 %if %{with static}
785 echo '%attr(-, root, root) %{_libdir}/liblnetconfig.a' >>lustre.files
786 %endif
787 %if %{with shared}
788 echo '%attr(-, root, root) %{_libdir}/liblnetconfig.so' >>lustre-devel.files
789 echo '%attr(-, root, root) %{_libdir}/liblnetconfig.so.*' >>lustre.files
790 %endif
791
792 %if %{with ldiskfs}
793 echo '%{_libdir}/libiam.a' >>lustre.files
794 %endif
795
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 {} \;
800 fi
801 %endif
802
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 {} \;
807 %endif
808
809 rm -f $RPM_BUILD_ROOT%{_libdir}/liblustreapi.la
810
811 %if %{with lustre_tests}
812 :> lustre-tests.files
813 %if %{with mpi}
814 %if "%{mpi_name}" == "mpich"
815 %{?_mpich_load}
816 %endif
817 %if "%{mpi_name}" == "openmpi"
818 %{?_openmpi_load}
819 %endif
820 # mpi
821 %endif
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
831 fi
832 %if %{with lustre_tests_lutf}
833 echo '%{_libdir}/lustre/tests/lutf/*' >>lustre-tests.files
834 %endif
835 %endif
836
837 %if %{with lustre_tests_lutf}
838 echo '%{_libdir}/lustre/tests/lutf/*' >>lustre-tests.files
839 %endif
840
841 %files devel -f lustre-devel.files
842 %defattr(-,root,root)
843 %{_libdir}/pkgconfig/lustre.pc
844 %if %{with static}
845 %{_libdir}/liblustreapi.a
846 %endif
847 %if %{with shared}
848 %{_libdir}/liblustreapi.so
849 %endif
850 %{_includedir}/lustre
851 %if %{with lustre_modules}
852 %{_includedir}/linux/lnet
853 %{_includedir}/linux/lustre
854 %else
855 %exclude %{_includedir}/linux/lnet
856 %exclude %{_includedir}/linux/lustre
857 %endif
858
859 %files -f lustre.files
860 %defattr(-,root,root)
861 %{_sbindir}/*
862 %if %{with lustre_tests}
863 %exclude %{_sbindir}/wirecheck
864 %exclude %{_sbindir}/wiretest
865 %endif
866 %if %{with zfs}
867 %exclude %{_sbindir}/zfsobj2fid
868 %endif
869 %if %{with lustre_utils}
870 %if %{with servers}
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
877 %endif
878
879 %{_bindir}/llobdstat
880 %{_bindir}/lljobstat
881 %{_bindir}/llstat
882 %{_bindir}/plot-llstat
883 %{_datadir}/lustre
884
885 %{_bindir}/lfs
886 %{_bindir}/lfs_migrate
887 /sbin/mount.lustre
888 %if %{with servers}
889 /sbin/mount.lustre_tgt
890 %endif
891 @BASH_COMPLETION_DIR@
892 %endif
893
894 %if %{with manpages}
895 %{_mandir}/man?/*
896 %endif
897
898 %if %{with shared}
899 %{_libdir}/liblustreapi.so.*
900 %endif
901 %{_udevrulesdir}/99-lustre.rules
902 %if %{with servers}
903 %{_udevrulesdir}/99-lustre-server.rules
904 %endif
905 %if %{with zfs}
906 %config(noreplace) %{_sysconfdir}/ldev.conf
907 %endif
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
912 %endif
913 %if %{with lustre_modules}
914 %exclude /Module.symvers
915 %if %{with shared}
916 %if %{with ldiskfs}
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
922 %endif
923 %endif
924 %endif
925
926 %if %{with shared}
927 %if %{with zfs}
928 %if %{with lustre_utils}
929 %files osd-zfs-mount
930 %defattr(-,root,root)
931 %dir %{_libdir}/@PACKAGE@
932 %{_libdir}/@PACKAGE@/mount_osd_zfs.so
933 %{_sysconfdir}/zfs/zed.d/*
934 %endif
935 %endif
936 %endif
937
938 # with lustre_modules
939 %endif
940
941 %if %{with servers}
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/
947 %endif
948
949 %if %{with lustre_tests}
950 %files tests -f lustre-tests.files
951 %defattr(-,root,root)
952 %endif
953
954 %if %{with lustre_iokit}
955 %files -n lustre-iokit
956 %defattr(-, root, root)
957 %{_bindir}/iokit-config
958 %{_bindir}/iokit-gather-stats
959
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
972 %{_bindir}/lst.sh
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
980 %endif
981
982 %post
983 %if %{with systemd}
984 %systemd_post lnet.service
985 %endif
986
987 %preun
988 %if %{with systemd}
989 %systemd_preun lnet.service
990 %endif
991
992 %postun
993 %if %{with systemd}
994 %systemd_postun_with_restart lnet.service
995 %endif
996
997 %clean
998 rm -rf $RPM_BUILD_ROOT
999 rm -rf %{_tmppath}/kmp