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 1}
24 %{!?build_lustre_osd_zfs: %global build_lustre_osd_zfs 1}
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}
262 cat >lustre.files <<EOF
263 %attr(-, root, root) /sbin/mount.lustre
264 %attr(-, root, root) /usr/sbin/*
265 %attr(-, root, root) /usr/bin/*
267 %attr(-, root, root) /usr/share/lustre
269 %attr(-, root, root) %{_libdir}/libptlctl.a
270 %attr(-, root, root) %{_libdir}/liblustreapi.a
271 %attr(-, root, root) %{_libdir}/liblustreapi.so
272 %attr(-, root, root) /usr/include/lustre
273 %attr(-, root, root) /usr/include/libcfs
275 %attr(-, root, root) %{_mandir}/man?/*
277 %attr(-, root, root) %{_libexecdir}/lustre/lc_common
279 %attr(-, root, root) %{_sysconfdir}/udev/rules.d/99-lustre.rules
281 %attr(-, root, root) %{_sysconfdir}/init.d/lnet
282 %attr(-, root, root) %{_sysconfdir}/init.d/lustre
283 %attr(-, root, root) %config(noreplace) %{_sysconfdir}/ldev.conf
284 %attr(-, root, root) %{_sysconfdir}/sysconfig/lustre
285 %attr(-, root, root) %{_libexecdir}/lustre/haconfig
286 %attr(-, root, root) %{_sysconfdir}/ha.d/resource.d/Lustre.ha_v2
287 %attr(-, root, root) %{_sysconfdir}/ha.d/resource.d/Lustre
290 if [ -f $RPM_BUILD_ROOT%{_libdir}/libcfsutil.a ] ; then
291 echo '%attr(-, root, root) %{_libdir}/libcfsutil.a' >>lustre.files
294 if [ -f $RPM_BUILD_ROOT%{_libdir}/liblustre.so ] ; then
295 echo '%attr(-, root, root) %{_libdir}/liblustre.a' >>lustre.files
296 echo '%attr(-, root, root) %{_libdir}/liblustre.so' >>lustre.files
299 if [ -f $RPM_BUILD_ROOT%{_libdir}/libiam.a ] ; then
300 echo '%attr(-, root, root) %{_libdir}/libiam.a' >>lustre.files
303 if [ -d $RPM_BUILD_ROOT%{_libdir}/lustre/snmp ] ; then
304 echo '%attr(-, root, root) %{_libdir}/lustre/snmp' >>lustre.files
305 echo '%attr(-, root, root) %{_datadir}/lustre/snmp/mibs' >>lustre.files
308 # Have universal lustre headers
309 if [ -f $RPM_BUILD_DIR/lustre-%{version}/lustre/include/lustre/lustre_idl.h ] ; then
310 echo '%attr(-, root, root) /usr/include/linux/lustre_user.h' >>lustre.files
312 echo '%attr(-, root, root) /usr/include/linux/lustre_idl.h' >>lustre.files
315 if [ -f $RPM_BUILD_DIR/lustre-%{version}/lustre/include/linux/lustre_types.h ] ; then
316 echo '%attr(-, root, root) /usr/include/linux/lustre_types.h' >>lustre.files
319 %if %{build_lustre_tests}
320 echo '%attr(-, root, root) %{_libdir}/lustre/tests/*' >lustre-tests.files
321 echo '%attr(-, root, root) /lib/modules/%{kversion}/updates/kernel/fs/lustre/llog_test.*' >>lustre-tests.files
322 if [ -d $RPM_BUILD_ROOT%{_libdir}/lustre/liblustre/tests ] ; then
323 echo '%attr(-, root, root) %{_libdir}/lustre/liblustre/tests/*' >>lustre-tests.files
327 # mark modules executable for find-debuginfo.sh
328 find $RPM_BUILD_ROOT/lib/modules/%{kversion}/updates -name "*.ko" -type f | \
329 xargs --no-run-if-empty chmod u+x
331 %files -f lustre.files
334 %attr(-, root, root) /lib/modules/%{kversion}/updates/*
335 %if %{build_lustre_tests}
336 %exclude /lib/modules/%{kversion}/updates/kernel/fs/lustre/llog_test.ko
338 %if %{build_lustre_osd_ldiskfs}
339 %exclude /lib/modules/%{kversion}/updates/kernel/fs/lustre/osd_ldiskfs.ko
341 %if %{build_lustre_osd_zfs}
342 %exclude /lib/modules/%{kversion}/updates/kernel/fs/lustre/osd_zfs.ko
344 %attr(-, root, root) %doc COPYING
345 %attr(-, root, root) %doc ChangeLog-lustre
346 %attr(-, root, root) %doc ChangeLog-lnet
348 %if %{build_lustre_osd_ldiskfs}
350 %attr(-, root, root) /lib/modules/%{kversion}/updates/kernel/fs/lustre/osd_ldiskfs.ko
353 %if %{build_lustre_osd_zfs}
355 %attr(-, root, root) /lib/modules/%{kversion}/updates/kernel/fs/lustre/osd_zfs.ko
359 %attr(-, root, root) /usr/src/lustre-%{version}
361 # uncomment these lines to enable deps packages
365 %if %{build_lustre_tests}
366 %files tests -f lustre-tests.files
370 if [ -f /boot/System.map-%{kversion} ]; then
371 depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
373 depmod -ae %{kversion} || exit 0
376 MODULES_RPM_NAME=$(rpm -q %{name}-modules | grep "%{version}-%{release}")
377 # "weak modules" support
379 if [ -x /usr/lib/module-init-tools/weak-modules ]; then
380 rpm -ql $MODULES_RPM_NAME | grep '\.ko$' |
381 /usr/lib/module-init-tools/weak-modules --add-modules
384 if [ -x /sbin/weak-modules ]; then
385 rpm -ql $MODULES_RPM_NAME | grep '\.ko$' |
386 /sbin/weak-modules --add-modules
389 # If the kernel was built to reject unsupported modules (e.g. not a Lustre
390 # kernel), and this hasn't been overridden in /etc/modprobe.d yet, then
391 # print a warning so that users are aware of this issue.
392 if sysctl kernel.unsupported >/dev/null 2>&1 &&
393 [ "$(sysctl -n kernel.unsupported 2>/dev/null)" = "0" ] &&
394 ! modprobe -c | grep -q "^allow_unsupported_modules[ \t]1" ; then
396 warning: the Lustre modules are not supported by Novell. To use Lustre
397 on this system, you should put
399 allow_unsupported_modules 1
401 into /etc/modprobe.d/unsupported_modules"
404 %if %{build_lustre_osd_ldiskfs}
406 if [ -f /boot/System.map-%{kversion} ]; then
407 depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
409 depmod -ae %{kversion} || exit 0
412 OSD_LDISKFS_RPM_NAME=$(rpm -q %{name}-osd-ldiskfs | grep "%{version}-%{release}")
413 # "weak modules" support
415 if [ -x /usr/lib/module-init-tools/weak-modules ]; then
416 rpm -ql $OSD_LDISKFS_RPM_NAME | grep '\.ko$' |
417 /usr/lib/module-init-tools/weak-modules --add-modules
420 if [ -x /sbin/weak-modules ]; then
421 rpm -ql $OSD_LDISKFS_RPM_NAME | grep '\.ko$' |
422 /sbin/weak-modules --add-modules
425 # If the kernel was built to reject unsupported modules (e.g. not a Lustre
426 # kernel), and this hasn't been overridden in /etc/modprobe.d yet, then
427 # print a warning so that users are aware of this issue.
428 if sysctl kernel.unsupported >/dev/null 2>&1 &&
429 [ "$(sysctl -n kernel.unsupported 2>/dev/null)" = "0" ] &&
430 ! modprobe -c | grep -q "^allow_unsupported_modules[ \t]1" ; then
432 warning: the Lustre modules are not supported by Novell. To use Lustre
433 on this system, you should put
435 allow_unsupported_modules 1
437 into /etc/modprobe.d/unsupported_modules"
441 %if %{build_lustre_osd_zfs}
443 if [ -f /boot/System.map-%{kversion} ]; then
444 depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
446 depmod -ae %{kversion} || exit 0
449 OSD_ZFS_RPM_NAME=$(rpm -q %{name}-osd-zfs | grep "%{version}-%{release}")
450 # "weak modules" support
452 if [ -x /usr/lib/module-init-tools/weak-modules ]; then
453 rpm -ql $OSD_ZFS_RPM_NAME | grep '\.ko$' |
454 /usr/lib/module-init-tools/weak-modules --add-modules
457 if [ -x /sbin/weak-modules ]; then
458 rpm -ql $OSD_ZFS_RPM_NAME | grep '\.ko$' |
459 /sbin/weak-modules --add-modules
462 # If the kernel was built to reject unsupported modules (e.g. not a Lustre
463 # kernel), and this hasn't been overridden in /etc/modprobe.d yet, then
464 # print a warning so that users are aware of this issue.
465 if sysctl kernel.unsupported >/dev/null 2>&1 &&
466 [ "$(sysctl -n kernel.unsupported 2>/dev/null)" = "0" ] &&
467 ! modprobe -c | grep -q "^allow_unsupported_modules[ \t]1" ; then
469 warning: the Lustre modules are not supported by Novell. To use Lustre
470 on this system, you should put
472 allow_unsupported_modules 1
474 into /etc/modprobe.d/unsupported_modules"
479 MODULES_RPM_NAME=$(rpm -q %{name}-modules | grep "%{version}-%{release}")
480 rpm -ql $MODULES_RPM_NAME | grep '\.ko$' > /var/run/%{name}-modules || true
482 %if %{build_lustre_osd_ldiskfs}
484 OSD_LDISKFS_RPM_NAME=$(rpm -q %{name}-osd-ldiskfs | grep "%{version}-%{release}")
485 rpm -ql $OSD_LDISKFS_RPM_NAME | grep '\.ko$' > /var/run/%{name}-osd-ldiskfs || true
488 %if %{build_lustre_osd_zfs}
490 OSD_ZFS_RPM_NAME=$(rpm -q %{name}-osd-zfs | grep "%{version}-%{release}")
491 rpm -ql $OSD_ZFS_RPM_NAME | grep '\.ko$' > /var/run/%{name}-osd-zfs || true
495 if [ -f /boot/System.map-%{kversion} ]; then
496 depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
498 depmod -ae %{kversion} || exit 0
501 # "weak modules" support
503 if [ -x /usr/lib/module-init-tools/weak-modules ]; then
504 cat /var/run/%{name}-modules |
505 /usr/lib/module-init-tools/weak-modules --remove-modules
508 if [ -x /sbin/weak-modules ]; then
509 cat /var/run/%{name}-modules |
510 /sbin/weak-modules --remove-modules
512 rm /var/run/%{name}-modules
514 %if %{build_lustre_osd_ldiskfs}
516 if [ -f /boot/System.map-%{kversion} ]; then
517 depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
519 depmod -ae %{kversion} || exit 0
522 # "weak modules" support
524 if [ -x /usr/lib/module-init-tools/weak-modules ]; then
525 cat /var/run/%{name}-osd-ldiskfs |
526 /usr/lib/module-init-tools/weak-modules --remove-modules
529 if [ -x /sbin/weak-modules ]; then
530 cat /var/run/%{name}-osd-ldiskfs |
531 /sbin/weak-modules --remove-modules
533 rm /var/run/%{name}-osd-ldiskfs
536 %if %{build_lustre_osd_zfs}
538 if [ -f /boot/System.map-%{kversion} ]; then
539 depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
541 depmod -ae %{kversion} || exit 0
544 # "weak modules" support
546 if [ -x /usr/lib/module-init-tools/weak-modules ]; then
547 cat /var/run/%{name}-osd-zfs |
548 /usr/lib/module-init-tools/weak-modules --remove-modules
551 if [ -x /sbin/weak-modules ]; then
552 cat /var/run/%{name}-osd-zfs |
553 /sbin/weak-modules --remove-modules
555 rm /var/run/%{name}-osd-zfs
558 %if %{build_lustre_tests}
560 if [ -f /boot/System.map-%{kversion} ]; then
561 depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
563 depmod -ae %{kversion} || exit 0
567 if [ -f /boot/System.map-%{kversion} ]; then
568 depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
570 depmod -ae %{kversion} || exit 0
575 rm -rf $RPM_BUILD_ROOT