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