Whamcloud - gitweb
LU-6824 ldiskfs: add dir htree growing warning patch
[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 lnet_dlc
12 %bcond_without manpages
13 %bcond_without shared
14 %bcond_without static
15
16 %if %{without servers}
17     # --without servers overrides --with {ldiskfs|zfs}
18     # so undefine the internal variables set by bcond_*
19     %undefine with_ldiskfs
20     %undefine with_zfs
21 %endif
22
23 %{!?version: %global version @VERSION@}
24 %{!?kver:    %global kver    %(uname -r)}
25 %{!?kdir:    %global kdir    /lib/modules/%{kver}/source}
26 %{!?kobjdir: %global kobjdir %(if [ "%{kdir}" = "/lib/modules/%{kver}/source" ]; then echo "/lib/modules/%{kver}/build"; else echo "%{kdir}"; fi)}
27
28 # as an alternative to this implementation we could simply "make -C $kdir kernelversion"
29 %{!?kversion: %global kversion %(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)}
30
31 %define buildid %(if [ -n "@BUILDID@" ]; then echo "_@BUILDID@"; fi)
32
33 %if 0%{?build_src_rpm}
34     %{!?myrelease: %global myrelease 1}
35 %else
36     %{!?downstream_release: %global downstream_release "@DOWNSTREAM_RELEASE@"}
37     %{!?myrelease: %global myrelease %(if [ -n "%downstream_release" ]; then echo -n "%{downstream_release}_"; fi; echo %kversion | tr '-' '_')}
38     # for those uses that don't want the -smp/-bigsmp (or the .arch) on the end
39     # of %kversion
40     %define krequires %(echo %{kversion} | 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$//')
41 %endif
42
43 # always append the buildid, even when the caller defines %release
44 %define fullrelease %{myrelease}%{buildid}
45
46 # in order to get kernel symset and/or kernel module dependencies into
47 # the RPM, in order to support weak-modules, the internal dependency gen-
48 # erator needs to be disabled
49 # this is done with (reduce the double % down to a single %):
50 #
51 # %%global _use_internal_dependency_generator 0
52 #
53 # on SLES10, /usr/lib/rpm/macros already sets this, so no harm in also
54 # defining it here (until Suse changes their mind)
55 #
56 # on RHEL5, however, we do need to explicitly disable the internal dep-
57 # endency generator and allow the external one be used
58 # but since RedHat's kABI is only a subset of the total kernel ABI, it
59 # doesn't include all of the symbols we (or OFED for that matter) need
60 # until RedHat includes all of the symbols we need in their symsets we
61 # cannot support weak-modules
62 # we did e-mail the maintainer of all of this stuff @redhat but got no
63 # response from them
64 #%%global _use_internal_dependency_generator 0
65
66 # Set the package name prefix
67 %if %{undefined lustre_name}
68     %if %{with servers}
69         %global lustre_name lustre
70     %else
71         %global lustre_name lustre-client
72     %endif
73 %endif
74
75 %if %{undefined kmoddir}
76     %if %{defined kernel_module_package_moddir}
77         %global kmoddir %{kernel_module_package_moddir}
78     %else
79         %if %{defined suse_kernel_module_package}
80             %global kmoddir updates
81         %else
82             %global kmoddir extra
83         %endif
84     %endif
85 %endif
86
87 %if %{defined cross_path} && %{defined post_script}
88 %define rpm_post_base %(dirname %{cross_path})/%{lustre_name}
89 %endif
90
91 # SUSE don't support .debug_info section from cross compiler:
92 # /usr/lib/rpm/debugedit: Unhandled relocation 10 in .debug_info section
93 %if %{defined cross_path} && 0%{?suse_version}
94 %global __debug_install_post %{nil}
95 %global __debug_package %{nil}
96 %global debug_package %{nil}
97 %endif
98
99 Summary: Lustre File System
100 Name: %{lustre_name}
101 Version: %{version}
102 Release: %{fullrelease}
103 License: GPL
104 Group: Utilities/System
105 Source: lustre-%{version}.tar.gz
106 URL: https://wiki.hpdd.intel.com/
107 BuildRoot: %{_tmppath}/lustre-%{version}-root
108 Obsoletes: lustre-lite, lustre-lite-utils, lustre-ldap nfs-utils-lustre
109 Provides: lustre-lite = %{version}, lustre-lite-utils = %{version}
110 Requires: %{name}-modules = %{version}
111 BuildRequires: libtool
112 %if %{with manpages}
113 BuildRequires: python-docutils
114 %endif
115 %if %{with servers}
116 Requires: lustre-osd
117 Requires: lustre-osd-mount
118 Provides: lustre-client = %{version}-%{fullrelease}
119 %endif
120 %if %{defined cross_requires}
121 Requires: %{cross_requires}
122 AutoReqProv: no
123 %else
124 # GSS requires this: BuildRequires: pkgconfig, libgssapi-devel >= 0.10
125 %if %{_vendor}=="redhat" || %{_vendor}=="fedora"
126 #suse don't support selinux
127 BuildRequires: libselinux-devel
128 Requires: libselinux
129 %endif
130 %endif
131
132 %description
133 Userspace tools and files for the Lustre file system.
134
135 %if %{with lustre_modules}
136 %package modules
137 Summary: Kernel Lustre modules for Linux %{kversion}
138 %if %{defined cross_requires}
139 Requires: %{cross_requires}
140 AutoReqProv: no
141 %else
142 # for SLES11, we need nothing here
143 %if %{_vendor}=="redhat" || %{_vendor}=="fedora"
144 %if %{defined krequires}
145 # for RHEL we need to require the specific kernel still since weak-modules
146 # support on RH is, well, weak, to be punny about it
147 Requires: kernel = %{krequires}
148 %endif
149 %if %{with lnet_dlc}
150 Requires: libyaml
151 BuildRequires: libyaml-devel
152 %endif
153 %endif
154 %endif
155 Group: Development/Kernel
156
157 %description modules
158 Lustre file system, server and network drivers for Linux %{kversion}.
159
160 %if %{with ldiskfs}
161 %package osd-ldiskfs
162 Summary: osd-ldiskfs contains both ldiskfs and its osd interface in Lustre.
163 Requires: lustre-modules = %{version}
164 Requires: module-init-tools >= 3.9
165 Requires: ldiskfsprogs >= 1.42.7.wc1
166 Requires: lustre-osd-ldiskfs-mount = %{version}
167 Provides: lustre-osd
168 Obsoletes: lustre-ldiskfs
169 Group: Development/Kernel
170
171 %description osd-ldiskfs
172 The Lustre Object Storage Device (OSD) API is the interface to access and
173 modify data that is supposed to be stored persistently. This API is the interface
174 to code that bridges individual file systems. This specific package provides an
175 implementation of the OSD API for using the Ldiskfs filesystem as the underlying
176 backing store of a Lustre server.
177
178 %if %{with lustre_utils}
179 %package osd-ldiskfs-mount
180 Summary: osd-ldiskfs-mount contains mount's ldiskfs specific dso.
181 Provides: lustre-osd-mount
182 Group: Development/Kernel
183
184 %description osd-ldiskfs-mount
185 LDISKFS hooks for mount/mkfs into a dynamic library.
186
187 %endif
188 %endif
189
190 %if %{with zfs}
191 %package osd-zfs
192 Summary: osd-zfs is the mandatory glue for ZFS support in Lustre.
193 Requires: lustre-modules = %{version}, zfs-kmod
194 Requires: lustre-osd-zfs-mount = %{version}
195 Provides: lustre-osd
196 Group: Development/Kernel
197
198 %description osd-zfs
199 The Lustre Object Storage Device (OSD) API is the interface to access and
200 modify data that is supposed to be stored persistently. This API is the interface
201 to code that bridges individual file systems. This specific package provides an
202 implementation of the OSD API for using the ZFS filesystem as the underlying
203 backing store of a Lustre server.
204
205 %if %{with lustre_utils}
206 %package osd-zfs-mount
207 Summary: osd-zfs-mount contains mount's zfs specific dso.
208 Provides: lustre-osd-mount
209 Group: Development/Kernel
210
211 %description osd-zfs-mount
212 ZFS hooks for mount/mkfs into a dynamic library.
213
214 %endif
215 %endif
216 %endif # with lustre_modules
217
218 %package source
219 Summary: Object-Based Disk storage driver source
220 Group: Development/Kernel
221
222 %description source
223 Lustre sources for further development
224
225 # Since the RPMs we ship are to be used on both SLES and RHEL, we
226 # can't include any dependency information (since the package names
227 # are different on the two platforms).
228 #
229 # Instead, we can build these empty meta-packages that only include
230 # dependency information.  These let people get the correct
231 # dependencies for their platform and lets them use tools like yum and
232 # red carpet to install the correct files.
233 #
234 # Unfortunately I have not seen this come up on the lists much, so I
235 # have disabled them (by commenting out their empty files section
236 # below) until it's clear that they resolve more confusion than they
237 # add.
238
239 %package deps-sles
240 Summary: Lustre dependencies meta-package for SLES
241 Group: Utilities/System
242 Provides: lustre-deps = %{version}
243 Requires: %{name} = %{version}, sles-release
244 Conflicts: %{name}-deps-rhel
245
246 %description deps-sles
247 This package has RPM dependencies appropriate for SLES systems.
248
249 %package deps-rhel
250 Summary: Lustre dependencies meta-package for RHEL
251 Group: Utilities/System
252 Provides: lustre-deps = %{version}
253 Requires: %{name} = %{version}, redhat-release
254 Conflicts: %{name}-deps-sles
255
256 %description deps-rhel
257 This package has RPM dependencies appropriate for RHEL, RHL, and FC
258 systems.
259
260 %package tests
261 Summary: Lustre testing framework
262 Group: Development/Kernel
263 Provides: %{name}-tests = %{version}
264 Requires: %{name} = %{version}, %{name}-modules = %{version}, lustre-iokit
265 Requires: attr, rsync, perl, lsof, /usr/bin/getconf
266
267 %description tests
268 This package contains a set of test binaries and scripts that are intended
269 to be used by the Lustre testing framework.
270
271 %if %{with lustre_iokit}
272 %package -n lustre-iokit
273 Summary: The Lustre IO-Kit is a collection of benchmark tools for a cluster with the Lustre file system.
274 Group: Applications/System
275 Requires: python > 2.2, sg3_utils
276
277 %description -n lustre-iokit
278 This package includes five tools:
279 sgpdd-survey:
280 A test of the 'bare metal' performance, bypassing as much of the kernel as we can. Uses the sgp_dd utility.
281
282 obdfilter-survey
283 This survey can be run in 3 modes to test disk I/O including the filesystem,
284 network I/O, and disk I/O via the network.  The script does sequential I/O
285 with varying numbers of threads and objects (files) by using lctl::test_brw
286 to drive the echo_client connected to local or remote obdfilter instances,
287 or remote obdecho instances.
288
289 ost-survey
290 This survey tests the client-to-disk performance of individual OSTs, and
291 ranks then for comparison.
292
293 stats-collect
294 This script will collect IO stats on a defined set of nodes.
295
296 ior-survey:
297 A script to run the IOR benchmark. The latest version can be downloaded from
298 http://www.llnl.gov/asci/purple/benchmarks/limited/ior/
299
300 mds-survey:
301 This survey tests the local metadata performance using the echo_client to drive
302 the MDD layer to perform operations. It is run with multiple threads (to
303 simulate MDT service threads) locally on the MDS node, and does not need Lustre
304 clients in order to run
305 %endif
306
307 %if 0%{?suse_version}
308 %debug_package
309 %endif
310 %prep
311 %setup -qn lustre-%{version}
312 ln lustre/ChangeLog ChangeLog-lustre
313 ln lnet/ChangeLog ChangeLog-lnet
314
315 %build
316
317 # Set an explicit path to our Linux tree, if we can.
318 cd $RPM_BUILD_DIR/lustre-%{version}
319 # override %optflags so that the vendor's overzealous flags don't create
320 # build failures
321 %define optflags -g -O2 -Werror
322
323 CONFIGURE_ARGS="%{?configure_args}"
324 if [ -n "$CONFIGURE_ARGS" ]; then
325         # make sure %%kdir and %%kobjdir are not in the configure arguments
326         CONFIGURE_ARGS=$(echo $CONFIGURE_ARGS | sed -e 's/"\?--with-linux=[^ ][^ ]* \?//')
327         CONFIGURE_ARGS=$(echo $CONFIGURE_ARGS | sed -e 's/"\?--with-linux-obj=[^ ][^ ]* \?//')
328         # remove --with-kmp-moddir from configure arguments,
329         # it will be set --with-kmp-moddir=%%kmoddir
330         CONFIGURE_ARGS=$(echo $CONFIGURE_ARGS | sed -e 's/"\?--with-kmp-moddir=[^ ][^ ]* \?//')
331 fi
332
333 # we need to eval "configure" because $CONFIGURE_ARGS could have a quoted
334 # string in it which we don't want word splitted by the shell
335 # also remove (build|host|target) options because they will be specified
336 # inside $CONFIGURE_ARGS
337 %define eval_configure %(echo '%configure' | sed -e 's#\./configure#eval ./configure#' -e 's/--\\(build\\|host\\|target\\)=[^ ][^ ]* //g')
338
339 %eval_configure $CONFIGURE_ARGS \
340         %{?with_lustre_tests:--enable-tests}%{!?with_lustre_tests:--disable-tests} \
341         %{?with_lustre_utils:--enable-utils}%{!?with_lustre_utils:--disable-utils} \
342         %{?with_lustre_modules:--enable-modules}%{!?with_lustre_modules:--disable-modules} \
343         %{!?with_shared:--disable-shared} \
344         %{!?with_static:--disable-static} \
345         %{!?with_lustre_iokit:--disable-iokit} \
346         %{!?with_ldiskfs:--disable-ldiskfs} \
347         %{!?with_servers:--disable-server} \
348         %{!?with_zfs:--without-zfs} \
349         %{!?with_lnet_dlc:--disable-dlc} \
350         %{!?with_manpages:--disable-manpages} \
351         --with-release=%{release} \
352         --with-linux=%{kdir} \
353         --with-linux-obj=%{kobjdir} \
354         --with-kmp-moddir=%{kmoddir}
355
356 make %{?_smp_mflags} -s %{?make_args}
357
358 %install
359 make install DESTDIR=$RPM_BUILD_ROOT
360
361 :> lustre.files
362
363 %if %{with servers} && %{with lustre_utils}
364 # The .ha_v2 extension identifies the heartbeat resource agent as using
365 # legacy syntax. Install a compatibility symlink to avoid conflicts when
366 # newer-style agents are added.
367 ln -s Lustre.ha_v2 $RPM_BUILD_ROOT%{_sysconfdir}/ha.d/resource.d/Lustre
368 echo '%{_sysconfdir}/ha.d/resource.d/Lustre.ha_v2' >>lustre.files
369 echo '%{_sysconfdir}/ha.d/resource.d/Lustre' >>lustre.files
370 %endif
371
372 %if %{_vendor}=="redhat"
373 # The following scripts are Red Hat specific
374 %if %{with servers}
375 echo '%{_sysconfdir}/sysconfig/lustre' >>lustre.files
376 echo '%{_sysconfdir}/init.d/lustre' >>lustre.files
377 %endif
378 echo '%{_sysconfdir}/init.d/lnet' >>lustre.files
379 %endif
380
381 # Create the pristine source directory.
382 cd $RPM_BUILD_DIR/lustre-%{version}
383 mkdir -p $RPM_BUILD_ROOT%{_prefix}/src
384 rm -f lustre-source
385 ln -s $RPM_BUILD_ROOT%{_prefix}/src lustre-source
386 make distdir distdir=lustre-source/lustre-%{version}
387 chmod -R go-w lustre-source/lustre-%{version}
388 # fc18 needs 'x' permission for library files
389 find $RPM_BUILD_ROOT -name \*.so -type f -exec chmod +x {} \;
390
391 %if %{with lnet_dlc}
392 rm -f $RPM_BUILD_ROOT%{_libdir}/liblnetconfig.la
393 %if %{with static}
394 echo '%attr(-, root, root) %{_libdir}/liblnetconfig.a' >>lustre.files
395 %endif
396 %if %{with shared}
397 echo '%attr(-, root, root) %{_libdir}/liblnetconfig.so' >>lustre.files
398 echo '%attr(-, root, root) %{_libdir}/liblnetconfig.so.*' >>lustre.files
399 %endif
400 %endif
401
402 %if %{with ldiskfs}
403 echo '%{_libdir}/libiam.a' >>lustre.files
404 %endif
405
406 if [ -d $RPM_BUILD_ROOT%{_libdir}/lustre/snmp ] ; then
407         echo '%{_libdir}/lustre/snmp' >>lustre.files
408 fi
409
410 find $RPM_BUILD_ROOT%{_libdir}/@PACKAGE@ \
411     -name \*.la -type f -exec rm -f {} \;
412
413 %if %{with lustre_tests}
414 echo '%{_libdir}/lustre/tests/*' >>lustre-tests.files
415 echo '%{_bindir}/mcreate' >>lustre-tests.files
416 echo '%{_bindir}/munlink' >>lustre-tests.files
417 echo '%{_bindir}/req_layout' >>lustre-tests.files
418 echo '%{_sbindir}/wirecheck' >>lustre-tests.files
419 echo '%{_sbindir}/wiretest' >>lustre-tests.files
420 %if %{with lustre_modules}
421 echo '%{?rootdir}/lib/modules/%{kversion}/%{kmoddir}/kernel/fs/@PACKAGE@/llog_test.ko' >>lustre-tests.files
422 %endif
423 %endif
424
425 %if %{defined cross_path}
426 %if %{defined rpm_post_base}
427 POST_SCRIPT=$RPM_BUILD_DIR/lustre-%{version}/%{post_script}
428 if [ -f $POST_SCRIPT ]; then
429         cp -f $POST_SCRIPT $RPM_BUILD_ROOT/%{rpm_post_base}.sh
430         echo '%attr(0555, root, root) %{rpm_post_base}.sh' >>lustre.files
431         cp -f $POST_SCRIPT $RPM_BUILD_ROOT/%{rpm_post_base}-modules.sh
432 %if %{with ldiskfs}
433         cp -f $POST_SCRIPT $RPM_BUILD_ROOT/%{rpm_post_base}-osd-ldiskfs.sh
434 %if %{with lustre_utils}
435         cp -f $POST_SCRIPT $RPM_BUILD_ROOT/%{rpm_post_base}-mount-osd-ldiskfs.sh
436 %endif
437 %endif
438 %if %{with zfs}
439         cp -f $POST_SCRIPT $RPM_BUILD_ROOT/%{rpm_post_base}-osd-zfs.sh
440 %if %{with lustre_utils}
441         cp -f $POST_SCRIPT $RPM_BUILD_ROOT/%{rpm_post_base}-mount-osd-zfs.sh
442 %endif
443 %endif
444 %if %{with lustre_tests}
445         cp -f $POST_SCRIPT $RPM_BUILD_ROOT/%{rpm_post_base}-tests.sh
446         echo '%attr(0555, root, root) %{rpm_post_base}-tests.sh' >>lustre-tests.files
447 %endif
448 fi
449 %endif
450 %else
451 %if %{with lustre_modules}
452 # mark modules executable for find-debuginfo.sh
453 find $RPM_BUILD_ROOT%{?rootdir}/lib/modules/%{kversion}/%{kmoddir} \
454     -name \*.ko -type f -exec chmod u+x {} \;
455 %endif
456 %endif
457
458 %files -f lustre.files
459 %defattr(-,root,root)
460 %{_sbindir}/*
461 %exclude %{_sbindir}/wirecheck
462 %exclude %{_sbindir}/wiretest
463 %if %{with zfs}
464 %exclude %{_sbindir}/zfsobj2fid
465 %endif
466 %if %{with lustre_utils}
467 %if %{with servers}
468 %{_libexecdir}/lustre/lc_common
469 %{_libexecdir}/lustre/haconfig
470 %{_bindir}/lustre_req_history
471 %endif
472
473 %{_bindir}/llobdstat
474 %{_bindir}/llstat
475 %{_bindir}/plot-llstat
476
477 %{_bindir}/lfs
478 %{_bindir}/lfs_migrate
479 %{?rootdir}/sbin/mount.lustre
480 %{_libdir}/libptlctl.a
481 %{_libdir}/libcfsutil.a
482 %{_libdir}/liblustreapi.a
483 %{_libdir}/liblustreapi.so
484 %if %{with manpages}
485 %{_mandir}/man?/*
486 %endif
487 %{_includedir}/lustre
488 %{_includedir}/libcfs
489 %endif
490 %{_datadir}/lustre
491 %{_sysconfdir}/udev/rules.d/99-lustre.rules
492 %config(noreplace) %{_sysconfdir}/ldev.conf
493 %config(noreplace) %{_sysconfdir}/modprobe.d/ko2iblnd.conf
494
495 %if %{with lustre_modules}
496 %files modules
497 %defattr(-,root,root)
498 %{?rootdir}/lib/modules/%{kversion}/%{kmoddir}/*
499 %if %{with lustre_tests}
500 %exclude %{?rootdir}/lib/modules/%{kversion}/%{kmoddir}/kernel/fs/@PACKAGE@/llog_test.ko
501 %endif
502 %if %{with ldiskfs}
503 %exclude %{?rootdir}/lib/modules/%{kversion}/%{kmoddir}/kernel/fs/@PACKAGE@/ldiskfs.ko
504 %exclude %{?rootdir}/lib/modules/%{kversion}/%{kmoddir}/kernel/fs/@PACKAGE@/osd_ldiskfs.ko
505 %endif
506 %if %{with zfs}
507 %exclude %{?rootdir}/lib/modules/%{kversion}/%{kmoddir}/kernel/fs/@PACKAGE@/osd_zfs.ko
508 %endif
509 %if %{defined rpm_post_base}
510 %attr(0555, root, root) %{rpm_post_base}-modules.sh
511 %endif
512 %doc COPYING
513 %doc ChangeLog-lustre
514 %doc ChangeLog-lnet
515
516 %if %{with ldiskfs}
517 %files osd-ldiskfs
518 %defattr(-,root,root)
519 %{?rootdir}/lib/modules/%{kversion}/%{kmoddir}/kernel/fs/@PACKAGE@/ldiskfs.ko
520 %{?rootdir}/lib/modules/%{kversion}/%{kmoddir}/kernel/fs/@PACKAGE@/osd_ldiskfs.ko
521 %if %{defined rpm_post_base}
522 %attr(0555, root, root) %{rpm_post_base}-osd-ldiskfs.sh
523 %endif
524 %if %{with lustre_utils}
525 %files osd-ldiskfs-mount
526 %defattr(-,root,root)
527 %{_libdir}/@PACKAGE@/mount_osd_ldiskfs.so
528 %if %{defined rpm_post_base}
529 %attr(0555, root, root) %{rpm_post_base}-mount-osd-ldiskfs.sh
530 %endif
531 %endif
532 %endif
533
534 %if %{with zfs}
535 %files osd-zfs
536 %defattr(-,root,root)
537 %{?rootdir}/lib/modules/%{kversion}/%{kmoddir}/kernel/fs/@PACKAGE@/osd_zfs.ko
538 %{_sbindir}/zfsobj2fid
539 %if %{defined rpm_post_base}
540 %attr(0555, root, root) %{rpm_post_base}-osd-zfs.sh
541 %endif
542 %if %{with lustre_utils}
543 %files osd-zfs-mount
544 %defattr(-,root,root)
545 %{_libdir}/@PACKAGE@/mount_osd_zfs.so
546 %if %{defined rpm_post_base}
547 %attr(0555, root, root) %{rpm_post_base}-mount-osd-zfs.sh
548 %endif
549 %endif
550 %endif
551 %endif # with lustre_modules
552
553 %files source
554 %defattr(-,root,root)
555 %{_prefix}/src/lustre-%{version}
556
557 # uncomment these lines to enable deps packages
558 # %files deps-sles
559 # %files deps-rhel
560
561 %if %{with lustre_tests}
562 %files tests -f lustre-tests.files
563 %defattr(-,root,root)
564 %endif
565
566 %if %{with lustre_iokit}
567 %files -n lustre-iokit
568 %defattr(-, root, root)
569 %{_bindir}/iokit-config
570 %{_bindir}/iokit-gather-stats
571 %{_bindir}/iokit-libecho
572 %{_bindir}/iokit-lstats
573 %{_bindir}/iokit-parse-ior
574 %{_bindir}/iokit-plot-obdfilter
575 %{_bindir}/iokit-plot-ost
576 %{_bindir}/iokit-plot-sgpdd
577 %{_bindir}/ior-survey
578 %{_bindir}/mds-survey
579 %{_bindir}/obdfilter-survey
580 %{_bindir}/ost-survey
581 %{_bindir}/sgpdd-survey
582 %doc lustre-iokit/ior-survey/README.ior-survey
583 %doc lustre-iokit/mds-survey/README.mds-survey
584 %doc lustre-iokit/obdfilter-survey/README.obdfilter-survey
585 %doc lustre-iokit/ost-survey/README.ost-survey
586 %doc lustre-iokit/sgpdd-survey/README.sgpdd-survey
587 %doc lustre-iokit/stats-collect/README.iokit-lstats
588 %endif
589
590 %if %{defined rpm_post_base}
591 %post
592 if [ -x %{rpm_post_base}.sh ]; then
593         %{rpm_post_base}.sh %{cross_path} create
594 fi
595
596 %preun
597 if [ -x %{rpm_post_base}.sh ]; then
598         %{rpm_post_base}.sh %{cross_path} remove
599 fi
600 %endif
601
602 %if %{with lustre_modules}
603 %post modules
604 %if %{defined rpm_post_base}
605 if [ -x %{rpm_post_base}-modules.sh ]; then
606         %{rpm_post_base}-modules.sh %{cross_path} create
607 fi
608 %else
609 if [ -f /boot/System.map-%{kversion} ]; then
610         depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
611 else
612         depmod -ae %{kversion} || exit 0
613 fi
614
615 MODULES_RPM_NAME=$(rpm -q %{name}-modules | grep "%{version}-%{release}")
616 # "weak modules" support
617 # Suse
618 if [ -x /usr/lib/module-init-tools/weak-modules ]; then
619     rpm -ql $MODULES_RPM_NAME | grep '\.ko$' |
620         /usr/lib/module-init-tools/weak-modules --add-modules
621 fi
622 # RedHat
623 if [ -x /sbin/weak-modules ]; then
624     rpm -ql $MODULES_RPM_NAME | grep '\.ko$' |
625         /sbin/weak-modules --add-modules
626 fi
627
628 # If the kernel was built to reject unsupported modules (e.g. not a Lustre
629 # kernel), and this hasn't been overridden in /etc/modprobe.d yet, then
630 # print a warning so that users are aware of this issue.
631 if sysctl kernel.unsupported >/dev/null 2>&1 &&
632    [ "$(sysctl -n kernel.unsupported 2>/dev/null)" = "0" ] &&
633     ! modprobe -c | grep -q "^allow_unsupported_modules[ \t]1" ; then
634      echo "
635      warning: the Lustre modules are not supported by Novell. To use Lustre
636               on this system, you should put
637
638      allow_unsupported_modules 1
639
640      into /etc/modprobe.d/unsupported_modules"
641 fi
642 %endif
643
644 %if %{with ldiskfs}
645 %post osd-ldiskfs
646 %if %{defined rpm_post_base}
647 if [ -x %{rpm_post_base}-osd-ldiskfs.sh ]; then
648         %{rpm_post_base}-osd-ldiskfs.sh %{cross_path} create
649 fi
650 %else
651 if [ -f /boot/System.map-%{kversion} ]; then
652        depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
653 else
654        depmod -ae %{kversion} || exit 0
655 fi
656
657 OSD_LDISKFS_RPM_NAME=$(rpm -q %{name}-osd-ldiskfs | grep "%{version}-%{release}")
658 # "weak modules" support
659 # Suse
660 if [ -x /usr/lib/module-init-tools/weak-modules ]; then
661     rpm -ql $OSD_LDISKFS_RPM_NAME | grep '\.ko$' |
662         /usr/lib/module-init-tools/weak-modules --add-modules
663 fi
664 # RedHat
665 if [ -x /sbin/weak-modules ]; then
666     rpm -ql $OSD_LDISKFS_RPM_NAME | grep '\.ko$' |
667         /sbin/weak-modules --add-modules
668 fi
669
670 # If the kernel was built to reject unsupported modules (e.g. not a Lustre
671 # kernel), and this hasn't been overridden in /etc/modprobe.d yet, then
672 # print a warning so that users are aware of this issue.
673 if sysctl kernel.unsupported >/dev/null 2>&1 &&
674    [ "$(sysctl -n kernel.unsupported 2>/dev/null)" = "0" ] &&
675     ! modprobe -c | grep -q "^allow_unsupported_modules[ \t]1" ; then
676      echo "
677      warning: the Lustre modules are not supported by Novell. To use Lustre
678               on this system, you should put
679
680      allow_unsupported_modules 1
681
682      into /etc/modprobe.d/unsupported_modules"
683 fi
684 %endif
685 %if %{with lustre_utils} && %{defined rpm_post_base}
686 %post osd-ldiskfs-mount
687 if [ -x %{rpm_post_base}-mount-osd-ldiskfs.sh ]; then
688         %{rpm_post_base}-mount-osd-ldiskfs.sh %{cross_path} create
689 fi
690 %endif
691 %endif
692
693 %if %{with zfs}
694 %post osd-zfs
695 %if %{defined rpm_post_base}
696 if [ -x %{rpm_post_base}-osd-zfs.sh ]; then
697         %{rpm_post_base}-osd-zfs.sh %{cross_path} create
698 fi
699 %else
700 if [ -f /boot/System.map-%{kversion} ]; then
701        depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
702 else
703        depmod -ae %{kversion} || exit 0
704 fi
705
706 OSD_ZFS_RPM_NAME=$(rpm -q %{name}-osd-zfs | grep "%{version}-%{release}")
707 # "weak modules" support
708 # Suse
709 if [ -x /usr/lib/module-init-tools/weak-modules ]; then
710     rpm -ql $OSD_ZFS_RPM_NAME | grep '\.ko$' |
711         /usr/lib/module-init-tools/weak-modules --add-modules
712 fi
713 # RedHat
714 if [ -x /sbin/weak-modules ]; then
715     rpm -ql $OSD_ZFS_RPM_NAME | grep '\.ko$' |
716         /sbin/weak-modules --add-modules
717 fi
718
719 # If the kernel was built to reject unsupported modules (e.g. not a Lustre
720 # kernel), and this hasn't been overridden in /etc/modprobe.d yet, then
721 # print a warning so that users are aware of this issue.
722 if sysctl kernel.unsupported >/dev/null 2>&1 &&
723    [ "$(sysctl -n kernel.unsupported 2>/dev/null)" = "0" ] &&
724     ! modprobe -c | grep -q "^allow_unsupported_modules[ \t]1" ; then
725      echo "
726      warning: the Lustre modules are not supported by Novell. To use Lustre
727               on this system, you should put
728
729      allow_unsupported_modules 1
730
731      into /etc/modprobe.d/unsupported_modules"
732 fi
733 %endif
734 %if %{with lustre_utils} && %{defined rpm_post_base}
735 %post osd-zfs-mount
736 if [ -x %{rpm_post_base}-mount-osd-zfs.sh ]; then
737         %{rpm_post_base}-mount-osd-zfs.sh %{cross_path} create
738 fi
739 %endif
740 %endif
741
742 %preun modules
743 %if %{defined rpm_post_base}
744 if [ -x %{rpm_post_base}-modules.sh ]; then
745         %{rpm_post_base}-modules.sh %{cross_path} remove
746 fi
747 %else
748 MODULES_RPM_NAME=$(rpm -q %{name}-modules | grep "%{version}-%{release}")
749 rpm -ql $MODULES_RPM_NAME | grep '\.ko$' > /var/run/%{name}-modules || true
750 %endif
751
752 %if %{with ldiskfs}
753 %preun osd-ldiskfs
754 %if %{defined rpm_post_base}
755 if [ -x %{rpm_post_base}-osd-ldiskfs.sh ]; then
756         %{rpm_post_base}-osd-ldiskfs.sh %{cross_path} remove
757 fi
758 %else
759 OSD_LDISKFS_RPM_NAME=$(rpm -q %{name}-osd-ldiskfs | grep "%{version}-%{release}")
760 rpm -ql $OSD_LDISKFS_RPM_NAME | grep '\.ko$' > /var/run/%{name}-osd-ldiskfs || true
761 %endif
762 %if %{with lustre_utils} && %{defined rpm_post_base}
763 %preun osd-ldiskfs-mount
764 if [ -x %{rpm_post_base}-mount-osd-ldiskfs.sh ]; then
765         %{rpm_post_base}-mount-osd-ldiskfs.sh %{cross_path} remove
766 fi
767 %endif
768 %endif
769
770 %if %{with zfs}
771 %preun osd-zfs
772 %if %{defined rpm_post_base}
773 if [ -x %{rpm_post_base}-osd-zfs.sh ]; then
774         %{rpm_post_base}-osd-zfs.sh %{cross_path} remove
775 fi
776 %else
777 OSD_ZFS_RPM_NAME=$(rpm -q %{name}-osd-zfs | grep "%{version}-%{release}")
778 rpm -ql $OSD_ZFS_RPM_NAME | grep '\.ko$' > /var/run/%{name}-osd-zfs || true
779 %endif
780 %if %{with lustre_utils} && %{defined rpm_post_base}
781 %preun osd-zfs-mount
782 if [ -x %{rpm_post_base}-mount-osd-zfs.sh ]; then
783         %{rpm_post_base}-mount-osd-zfs.sh %{cross_path} remove
784 fi
785 %endif
786 %endif
787
788 %if %{undefined cross_path}
789 %postun modules
790 if [ -f /boot/System.map-%{kversion} ]; then
791         depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
792 else
793         depmod -ae %{kversion} || exit 0
794 fi
795
796 # "weak modules" support
797 # Suse
798 if [ -x /usr/lib/module-init-tools/weak-modules ]; then
799     cat /var/run/%{name}-modules |
800         /usr/lib/module-init-tools/weak-modules --remove-modules
801 fi
802 # RedHat
803 if [ -x /sbin/weak-modules ]; then
804     cat /var/run/%{name}-modules |
805         /sbin/weak-modules --remove-modules
806 fi
807 rm /var/run/%{name}-modules
808
809 %if %{with ldiskfs}
810 %postun osd-ldiskfs
811 if [ -f /boot/System.map-%{kversion} ]; then
812        depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
813 else
814        depmod -ae %{kversion} || exit 0
815 fi
816
817 # "weak modules" support
818 # Suse
819 if [ -x /usr/lib/module-init-tools/weak-modules ]; then
820     cat /var/run/%{name}-osd-ldiskfs |
821         /usr/lib/module-init-tools/weak-modules --remove-modules
822 fi
823 # RedHat
824 if [ -x /sbin/weak-modules ]; then
825     cat /var/run/%{name}-osd-ldiskfs |
826         /sbin/weak-modules --remove-modules
827 fi
828 rm /var/run/%{name}-osd-ldiskfs
829 %endif
830
831 %if %{with zfs}
832 %postun osd-zfs
833 if [ -f /boot/System.map-%{kversion} ]; then
834        depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
835 else
836        depmod -ae %{kversion} || exit 0
837 fi
838
839 # "weak modules" support
840 # Suse
841 if [ -x /usr/lib/module-init-tools/weak-modules ]; then
842     cat /var/run/%{name}-osd-zfs |
843         /usr/lib/module-init-tools/weak-modules --remove-modules
844 fi
845 # RedHat
846 if [ -x /sbin/weak-modules ]; then
847     cat /var/run/%{name}-osd-zfs |
848         /sbin/weak-modules --remove-modules
849 fi
850 rm /var/run/%{name}-osd-zfs
851 %endif
852 %endif
853 %endif # with lustre_modules
854
855 %if %{with lustre_tests}
856 %if %{defined rpm_post_base}
857 %post tests
858 if [ -x %{rpm_post_base}-tests.sh ]; then
859         %{rpm_post_base}-tests.sh %{cross_path} create
860 fi
861
862 %preun tests
863 if [ -x %{rpm_post_base}-tests.sh ]; then
864         %{rpm_post_base}-tests.sh %{cross_path} remove
865 fi
866 %else
867 %if %{with lustre_modules}
868 %post tests
869 if [ -f /boot/System.map-%{kversion} ]; then
870         depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
871 else
872         depmod -ae %{kversion} || exit 0
873 fi
874
875 %postun tests
876 if [ -f /boot/System.map-%{kversion} ]; then
877         depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
878 else
879         depmod -ae %{kversion} || exit 0
880 fi
881 %endif
882 %endif
883 %endif
884
885 %clean
886 rm -rf $RPM_BUILD_ROOT