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 %define is_client %(bash -c "if [[ %{lustre_name} = *-client ]]; then echo -n '1'; else echo -n '0'; fi")
9 # for those uses that don't want the -smp/-bigsmp on the end of %kversion
10 %define krequires %(bash -c "echo %{kversion} | sed -e 's/.x86_64$//' -e 's/.i586$//' -e 's/-smp$//' -e 's/-bigsmp$//' -e 's/-ppc64$//' -e 's/-default$//'")
12 Summary: Lustre File System
17 Group: Utilities/System
18 Source: lustre-%{version}.tar.gz
19 URL: http://www.sun.com/software/products/lustre/index.xml
20 BuildRoot: %{_tmppath}/lustre-%{version}-root
21 Obsoletes: lustre-lite, lustre-lite-utils, lustre-ldap nfs-utils-lustre
22 Provides: lustre-lite = %{version}, lustre-lite-utils = %{version}
23 Requires: %{name}-modules = %{version}
24 # GSS requires this: BuildRequires: pkgconfig, libgssapi-devel >= 0.10
27 Userspace tools and files for the Lustre file system.
30 Summary: Kernel Lustre modules for Linux %{kversion}
31 Requires: modutils >= 2.4.10, kernel = %{krequires}
32 Group: Development/Kernel
35 Lustre file system, server and network drivers for Linux %{kversion}.
38 Summary: Object-Based Disk storage driver source
39 Group: Development/Kernel
42 Lustre sources for further development
44 # Since the RPMs we ship are to be used on both SLES and RHEL, we
45 # can't include any dependency information (since the package names
46 # are different on the two platforms).
48 # Instead, we can build these empty meta-packages that only include
49 # dependency information. These let people get the correct
50 # dependencies for their platform and lets them use tools like yum and
51 # red carpet to install the correct files.
53 # Unfortunately I have not seen this come up on the lists much, so I
54 # have disabled them (by commenting out their empty files section
55 # below) until it's clear that they resolve more confusion than they
59 Summary: Lustre dependencies meta-package for SLES
60 Group: Utilities/System
61 Provides: lustre-deps = %{version}
62 Requires: %{name} = %{version}, sles-release
63 Conflicts: %{name}-deps-rhel
65 %description deps-sles
66 This package has RPM dependencies appropriate for SLES systems.
69 Summary: Lustre dependencies meta-package for RHEL
70 Group: Utilities/System
71 Provides: lustre-deps = %{version}
72 Requires: %{name} = %{version}, redhat-release
73 Conflicts: %{name}-deps-sles
75 %description deps-rhel
76 This package has RPM dependencies appropriate for RHEL, RHL, and FC
80 Summary: Lustre testing framework
81 Group: Development/Kernel
82 Provides: %{name}-tests = %{version}
83 Requires: %{name} = %{version}, %{name}-modules = %{version}
86 This package contains a set of test binaries and scripts that are intended
87 to be used by the Lustre testing framework.
90 %setup -qn lustre-%{version}
91 ln lustre/ChangeLog ChangeLog-lustre
92 ln lnet/ChangeLog ChangeLog-lnet
95 # if RPM_BUILD_NCPUS unset, set it
96 if [ -z "$RPM_BUILD_NCPUS" ] ; then
97 RPM_BUILD_NCPUS=$(egrep -c "^cpu[0-9]+" /proc/stat 2>/dev/null || echo 0 :)
98 if [ $RPM_BUILD_NCPUS -eq 0 ] ; then
101 if [ $RPM_BUILD_NCPUS -gt 8 ] ; then
106 rm -rf $RPM_BUILD_ROOT
108 # Set an explicit path to our Linux tree, if we can.
109 cd $RPM_BUILD_DIR/lustre-%{version}
110 # override %optflags so that the vendor's overzealous flags don't create
112 %define optflags -g -O2 -Werror
114 %if %{build_lustre_tests}
115 CONFIGURE_ARGS="$CONFIGURE_ARGS --enable-tests --enable-liblustre-tests"
117 CONFIGURE_ARGS="$CONFIGURE_ARGS --disable-tests --disable-liblustre-tests"
119 %configure %{?configure_args:%configure_args} $CONFIGURE_ARGS
120 make -j $RPM_BUILD_NCPUS -s
123 make install DESTDIR=$RPM_BUILD_ROOT
124 # hack to avoid changing the libsysio code for "make install"
125 rm -f $RPM_BUILD_ROOT%{_libdir}/libsysio.a
126 # Remove ldiskfs module(s) - they are packaged by the ldiskfs .spec.
127 rm -rf $RPM_BUILD_ROOT/lib/modules/%{kversion}/kernel/fs/lustre-ldiskfs
129 # hack to include the llog_test module in lustre-tests
130 llog_base=$RPM_BUILD_DIR/lustre-%{version}/lustre/obdclass/llog_test
131 if [ -e ${llog_base}.ko ]; then
132 cp ${llog_base}.ko $RPM_BUILD_ROOT/lib/modules/%{kversion}/kernel/fs/lustre
133 elif [ -e ${llog_base}.o ]; then
134 cp ${llog_base}.o $RPM_BUILD_ROOT/lib/modules/%{kversion}/kernel/fs/lustre
137 # Create the pristine source directory.
138 cd $RPM_BUILD_DIR/lustre-%{version}
139 mkdir -p $RPM_BUILD_ROOT/usr/src
141 ln -s $RPM_BUILD_ROOT/usr/src lustre-source
142 make distdir distdir=lustre-source/lustre-%{version}
143 chmod -R go-w lustre-source/lustre-%{version}
145 cat >lustre.files <<EOF
146 %attr(-, root, root) /sbin/mount.lustre
147 %attr(-, root, root) /usr/sbin/*
148 %attr(-, root, root) /usr/bin/*
150 %attr(-, root, root) /usr/share/lustre
152 %attr(-, root, root) %{_libdir}/libptlctl.a
153 %attr(-, root, root) %{_libdir}/liblustreapi.a
154 %attr(-, root, root) /usr/include/lustre
156 %attr(-, root, root) %{_mandir}/man?/*
158 %attr(-, root, root) %{_libexecdir}/lustre/lc_common
161 if [ -f $RPM_BUILD_ROOT%{_libdir}/libcfsutil.a ] ; then
162 echo '%attr(-, root, root) %{_libdir}/libcfsutil.a' >>lustre.files
165 if [ -f $RPM_BUILD_ROOT%{_libdir}/liblustre.so ] ; then
166 echo '%attr(-, root, root) %{_libdir}/liblustre.a' >>lustre.files
167 echo '%attr(-, root, root) %{_libdir}/liblustre.so' >>lustre.files
170 if [ -f $RPM_BUILD_DIR/lustre-%{version}/lustre/utils/libiam.c ] ; then
171 echo '%attr(-, root, root) %{_libdir}/libiam.a' >>lustre.files
174 if [ -d $RPM_BUILD_ROOT%{_libdir}/lustre/snmp ] ; then
175 echo '%attr(-, root, root) %{_libdir}/lustre/snmp' >>lustre.files
176 echo '%attr(-, root, root) %{_datadir}/lustre/snmp/mibs' >>lustre.files
179 # Have universal lustre headers
180 if [ -f $RPM_BUILD_DIR/lustre-%{version}/lustre/include/lustre/lustre_idl.h ] ; then
181 echo '%attr(-, root, root) /usr/include/linux/lustre_user.h' >>lustre.files
183 echo '%attr(-, root, root) /usr/include/linux/lustre_idl.h' >>lustre.files
186 if [ -f $RPM_BUILD_DIR/lustre-%{version}/lustre/include/linux/lustre_types.h ] ; then
187 echo '%attr(-, root, root) /usr/include/linux/lustre_types.h' >>lustre.files
190 %if %{build_lustre_tests}
191 echo '%attr(-, root, root) %{_libdir}/lustre/tests/*' >lustre-tests.files
192 echo '%attr(-, root, root) /lib/modules/%{kversion}/kernel/fs/lustre/llog_test.*' >>lustre-tests.files
193 modules_excludes="|llog_test"
194 if [ -d $RPM_BUILD_ROOT%{_libdir}/lustre/liblustre/tests ] ; then
195 echo '%attr(-, root, root) %{_libdir}/lustre/liblustre/tests/*' >>lustre-tests.files
199 pushd $RPM_BUILD_ROOT >/dev/null
200 find lib/modules/%{kversion}/kernel -type f | awk "!/(ZZZZZZZZZZ$modules_excludes)/ {print \"%attr(-, root, root) /\"\$0}" >>$RPM_BUILD_DIR/lustre-%{version}/lustre-modules.files
203 %files -f lustre.files
205 %files modules -f lustre-modules.files
206 %attr(-, root, root) %doc COPYING
207 %attr(-, root, root) %doc ChangeLog-lustre
208 %attr(-, root, root) %doc ChangeLog-lnet
211 %attr(-, root, root) /usr/src/lustre-%{version}
213 # uncomment these lines to enable deps packages
217 %if %{build_lustre_tests}
218 %files tests -f lustre-tests.files
222 if [ -f /boot/System.map-%{kversion} ]; then
223 depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
225 depmod -ae %{kversion} || exit 0
228 Congratulations on finishing your Lustre installation! To register
229 your copy of Lustre and find out more about Lustre Support, Service,
230 and Training offerings please visit
232 http://www.sun.com/software/products/lustre/lustre_reg.jsp
235 # for update from < v1.4.6
237 for f in /etc/modules.conf /etc/modprobe.conf /etc/modprobe.conf.local ;
240 if grep 'lustre llite' $f >/dev/null 2>/dev/null ; then
241 [ ! -f $f.rpmsave ] && cp $f $f.rpmsave
242 TMPFILE=`mktemp $f.XXXXXX` && \
243 rm -f $TMPFILE && touch $TMPFILE && \
244 grep -v 'lustre llite' $f >> $TMPFILE && \
247 if egrep "^[^#]*(add below|install) ptlrpc" $f ; then
248 [ ! -f $f.rpmsave ] && cp $f $f.rpmsave
249 TMPFILE=`mktemp $f.XXXXXX` && \
250 rm -f $TMPFILE && touch $TMPFILE && \
251 sed -e "s/^[^#]*\(add below\|install\) ptlrpc.*/#&/" $f >> $TMPFILE && \
257 # If the kernel was built to reject unsupported modules (e.g. not a Lustre
258 # kernel), and this hasn't been overridden in /etc/modprobe.d yet, then
259 # print a warning so that users are aware of this issue.
260 if sysctl kernel.unsupported >/dev/null 2>&1 &&
261 [ "$(sysctl -n kernel.unsupported 2>/dev/null)" = "0" ] &&
262 ! modprobe -c | grep -q "^allow_unsupported_modules[ \t]1" ; then
264 warning: the Lustre modules are not supported by Novell. To use Lustre
265 on this system, you should put
267 allow_unsupported_modules 1
269 into /etc/modprobe.d/unsupported_modules"
273 if [ -f /boot/System.map-%{kversion} ]; then
274 depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
276 depmod -ae %{kversion} || exit 0
279 %if %{build_lustre_tests}
281 if [ -f /boot/System.map-%{kversion} ]; then
282 depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
284 depmod -ae %{kversion} || exit 0
288 if [ -f /boot/System.map-%{kversion} ]; then
289 depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
291 depmod -ae %{kversion} || exit 0
296 rm -rf $RPM_BUILD_ROOT