Whamcloud - gitweb
Revert "b=22755 Don't consume grant twice on recoverable resend"
[fs/lustre-release.git] / lustre.spec.in
1 # lustre.spec
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}
7
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$//'")
11
12 Summary: Lustre File System
13 Name: %{lustre_name}
14 Version: %{version}
15 Release: %{release}
16 License: GPL
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
25
26 %description
27 Userspace tools and files for the Lustre file system.
28
29 %package modules
30 Summary: Kernel Lustre modules for Linux %{kversion}
31 Requires: modutils >= 2.4.10, kernel = %{krequires}
32 Group: Development/Kernel
33
34 %description modules
35 Lustre file system, server and network drivers for Linux %{kversion}.
36
37 %package source
38 Summary: Object-Based Disk storage driver source
39 Group: Development/Kernel
40
41 %description source
42 Lustre sources for further development
43
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).
47 #
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.
52 #
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
56 # add.
57
58 %package deps-sles
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
64
65 %description deps-sles
66 This package has RPM dependencies appropriate for SLES systems.
67
68 %package deps-rhel
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
74
75 %description deps-rhel
76 This package has RPM dependencies appropriate for RHEL, RHL, and FC
77 systems.
78
79 %package tests
80 Summary: Lustre testing framework
81 Group: Development/Kernel
82 Provides: %{name}-tests = %{version}
83 Requires: %{name} = %{version}, %{name}-modules = %{version}
84
85 %description tests
86 This package contains a set of test binaries and scripts that are intended
87 to be used by the Lustre testing framework.
88
89 %prep
90 %setup -qn lustre-%{version}
91 ln lustre/ChangeLog ChangeLog-lustre
92 ln lnet/ChangeLog ChangeLog-lnet
93
94 %build
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
99         RPM_BUILD_NCPUS=1
100     fi
101     if [ $RPM_BUILD_NCPUS -gt 8 ] ; then
102         RPM_BUILD_NCPUS=8
103     fi
104 fi
105
106 rm -rf $RPM_BUILD_ROOT
107
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
111 # build failures
112 %define optflags -g -O2 -Werror
113 CONFIGURE_ARGS=""
114 %if %{build_lustre_tests}
115 CONFIGURE_ARGS="$CONFIGURE_ARGS --enable-tests --enable-liblustre-tests"
116 %else
117 CONFIGURE_ARGS="$CONFIGURE_ARGS --disable-tests --disable-liblustre-tests"
118 %endif
119 %configure %{?configure_args:%configure_args} $CONFIGURE_ARGS
120 make -j $RPM_BUILD_NCPUS -s
121
122 %install
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
128
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
135 fi
136
137 # Create the pristine source directory.
138 cd $RPM_BUILD_DIR/lustre-%{version}
139 mkdir -p $RPM_BUILD_ROOT/usr/src
140 rm -f lustre-source
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}
144
145 cat >lustre.files <<EOF
146 %attr(-, root, root) /sbin/mount.lustre
147 %attr(-, root, root) /usr/sbin/*
148 %attr(-, root, root) /usr/bin/*
149
150 %attr(-, root, root) /usr/share/lustre
151
152 %attr(-, root, root) %{_libdir}/libptlctl.a
153 %attr(-, root, root) %{_libdir}/liblustreapi.a
154 %attr(-, root, root) /usr/include/lustre
155
156 %attr(-, root, root) %{_mandir}/man?/*
157
158 %attr(-, root, root) %{_libexecdir}/lustre/lc_common
159 EOF
160
161 if [ -f $RPM_BUILD_ROOT%{_libdir}/libcfsutil.a ] ; then
162   echo '%attr(-, root, root) %{_libdir}/libcfsutil.a' >>lustre.files
163 fi
164
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
168 fi
169
170 if [ -f $RPM_BUILD_DIR/lustre-%{version}/lustre/utils/libiam.c ] ; then
171   echo '%attr(-, root, root) %{_libdir}/libiam.a' >>lustre.files
172 fi
173
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
177 fi
178
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
182 else
183   echo '%attr(-, root, root) /usr/include/linux/lustre_idl.h' >>lustre.files
184 fi
185
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
188 fi
189
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
196 fi
197 %endif
198
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
201 popd >/dev/null
202
203 %files -f lustre.files
204
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
209
210 %files source
211 %attr(-, root, root) /usr/src/lustre-%{version}
212
213 # uncomment these lines to enable deps packages
214 # %files deps-sles
215 # %files deps-rhel
216
217 %if %{build_lustre_tests}
218 %files tests -f lustre-tests.files
219 %endif
220
221 %post modules
222 if [ -f /boot/System.map-%{kversion} ]; then
223         depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
224 else
225         depmod -ae %{kversion} || exit 0
226 fi
227 cat <<EOF
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
231
232 http://www.sun.com/software/products/lustre/lustre_reg.jsp
233 EOF
234
235 # for update from < v1.4.6
236
237 for f in /etc/modules.conf /etc/modprobe.conf /etc/modprobe.conf.local ; 
238 do
239         if [ -f $f ]; then
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 && \
245                         mv $TMPFILE $f
246                 fi
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 && \
252                         mv $TMPFILE $f
253                 fi
254         fi
255 done
256
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
263      echo "
264      warning: the Lustre modules are not supported by Novell. To use Lustre
265               on this system, you should put
266
267      allow_unsupported_modules 1
268
269      into /etc/modprobe.d/unsupported_modules"
270 fi
271
272 %postun modules
273 if [ -f /boot/System.map-%{kversion} ]; then
274         depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
275 else
276         depmod -ae %{kversion} || exit 0
277 fi
278
279 %if %{build_lustre_tests}
280 %post tests
281 if [ -f /boot/System.map-%{kversion} ]; then
282         depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
283 else
284         depmod -ae %{kversion} || exit 0
285 fi
286
287 %postun tests
288 if [ -f /boot/System.map-%{kversion} ]; then
289         depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
290 else
291         depmod -ae %{kversion} || exit 0
292 fi
293 %endif
294
295 %clean
296 rm -rf $RPM_BUILD_ROOT