2 %{!?version: %define version @VERSION@}
3 %{!?kversion: %define kversion @LINUXRELEASE@}
4 %{!?release: %define release @RELEASE@}
5 %{!?lustre_name: %define lustre_name lustre}
6 %{!?build_lustre_tests: %define build_lustre_tests 1}
8 # on RHEL5, we need to disable the internal dependency generator and let
9 # the external one be used as it can deal with providing Provides: tags
11 # on SLES10, /usr/lib/rpm/macros already sets this, so no harm (until Suse
13 %global _use_internal_dependency_generator 0
15 %define is_client %(bash -c "if [[ %{lustre_name} = *-client ]]; then echo -n '1'; else echo -n '0'; fi")
16 # for those uses that don't want the -smp/-bigsmp on the end of %kversion
17 %define krequires %(bash -c "echo %{kversion} | sed -e 's/-smp$//' -e 's/-bigsmp$//' -e 's/-ppc64$//' -e 's/-default$//'")
19 %define sles10 %(bash -c "if [ "%sles_version" = "10" ]; then echo -n '1'; else echo -n '0'; fi")
22 %define flavor %(bash -c "echo %{kversion} | sed -e 's/^.*-//'")
25 Summary: Lustre File System
30 Group: Utilities/System
31 Source: lustre-%{version}.tar.gz
32 URL: http://www.sun.com/software/products/lustre/index.xml
33 BuildRoot: %{_tmppath}/lustre-%{version}-root
34 Obsoletes: lustre-lite, lustre-lite-utils, lustre-ldap nfs-utils-lustre
35 Provides: lustre-lite = %{version}, lustre-lite-utils = %{version}
36 Requires: %{name}-modules = %{version}
37 # GSS requires this: BuildRequires: pkgconfig, libgssapi-devel >= 0.10
40 Userspace tools and files for the Lustre file system.
43 Summary: Kernel Lustre modules for Linux %{kversion}
44 # for RHEL5 and SLES11, we need nothing here
45 # for SLES10, we need (where %{flavor} is, i.e. smp):
47 Requires: kernel-%{flavor}
49 Group: Development/Kernel
52 Lustre file system, server and network drivers for Linux %{kversion}.
55 Summary: Object-Based Disk storage driver source
56 Group: Development/Kernel
59 Lustre sources for further development
61 # Since the RPMs we ship are to be used on both SLES and RHEL, we
62 # can't include any dependency information (since the package names
63 # are different on the two platforms).
65 # Instead, we can build these empty meta-packages that only include
66 # dependency information. These let people get the correct
67 # dependencies for their platform and lets them use tools like yum and
68 # red carpet to install the correct files.
70 # Unfortunately I have not seen this come up on the lists much, so I
71 # have disabled them (by commenting out their empty files section
72 # below) until it's clear that they resolve more confusion than they
76 Summary: Lustre dependencies meta-package for SLES
77 Group: Utilities/System
78 Provides: lustre-deps = %{version}
79 Requires: %{name} = %{version}, sles-release
80 Conflicts: %{name}-deps-rhel
82 %description deps-sles
83 This package has RPM dependencies appropriate for SLES systems.
86 Summary: Lustre dependencies meta-package for RHEL
87 Group: Utilities/System
88 Provides: lustre-deps = %{version}
89 Requires: %{name} = %{version}, redhat-release
90 Conflicts: %{name}-deps-sles
92 %description deps-rhel
93 This package has RPM dependencies appropriate for RHEL, RHL, and FC
97 Summary: Lustre testing framework
98 Group: Development/Kernel
99 Provides: %{name}-tests = %{version}
100 Requires: %{name} = %{version}, %{name}-modules = %{version}
103 This package contains a set of test binaries and scripts that are intended
104 to be used by the Lustre testing framework.
107 %setup -qn lustre-%{version}
108 ln lustre/ChangeLog ChangeLog-lustre
109 ln lnet/ChangeLog ChangeLog-lnet
112 # if RPM_BUILD_NCPUS unset, set it
113 if [ -z "$RPM_BUILD_NCPUS" ] ; then
114 RPM_BUILD_NCPUS=$(egrep -c "^cpu[0-9]+" /proc/stat 2>/dev/null || echo 0 :)
115 if [ $RPM_BUILD_NCPUS -eq 0 ] ; then
118 if [ $RPM_BUILD_NCPUS -gt 8 ] ; then
123 rm -rf $RPM_BUILD_ROOT
125 # Set an explicit path to our Linux tree, if we can.
126 cd $RPM_BUILD_DIR/lustre-%{version}
127 # override %optflags so that the vendor's overzealous flags don't create
129 %define optflags -g -O2 -Werror
131 %if %{build_lustre_tests}
132 CONFIGURE_ARGS="$CONFIGURE_ARGS --enable-tests --enable-liblustre-tests"
134 CONFIGURE_ARGS="$CONFIGURE_ARGS --disable-tests --disable-liblustre-tests"
136 %configure %{?configure_args:%configure_args} $CONFIGURE_ARGS
137 make -j $RPM_BUILD_NCPUS -s
140 make install DESTDIR=$RPM_BUILD_ROOT
141 # hack to avoid changing the libsysio code for "make install"
142 rm -f $RPM_BUILD_ROOT%{_libdir}/libsysio.a
143 # Remove ldiskfs module(s) - they are packaged by the ldiskfs .spec.
144 rm -rf $RPM_BUILD_ROOT/lib/modules/%{kversion}/updates/kernel/fs/lustre-ldiskfs
146 # hack to include the llog_test module in lustre-tests
147 llog_base=$RPM_BUILD_DIR/lustre-%{version}/lustre/obdclass/llog_test
148 if [ -e ${llog_base}.ko ]; then
149 cp ${llog_base}.ko $RPM_BUILD_ROOT/lib/modules/%{kversion}/updates/kernel/fs/lustre
150 elif [ -e ${llog_base}.o ]; then
151 cp ${llog_base}.o $RPM_BUILD_ROOT/lib/modules/%{kversion}/updates/kernel/fs/lustre
154 # Create the pristine source directory.
155 cd $RPM_BUILD_DIR/lustre-%{version}
156 mkdir -p $RPM_BUILD_ROOT/usr/src
158 ln -s $RPM_BUILD_ROOT/usr/src lustre-source
159 make distdir distdir=lustre-source/lustre-%{version}
160 chmod -R go-w lustre-source/lustre-%{version}
162 cat >lustre.files <<EOF
163 %attr(-, root, root) /sbin/mount.lustre
164 %attr(-, root, root) /usr/sbin/*
165 %attr(-, root, root) /usr/bin/*
167 %attr(-, root, root) /usr/share/lustre
169 %attr(-, root, root) %{_libdir}/libptlctl.a
170 %attr(-, root, root) %{_libdir}/liblustreapi.a
171 %attr(-, root, root) /usr/include/lustre
173 %attr(-, root, root) %{_mandir}/man?/*
175 %attr(-, root, root) %{_libexecdir}/lustre/lc_common
177 %attr(-, root, root) %{_sysconfdir}/udev/rules.d/99-lustre.rules
180 if [ -f $RPM_BUILD_ROOT%{_libdir}/libcfsutil.a ] ; then
181 echo '%attr(-, root, root) %{_libdir}/libcfsutil.a' >>lustre.files
184 if [ -f $RPM_BUILD_ROOT%{_libdir}/liblustre.so ] ; then
185 echo '%attr(-, root, root) %{_libdir}/liblustre.a' >>lustre.files
186 echo '%attr(-, root, root) %{_libdir}/liblustre.so' >>lustre.files
189 if [ -f $RPM_BUILD_DIR/lustre-%{version}/lustre/utils/libiam.c ] ; then
190 echo '%attr(-, root, root) %{_libdir}/libiam.a' >>lustre.files
193 if [ -d $RPM_BUILD_ROOT%{_libdir}/lustre/snmp ] ; then
194 echo '%attr(-, root, root) %{_libdir}/lustre/snmp' >>lustre.files
195 echo '%attr(-, root, root) %{_datadir}/lustre/snmp/mibs' >>lustre.files
198 # Have universal lustre headers
199 if [ -f $RPM_BUILD_DIR/lustre-%{version}/lustre/include/lustre/lustre_idl.h ] ; then
200 echo '%attr(-, root, root) /usr/include/linux/lustre_user.h' >>lustre.files
202 echo '%attr(-, root, root) /usr/include/linux/lustre_idl.h' >>lustre.files
205 if [ -f $RPM_BUILD_DIR/lustre-%{version}/lustre/include/linux/lustre_types.h ] ; then
206 echo '%attr(-, root, root) /usr/include/linux/lustre_types.h' >>lustre.files
209 %if %{build_lustre_tests}
210 echo '%attr(-, root, root) %{_libdir}/lustre/tests/*' >lustre-tests.files
211 echo '%attr(-, root, root) /lib/modules/%{kversion}/updates/kernel/fs/lustre/llog_test.*' >>lustre-tests.files
212 modules_excludes="|llog_test"
213 if [ -d $RPM_BUILD_ROOT%{_libdir}/lustre/liblustre/tests ] ; then
214 echo '%attr(-, root, root) %{_libdir}/lustre/liblustre/tests/*' >>lustre-tests.files
218 pushd $RPM_BUILD_ROOT >/dev/null
219 find lib/modules/%{kversion}/updates -type f | awk "!/(ZZZZZZZZZZ$modules_excludes)/ {print \"%attr(-, root, root) /\"\$0}" >>$RPM_BUILD_DIR/lustre-%{version}/lustre-modules.files
222 %files -f lustre.files
224 %files modules -f lustre-modules.files
225 %attr(-, root, root) %doc COPYING
226 %attr(-, root, root) %doc ChangeLog-lustre
227 %attr(-, root, root) %doc ChangeLog-lnet
230 %attr(-, root, root) /usr/src/lustre-%{version}
232 # uncomment these lines to enable deps packages
236 %if %{build_lustre_tests}
237 %files tests -f lustre-tests.files
241 if [ -f /boot/System.map-%{kversion} ]; then
242 depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
244 depmod -ae %{kversion} || exit 0
247 # "weak modules" support
249 if [ -x /usr/lib/module-init-tools/weak-modules ]; then
250 rpm -ql %{name}-modules-%{version}-%{release} | grep '\.ko$' |
251 /usr/lib/module-init-tools/weak-modules --add-modules
254 if [ -x /sbin/weak-modules ]; then
255 rpm -ql %{name}-modules-%{version}-%{release} | grep '\.ko$' |
256 /sbin/weak-modules --add-modules
260 Congratulations on finishing your Lustre installation! To register
261 your copy of Lustre and find out more about Lustre Support, Service,
262 and Training offerings please visit
264 http://www.sun.com/software/products/lustre/lustre_reg.jsp
267 # for update from < v1.4.6
269 for f in /etc/modules.conf /etc/modprobe.conf /etc/modprobe.conf.local ;
272 if grep 'lustre llite' $f >/dev/null 2>/dev/null ; then
273 [ ! -f $f.rpmsave ] && cp $f $f.rpmsave
274 TMPFILE=`mktemp $f.XXXXXX` && \
275 rm -f $TMPFILE && touch $TMPFILE && \
276 grep -v 'lustre llite' $f >> $TMPFILE && \
279 if egrep "^[^#]*(add below|install) ptlrpc" $f ; then
280 [ ! -f $f.rpmsave ] && cp $f $f.rpmsave
281 TMPFILE=`mktemp $f.XXXXXX` && \
282 rm -f $TMPFILE && touch $TMPFILE && \
283 sed -e "s/^[^#]*\(add below\|install\) ptlrpc.*/#&/" $f >> $TMPFILE && \
289 # If the kernel was built to reject unsupported modules (e.g. not a Lustre
290 # kernel), and this hasn't been overridden in /etc/modprobe.d yet, then
291 # print a warning so that users are aware of this issue.
292 if sysctl kernel.unsupported >/dev/null 2>&1 &&
293 [ "$(sysctl -n kernel.unsupported 2>/dev/null)" = "0" ] &&
294 ! modprobe -c | grep -q "^allow_unsupported_modules[ \t]1" ; then
296 warning: the Lustre modules are not supported by Novell. To use Lustre
297 on this system, you should put
299 allow_unsupported_modules 1
301 into /etc/modprobe.d/unsupported_modules"
305 rpm -ql %{name}-modules-%{version}-%{release} | grep '\.ko$' > /var/run/%{name}-modules
308 if [ -f /boot/System.map-%{kversion} ]; then
309 depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
311 depmod -ae %{kversion} || exit 0
314 # "weak modules" support
316 if [ -x /usr/lib/module-init-tools/weak-modules ]; then
317 cat /var/run/%{name}-modules | grep '\.ko$' |
318 /usr/lib/module-init-tools/weak-modules --remove-modules
321 if [ -x /sbin/weak-modules ]; then
322 cat /var/run/%{name}-modules | grep '\.ko$' |
323 /sbin/weak-modules --remove-modules
325 rm /var/run/%{name}-modules
327 %if %{build_lustre_tests}
329 if [ -f /boot/System.map-%{kversion} ]; then
330 depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
332 depmod -ae %{kversion} || exit 0
336 if [ -f /boot/System.map-%{kversion} ]; then
337 depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
339 depmod -ae %{kversion} || exit 0
344 rm -rf $RPM_BUILD_ROOT