Whamcloud - gitweb
b=22040 Don't run connectathon lock tests on nfsv4
[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/-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
160 %attr(-, root, root) %{_sysconfdir}/udev/rules.d/99-lustre.rules
161 EOF
162
163 if [ -f $RPM_BUILD_ROOT%{_libdir}/libcfsutil.a ] ; then
164   echo '%attr(-, root, root) %{_libdir}/libcfsutil.a' >>lustre.files
165 fi
166
167 if [ -f $RPM_BUILD_ROOT%{_libdir}/liblustre.so ] ; then
168   echo '%attr(-, root, root) %{_libdir}/liblustre.a' >>lustre.files
169   echo '%attr(-, root, root) %{_libdir}/liblustre.so' >>lustre.files
170 fi
171
172 if [ -f $RPM_BUILD_DIR/lustre-%{version}/lustre/utils/libiam.c ] ; then
173   echo '%attr(-, root, root) %{_libdir}/libiam.a' >>lustre.files
174 fi
175
176 if [ -d $RPM_BUILD_ROOT%{_libdir}/lustre/snmp ] ; then
177   echo '%attr(-, root, root) %{_libdir}/lustre/snmp' >>lustre.files
178   echo '%attr(-, root, root) %{_datadir}/lustre/snmp/mibs' >>lustre.files
179 fi
180
181 # Have universal lustre headers 
182 if [ -f $RPM_BUILD_DIR/lustre-%{version}/lustre/include/lustre/lustre_idl.h ] ; then
183   echo '%attr(-, root, root) /usr/include/linux/lustre_user.h' >>lustre.files
184 else
185   echo '%attr(-, root, root) /usr/include/linux/lustre_idl.h' >>lustre.files
186 fi
187
188 if [ -f $RPM_BUILD_DIR/lustre-%{version}/lustre/include/linux/lustre_types.h ] ; then
189   echo '%attr(-, root, root) /usr/include/linux/lustre_types.h' >>lustre.files
190 fi
191
192 %if %{build_lustre_tests}
193 echo '%attr(-, root, root) %{_libdir}/lustre/tests/*' >lustre-tests.files
194 echo '%attr(-, root, root) /lib/modules/%{kversion}/kernel/fs/lustre/llog_test.*' >>lustre-tests.files
195 modules_excludes="|llog_test"
196 if [ -d $RPM_BUILD_ROOT%{_libdir}/lustre/liblustre/tests ] ; then
197   echo '%attr(-, root, root) %{_libdir}/lustre/liblustre/tests/*' >>lustre-tests.files
198 fi
199 %endif
200
201 pushd $RPM_BUILD_ROOT >/dev/null
202 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 popd >/dev/null
204
205 %files -f lustre.files
206
207 %files modules -f lustre-modules.files
208 %attr(-, root, root) %doc COPYING
209 %attr(-, root, root) %doc ChangeLog-lustre
210 %attr(-, root, root) %doc ChangeLog-lnet
211
212 %files source
213 %attr(-, root, root) /usr/src/lustre-%{version}
214
215 # uncomment these lines to enable deps packages
216 # %files deps-sles
217 # %files deps-rhel
218
219 %if %{build_lustre_tests}
220 %files tests -f lustre-tests.files
221 %endif
222
223 %post modules
224 if [ -f /boot/System.map-%{kversion} ]; then
225         depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
226 else
227         depmod -ae %{kversion} || exit 0
228 fi
229 cat <<EOF
230 Congratulations on finishing your Lustre installation!  To register  
231 your copy of Lustre and find out more about Lustre Support, Service,  
232 and Training offerings please visit
233
234 http://www.sun.com/software/products/lustre/lustre_reg.jsp
235 EOF
236
237 # for update from < v1.4.6
238
239 for f in /etc/modules.conf /etc/modprobe.conf /etc/modprobe.conf.local ; 
240 do
241         if [ -f $f ]; then
242                 if grep 'lustre llite' $f >/dev/null 2>/dev/null ; then
243                         [ ! -f $f.rpmsave ] && cp $f $f.rpmsave
244                         TMPFILE=`mktemp $f.XXXXXX` && \
245                         rm -f $TMPFILE && touch $TMPFILE && \
246                         grep -v 'lustre llite' $f >> $TMPFILE && \
247                         mv $TMPFILE $f
248                 fi
249                 if egrep "^[^#]*(add below|install) ptlrpc" $f ; then
250                         [ ! -f $f.rpmsave ] && cp $f $f.rpmsave
251                         TMPFILE=`mktemp $f.XXXXXX` && \
252                         rm -f $TMPFILE && touch $TMPFILE && \
253                         sed -e "s/^[^#]*\(add below\|install\) ptlrpc.*/#&/" $f >> $TMPFILE && \
254                         mv $TMPFILE $f
255                 fi
256         fi
257 done
258
259 # If the kernel was built to reject unsupported modules (e.g. not a Lustre
260 # kernel), and this hasn't been overridden in /etc/modprobe.d yet, then
261 # print a warning so that users are aware of this issue.
262 if sysctl kernel.unsupported >/dev/null 2>&1 &&
263    [ "$(sysctl -n kernel.unsupported 2>/dev/null)" = "0" ] &&
264     ! modprobe -c | grep -q "^allow_unsupported_modules[ \t]1" ; then
265      echo "
266      warning: the Lustre modules are not supported by Novell. To use Lustre
267               on this system, you should put
268
269      allow_unsupported_modules 1
270
271      into /etc/modprobe.d/unsupported_modules"
272 fi
273
274 %postun modules
275 if [ -f /boot/System.map-%{kversion} ]; then
276         depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
277 else
278         depmod -ae %{kversion} || exit 0
279 fi
280
281 %if %{build_lustre_tests}
282 %post tests
283 if [ -f /boot/System.map-%{kversion} ]; then
284         depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
285 else
286         depmod -ae %{kversion} || exit 0
287 fi
288
289 %postun tests
290 if [ -f /boot/System.map-%{kversion} ]; then
291         depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
292 else
293         depmod -ae %{kversion} || exit 0
294 fi
295 %endif
296
297 %clean
298 rm -rf $RPM_BUILD_ROOT