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