2 %{!?version: %global version @VERSION@}
3 %{!?kver: %global kver ""}
4 %{!?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)}
6 %{!?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)}
8 # as an alternative to this implementation we could simply "make -C $kdir kernelversion"
9 %{!?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)}
11 %{!?downstream_release: %global downstream_release "@DOWNSTREAM_RELEASE@"}
13 %define buildid %(if [ -n "@BUILDID@" ]; then echo "_@BUILDID@"; fi)
15 %{!?myrelease: %global myrelease %(if [ -n "%downstream_release" ]; then echo -n "%{downstream_release}_"; fi; echo %kversion | tr '-' '_')}
17 # always append the buildid, even when the caller defines %release
18 %define fullrelease %{myrelease}%{buildid}
20 %{!?lustre_name: %global lustre_name lustre}
21 %{!?build_lustre_tests: %global build_lustre_tests 1}
23 %{!?build_lustre_osd_ldiskfs: %global build_lustre_osd_ldiskfs 0}
24 %{!?build_lustre_osd_zfs: %global build_lustre_osd_zfs 0}
26 # in order to get kernel symset and/or kernel module dependencies into
27 # the RPM, in order to support weak-modules, the internal dependency gen-
28 # erator needs to be disabled
29 # this is done with (reduce the double % down to a single %):
31 # %%global _use_internal_dependency_generator 0
33 # on SLES10, /usr/lib/rpm/macros already sets this, so no harm in also
34 # defining it here (until Suse changes their mind)
36 # on RHEL5, however, we do need to explicitly disable the internal dep-
37 # endency generator and allow the external one be used
38 # but since RedHat's kABI is only a subset of the total kernel ABI, it
39 # doesn't include all of the symbols we (or OFED for that matter) need
40 # until RedHat includes all of the symbols we need in their symsets we
41 # cannot support weak-modules
42 # we did e-mail the maintainer of all of this stuff @redhat but got no
44 #%%global _use_internal_dependency_generator 0
46 %define is_client %(bash -c "if [[ %{lustre_name} = *-client ]]; then echo -n '1'; else echo -n '0'; fi")
47 # for those uses that don't want the -smp/-bigsmp (or the .arch) on the end
49 %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$//'")
51 %define sles10 %(bash -c "if [ "%sles_version" = "10" ]; then echo -n '1'; else echo -n '0'; fi")
54 %define flavor %(bash -c "echo %{kversion} | sed -e 's/^.*-//'")
58 %define build_lustre_osd_ldiskfs 0
59 %define build_lustre_osd_zfs 0
62 Summary: Lustre File System
65 Release: %{fullrelease}
67 Group: Utilities/System
68 Source: lustre-%{version}.tar.gz
69 URL: http://wiki.whamcloud.com/
70 BuildRoot: %{_tmppath}/lustre-%{version}-root
71 Obsoletes: lustre-lite, lustre-lite-utils, lustre-ldap nfs-utils-lustre
72 Provides: lustre-lite = %{version}, lustre-lite-utils = %{version}
73 Requires: %{name}-modules = %{version}
74 # GSS requires this: BuildRequires: pkgconfig, libgssapi-devel >= 0.10
77 Userspace tools and files for the Lustre file system.
80 Summary: Kernel Lustre modules for Linux %{kversion}
81 # for SLES11, we need nothing here
82 # for SLES10, we need (where %{flavor} is, i.e. smp):
84 Requires: kernel-%{flavor}
86 %if %{_vendor}=="redhat" || %{_vendor}=="fedora"
87 # for RHEL we need to require the specific kernel still since weak-modules
88 # support on RH is, well, weak, to be punny about it
89 Requires: kernel = %{krequires}
95 Group: Development/Kernel
98 Lustre file system, server and network drivers for Linux %{kversion}.
100 %if %{build_lustre_osd_ldiskfs}
102 Summary: osd-ldiskfs is the mandatory glue for LDISKFS support in Lustre.
103 Requires: lustre-modules = %{version}, lustre-ldiskfs
105 Group: Development/Kernel
107 %description osd-ldiskfs
108 The Lustre Object Storage Device (OSD) API is the interface to access and
109 modify data that is supposed to be stored persistently. This API is the interface
110 to code that bridges individual file systems. This specific package provides an
111 implementation of the OSD API for using the Ldiskfs filesystem as the underlying
112 backing store of a Lustre server.
115 %if %{build_lustre_osd_zfs}
117 Summary: osd-zfs is the mandatory glue for ZFS support in Lustre.
118 Requires: lustre-modules = %{version}, zfs-modules
120 Group: Development/Kernel
123 The Lustre Object Storage Device (OSD) API is the interface to access and
124 modify data that is supposed to be stored persistently. This API is the interface
125 to code that bridges individual file systems. This specific package provides an
126 implementation of the OSD API for using the ZFS filesystem as the underlying
127 backing store of a Lustre server.
131 Summary: Object-Based Disk storage driver source
132 Group: Development/Kernel
135 Lustre sources for further development
137 # Since the RPMs we ship are to be used on both SLES and RHEL, we
138 # can't include any dependency information (since the package names
139 # are different on the two platforms).
141 # Instead, we can build these empty meta-packages that only include
142 # dependency information. These let people get the correct
143 # dependencies for their platform and lets them use tools like yum and
144 # red carpet to install the correct files.
146 # Unfortunately I have not seen this come up on the lists much, so I
147 # have disabled them (by commenting out their empty files section
148 # below) until it's clear that they resolve more confusion than they
152 Summary: Lustre dependencies meta-package for SLES
153 Group: Utilities/System
154 Provides: lustre-deps = %{version}
155 Requires: %{name} = %{version}, sles-release
156 Conflicts: %{name}-deps-rhel
158 %description deps-sles
159 This package has RPM dependencies appropriate for SLES systems.
162 Summary: Lustre dependencies meta-package for RHEL
163 Group: Utilities/System
164 Provides: lustre-deps = %{version}
165 Requires: %{name} = %{version}, redhat-release
166 Conflicts: %{name}-deps-sles
168 %description deps-rhel
169 This package has RPM dependencies appropriate for RHEL, RHL, and FC
173 Summary: Lustre testing framework
174 Group: Development/Kernel
175 Provides: %{name}-tests = %{version}
176 Requires: %{name} = %{version}, %{name}-modules = %{version}
179 This package contains a set of test binaries and scripts that are intended
180 to be used by the Lustre testing framework.
182 %if 0%{?suse_version}
186 %setup -qn lustre-%{version}
187 ln lustre/ChangeLog ChangeLog-lustre
188 ln lnet/ChangeLog ChangeLog-lnet
191 # if RPM_BUILD_NCPUS unset, set it
192 if [ -z "$RPM_BUILD_NCPUS" ] ; then
193 RPM_BUILD_NCPUS=$(egrep -c "^cpu[0-9]+" /proc/stat 2>/dev/null || echo 0 :)
194 if [ $RPM_BUILD_NCPUS -eq 0 ] ; then
197 if [ $RPM_BUILD_NCPUS -gt 8 ] ; then
202 rm -rf $RPM_BUILD_ROOT
204 # Set an explicit path to our Linux tree, if we can.
205 cd $RPM_BUILD_DIR/lustre-%{version}
206 # override %optflags so that the vendor's overzealous flags don't create
208 %define optflags -g -O2 -Werror
209 CONFIGURE_ARGS="%{?configure_args} --with-release=%release"
210 %if %{build_lustre_tests}
211 CONFIGURE_ARGS="$CONFIGURE_ARGS --enable-tests --enable-liblustre-tests"
213 CONFIGURE_ARGS="$CONFIGURE_ARGS --disable-tests --disable-liblustre-tests"
216 # if %%kdir was given, make sure it's not in the configure arguments
217 if [ -n "%kdir" ]; then
218 CONFIGURE_ARGS=$(echo $CONFIGURE_ARGS | sed -e 's/"\?--with-linux=[^ ][^ ]* \?//')
220 # ditto for %%kobjdir
221 if [ -n "%kobjdir" ]; then
222 CONFIGURE_ARGS=$(echo $CONFIGURE_ARGS | sed -e 's/"\?--with-linux-obj=[^ ][^ ]* \?//')
225 # we need to eval "configure" because $CONFIGURE_ARGS could have a quoted
226 # string in it which we don't want word splitted by the shell
227 %define eval_configure %(echo '%configure' | sed -e 's#\./configure#eval ./configure#')
230 %{?kdir: --with-linux=%kdir} %{?kobjdir: --with-linux-obj=%kobjdir} \
232 make -j $RPM_BUILD_NCPUS -s
235 make install DESTDIR=$RPM_BUILD_ROOT
236 # hack to avoid changing the libsysio code for "make install"
237 rm -f $RPM_BUILD_ROOT%{_libdir}/libsysio.a
238 # Remove ldiskfs module(s) - they are packaged by the ldiskfs .spec.
239 rm -rf $RPM_BUILD_ROOT/lib/modules/%{kversion}/updates/kernel/fs/lustre-ldiskfs
241 # hack to include the llog_test module in lustre-tests
242 llog_base=$RPM_BUILD_DIR/lustre-%{version}/lustre/obdclass/llog_test
243 if [ -e ${llog_base}.ko ]; then
244 cp ${llog_base}.ko $RPM_BUILD_ROOT/lib/modules/%{kversion}/updates/kernel/fs/lustre
245 elif [ -e ${llog_base}.o ]; then
246 cp ${llog_base}.o $RPM_BUILD_ROOT/lib/modules/%{kversion}/updates/kernel/fs/lustre
249 # The .ha_v2 extension identifies the heartbeat resource agent as using
250 # legacy syntax. Install a compatibility symlink to avoid conflicts when
251 # newer-style agents are added.
252 ln -s Lustre.ha_v2 $RPM_BUILD_ROOT/etc/ha.d/resource.d/Lustre
254 # Create the pristine source directory.
255 cd $RPM_BUILD_DIR/lustre-%{version}
256 mkdir -p $RPM_BUILD_ROOT/usr/src
258 ln -s $RPM_BUILD_ROOT/usr/src lustre-source
259 make distdir distdir=lustre-source/lustre-%{version}
260 chmod -R go-w lustre-source/lustre-%{version}
261 # fc18 needs 'x' permission for library files
262 find $RPM_BUILD_ROOT -name '*.so' | xargs chmod +x
264 cat >lustre.files <<EOF
265 %attr(-, root, root) /sbin/mount.lustre
266 %attr(-, root, root) /usr/sbin/*
267 %attr(-, root, root) /usr/bin/*
269 %attr(-, root, root) /usr/share/lustre
271 %attr(-, root, root) %{_libdir}/libptlctl.a
272 %attr(-, root, root) %{_libdir}/liblustreapi.a
273 %attr(-, root, root) %{_libdir}/liblustreapi.so
274 %attr(-, root, root) /usr/include/lustre
275 %attr(-, root, root) /usr/include/libcfs
277 %attr(-, root, root) %{_mandir}/man?/*
279 %attr(-, root, root) %{_libexecdir}/lustre/lc_common
281 %attr(-, root, root) %{_sysconfdir}/udev/rules.d/99-lustre.rules
283 %attr(-, root, root) %{_sysconfdir}/init.d/lnet
284 %attr(-, root, root) %{_sysconfdir}/init.d/lustre
285 %attr(-, root, root) %config(noreplace) %{_sysconfdir}/ldev.conf
286 %attr(-, root, root) %{_sysconfdir}/sysconfig/lustre
287 %attr(-, root, root) %{_libexecdir}/lustre/haconfig
288 %attr(-, root, root) %{_sysconfdir}/ha.d/resource.d/Lustre.ha_v2
289 %attr(-, root, root) %{_sysconfdir}/ha.d/resource.d/Lustre
292 if [ -f $RPM_BUILD_ROOT%{_libdir}/libcfsutil.a ] ; then
293 echo '%attr(-, root, root) %{_libdir}/libcfsutil.a' >>lustre.files
296 if [ -f $RPM_BUILD_ROOT%{_libdir}/liblustre.so ] ; then
297 echo '%attr(-, root, root) %{_libdir}/liblustre.a' >>lustre.files
298 echo '%attr(-, root, root) %{_libdir}/liblustre.so' >>lustre.files
301 if [ -f $RPM_BUILD_ROOT%{_libdir}/libiam.a ] ; then
302 echo '%attr(-, root, root) %{_libdir}/libiam.a' >>lustre.files
305 if [ -d $RPM_BUILD_ROOT%{_libdir}/lustre/snmp ] ; then
306 echo '%attr(-, root, root) %{_libdir}/lustre/snmp' >>lustre.files
307 echo '%attr(-, root, root) %{_datadir}/lustre/snmp/mibs' >>lustre.files
310 # Have universal lustre headers
311 if [ -f $RPM_BUILD_DIR/lustre-%{version}/lustre/include/lustre/lustre_idl.h ] ; then
312 echo '%attr(-, root, root) /usr/include/linux/lustre_user.h' >>lustre.files
314 echo '%attr(-, root, root) /usr/include/linux/lustre_idl.h' >>lustre.files
317 if [ -f $RPM_BUILD_DIR/lustre-%{version}/lustre/include/linux/lustre_types.h ] ; then
318 echo '%attr(-, root, root) /usr/include/linux/lustre_types.h' >>lustre.files
321 %if %{build_lustre_tests}
322 echo '%attr(-, root, root) %{_libdir}/lustre/tests/*' >lustre-tests.files
323 echo '%attr(-, root, root) /lib/modules/%{kversion}/updates/kernel/fs/lustre/llog_test.*' >>lustre-tests.files
324 if [ -d $RPM_BUILD_ROOT%{_libdir}/lustre/liblustre/tests ] ; then
325 echo '%attr(-, root, root) %{_libdir}/lustre/liblustre/tests/*' >>lustre-tests.files
329 # mark modules executable for find-debuginfo.sh
330 find $RPM_BUILD_ROOT/lib/modules/%{kversion}/updates -name "*.ko" -type f | \
331 xargs --no-run-if-empty chmod u+x
333 %files -f lustre.files
336 %attr(-, root, root) /lib/modules/%{kversion}/updates/*
337 %if %{build_lustre_tests}
338 %exclude /lib/modules/%{kversion}/updates/kernel/fs/lustre/llog_test.ko
340 %if %{build_lustre_osd_ldiskfs}
341 %exclude /lib/modules/%{kversion}/updates/kernel/fs/lustre/osd_ldiskfs.ko
343 %if %{build_lustre_osd_zfs}
344 %exclude /lib/modules/%{kversion}/updates/kernel/fs/lustre/osd_zfs.ko
346 %attr(-, root, root) %doc COPYING
347 %attr(-, root, root) %doc ChangeLog-lustre
348 %attr(-, root, root) %doc ChangeLog-lnet
350 %if %{build_lustre_osd_ldiskfs}
352 %attr(-, root, root) /lib/modules/%{kversion}/updates/kernel/fs/lustre/osd_ldiskfs.ko
355 %if %{build_lustre_osd_zfs}
357 %attr(-, root, root) /lib/modules/%{kversion}/updates/kernel/fs/lustre/osd_zfs.ko
361 %attr(-, root, root) /usr/src/lustre-%{version}
363 # uncomment these lines to enable deps packages
367 %if %{build_lustre_tests}
368 %files tests -f lustre-tests.files
372 if [ -f /boot/System.map-%{kversion} ]; then
373 depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
375 depmod -ae %{kversion} || exit 0
378 MODULES_RPM_NAME=$(rpm -q %{name}-modules | grep "%{version}-%{release}")
379 # "weak modules" support
381 if [ -x /usr/lib/module-init-tools/weak-modules ]; then
382 rpm -ql $MODULES_RPM_NAME | grep '\.ko$' |
383 /usr/lib/module-init-tools/weak-modules --add-modules
386 if [ -x /sbin/weak-modules ]; then
387 rpm -ql $MODULES_RPM_NAME | grep '\.ko$' |
388 /sbin/weak-modules --add-modules
391 # If the kernel was built to reject unsupported modules (e.g. not a Lustre
392 # kernel), and this hasn't been overridden in /etc/modprobe.d yet, then
393 # print a warning so that users are aware of this issue.
394 if sysctl kernel.unsupported >/dev/null 2>&1 &&
395 [ "$(sysctl -n kernel.unsupported 2>/dev/null)" = "0" ] &&
396 ! modprobe -c | grep -q "^allow_unsupported_modules[ \t]1" ; then
398 warning: the Lustre modules are not supported by Novell. To use Lustre
399 on this system, you should put
401 allow_unsupported_modules 1
403 into /etc/modprobe.d/unsupported_modules"
406 %if %{build_lustre_osd_ldiskfs}
408 if [ -f /boot/System.map-%{kversion} ]; then
409 depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
411 depmod -ae %{kversion} || exit 0
414 OSD_LDISKFS_RPM_NAME=$(rpm -q %{name}-osd-ldiskfs | grep "%{version}-%{release}")
415 # "weak modules" support
417 if [ -x /usr/lib/module-init-tools/weak-modules ]; then
418 rpm -ql $OSD_LDISKFS_RPM_NAME | grep '\.ko$' |
419 /usr/lib/module-init-tools/weak-modules --add-modules
422 if [ -x /sbin/weak-modules ]; then
423 rpm -ql $OSD_LDISKFS_RPM_NAME | grep '\.ko$' |
424 /sbin/weak-modules --add-modules
427 # If the kernel was built to reject unsupported modules (e.g. not a Lustre
428 # kernel), and this hasn't been overridden in /etc/modprobe.d yet, then
429 # print a warning so that users are aware of this issue.
430 if sysctl kernel.unsupported >/dev/null 2>&1 &&
431 [ "$(sysctl -n kernel.unsupported 2>/dev/null)" = "0" ] &&
432 ! modprobe -c | grep -q "^allow_unsupported_modules[ \t]1" ; then
434 warning: the Lustre modules are not supported by Novell. To use Lustre
435 on this system, you should put
437 allow_unsupported_modules 1
439 into /etc/modprobe.d/unsupported_modules"
443 %if %{build_lustre_osd_zfs}
445 if [ -f /boot/System.map-%{kversion} ]; then
446 depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
448 depmod -ae %{kversion} || exit 0
451 OSD_ZFS_RPM_NAME=$(rpm -q %{name}-osd-zfs | grep "%{version}-%{release}")
452 # "weak modules" support
454 if [ -x /usr/lib/module-init-tools/weak-modules ]; then
455 rpm -ql $OSD_ZFS_RPM_NAME | grep '\.ko$' |
456 /usr/lib/module-init-tools/weak-modules --add-modules
459 if [ -x /sbin/weak-modules ]; then
460 rpm -ql $OSD_ZFS_RPM_NAME | grep '\.ko$' |
461 /sbin/weak-modules --add-modules
464 # If the kernel was built to reject unsupported modules (e.g. not a Lustre
465 # kernel), and this hasn't been overridden in /etc/modprobe.d yet, then
466 # print a warning so that users are aware of this issue.
467 if sysctl kernel.unsupported >/dev/null 2>&1 &&
468 [ "$(sysctl -n kernel.unsupported 2>/dev/null)" = "0" ] &&
469 ! modprobe -c | grep -q "^allow_unsupported_modules[ \t]1" ; then
471 warning: the Lustre modules are not supported by Novell. To use Lustre
472 on this system, you should put
474 allow_unsupported_modules 1
476 into /etc/modprobe.d/unsupported_modules"
481 MODULES_RPM_NAME=$(rpm -q %{name}-modules | grep "%{version}-%{release}")
482 rpm -ql $MODULES_RPM_NAME | grep '\.ko$' > /var/run/%{name}-modules || true
484 %if %{build_lustre_osd_ldiskfs}
486 OSD_LDISKFS_RPM_NAME=$(rpm -q %{name}-osd-ldiskfs | grep "%{version}-%{release}")
487 rpm -ql $OSD_LDISKFS_RPM_NAME | grep '\.ko$' > /var/run/%{name}-osd-ldiskfs || true
490 %if %{build_lustre_osd_zfs}
492 OSD_ZFS_RPM_NAME=$(rpm -q %{name}-osd-zfs | grep "%{version}-%{release}")
493 rpm -ql $OSD_ZFS_RPM_NAME | grep '\.ko$' > /var/run/%{name}-osd-zfs || true
497 if [ -f /boot/System.map-%{kversion} ]; then
498 depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
500 depmod -ae %{kversion} || exit 0
503 # "weak modules" support
505 if [ -x /usr/lib/module-init-tools/weak-modules ]; then
506 cat /var/run/%{name}-modules |
507 /usr/lib/module-init-tools/weak-modules --remove-modules
510 if [ -x /sbin/weak-modules ]; then
511 cat /var/run/%{name}-modules |
512 /sbin/weak-modules --remove-modules
514 rm /var/run/%{name}-modules
516 %if %{build_lustre_osd_ldiskfs}
518 if [ -f /boot/System.map-%{kversion} ]; then
519 depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
521 depmod -ae %{kversion} || exit 0
524 # "weak modules" support
526 if [ -x /usr/lib/module-init-tools/weak-modules ]; then
527 cat /var/run/%{name}-osd-ldiskfs |
528 /usr/lib/module-init-tools/weak-modules --remove-modules
531 if [ -x /sbin/weak-modules ]; then
532 cat /var/run/%{name}-osd-ldiskfs |
533 /sbin/weak-modules --remove-modules
535 rm /var/run/%{name}-osd-ldiskfs
538 %if %{build_lustre_osd_zfs}
540 if [ -f /boot/System.map-%{kversion} ]; then
541 depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
543 depmod -ae %{kversion} || exit 0
546 # "weak modules" support
548 if [ -x /usr/lib/module-init-tools/weak-modules ]; then
549 cat /var/run/%{name}-osd-zfs |
550 /usr/lib/module-init-tools/weak-modules --remove-modules
553 if [ -x /sbin/weak-modules ]; then
554 cat /var/run/%{name}-osd-zfs |
555 /sbin/weak-modules --remove-modules
557 rm /var/run/%{name}-osd-zfs
560 %if %{build_lustre_tests}
562 if [ -f /boot/System.map-%{kversion} ]; then
563 depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
565 depmod -ae %{kversion} || exit 0
569 if [ -f /boot/System.map-%{kversion} ]; then
570 depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
572 depmod -ae %{kversion} || exit 0
577 rm -rf $RPM_BUILD_ROOT