Whamcloud - gitweb
d557a0dc6f6d63116e6a83e04af91cc27615c54d
[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 # in order to get kernel symset and/or kernel module dependencies into
9 # the RPM, in order to support weak-modules, the internal dependency gen-
10 # erator needs to be disabled
11 # this is done with (reduce the double % down to a single %):
12 #
13 # %%global _use_internal_dependency_generator 0
14 #
15 # on SLES10, /usr/lib/rpm/macros already sets this, so no harm in also
16 # defining it here (until Suse changes their mind)
17 #
18 # on RHEL5, however, we do need to explicitly disable the internal dep-
19 # endency generator and allow the external one be used
20 # but since RedHat's kABI is only a subset of the total kernel ABI, it
21 # doesn't include all of the symbols we (or OFED for that matter) need
22 # until RedHat includes all of the symbols we need in their symsets we
23 # cannot support weak-modules
24 # we did e-mail the maintainer of all of this stuff @redhat but got no
25 # response from them
26 #%%global _use_internal_dependency_generator 0
27
28 %define is_client %(bash -c "if [[ %{lustre_name} = *-client ]]; then echo -n '1'; else echo -n '0'; fi")
29 # for those uses that don't want the -smp/-bigsmp on the end of %kversion
30 %define krequires %(bash -c "echo %{kversion} | sed -e 's/-smp$//' -e 's/-bigsmp$//' -e 's/-ppc64$//' -e 's/-default$//'")
31
32 Summary: Lustre File System
33 Name: %{lustre_name}
34 Version: %{version}
35 Release: %{release}
36 License: GPL
37 Group: Utilities/System
38 Source: lustre-%{version}.tar.gz
39 URL: http://www.sun.com/software/products/lustre/index.xml
40 BuildRoot: %{_tmppath}/lustre-%{version}-root
41 Obsoletes: lustre-lite, lustre-lite-utils, lustre-ldap nfs-utils-lustre
42 Provides: lustre-lite = %{version}, lustre-lite-utils = %{version}
43 Requires: %{name}-modules = %{version}
44 # GSS requires this: BuildRequires: pkgconfig, libgssapi-devel >= 0.10
45
46 %description
47 Userspace tools and files for the Lustre file system.
48
49 %package modules
50 Summary: Kernel Lustre modules for Linux %{kversion}
51 Requires: modutils >= 2.4.10, kernel = %{krequires}
52 Group: Development/Kernel
53
54 %description modules
55 Lustre file system, server and network drivers for Linux %{kversion}.
56
57 %package source
58 Summary: Object-Based Disk storage driver source
59 Group: Development/Kernel
60
61 %description source
62 Lustre sources for further development
63
64 # Since the RPMs we ship are to be used on both SLES and RHEL, we
65 # can't include any dependency information (since the package names
66 # are different on the two platforms).
67 #
68 # Instead, we can build these empty meta-packages that only include
69 # dependency information.  These let people get the correct
70 # dependencies for their platform and lets them use tools like yum and
71 # red carpet to install the correct files.
72 #
73 # Unfortunately I have not seen this come up on the lists much, so I
74 # have disabled them (by commenting out their empty files section
75 # below) until it's clear that they resolve more confusion than they
76 # add.
77
78 %package deps-sles
79 Summary: Lustre dependencies meta-package for SLES
80 Group: Utilities/System
81 Provides: lustre-deps = %{version}
82 Requires: %{name} = %{version}, sles-release
83 Conflicts: %{name}-deps-rhel
84
85 %description deps-sles
86 This package has RPM dependencies appropriate for SLES systems.
87
88 %package deps-rhel
89 Summary: Lustre dependencies meta-package for RHEL
90 Group: Utilities/System
91 Provides: lustre-deps = %{version}
92 Requires: %{name} = %{version}, redhat-release
93 Conflicts: %{name}-deps-sles
94
95 %description deps-rhel
96 This package has RPM dependencies appropriate for RHEL, RHL, and FC
97 systems.
98
99 %package tests
100 Summary: Lustre testing framework
101 Group: Development/Kernel
102 Provides: %{name}-tests = %{version}
103 Requires: %{name} = %{version}, %{name}-modules = %{version}
104
105 %description tests
106 This package contains a set of test binaries and scripts that are intended
107 to be used by the Lustre testing framework.
108
109 %if 0%{?suse_version}
110 %debug_package
111 %endif
112 %prep
113 %setup -qn lustre-%{version}
114 ln lustre/ChangeLog ChangeLog-lustre
115 ln lnet/ChangeLog ChangeLog-lnet
116
117 %build
118 # if RPM_BUILD_NCPUS unset, set it
119 if [ -z "$RPM_BUILD_NCPUS" ] ; then
120     RPM_BUILD_NCPUS=$(egrep -c "^cpu[0-9]+" /proc/stat 2>/dev/null || echo 0 :)
121     if [ $RPM_BUILD_NCPUS -eq 0 ] ; then
122         RPM_BUILD_NCPUS=1
123     fi
124     if [ $RPM_BUILD_NCPUS -gt 8 ] ; then
125         RPM_BUILD_NCPUS=8
126     fi
127 fi
128
129 rm -rf $RPM_BUILD_ROOT
130
131 # Set an explicit path to our Linux tree, if we can.
132 cd $RPM_BUILD_DIR/lustre-%{version}
133 # override %optflags so that the vendor's overzealous flags don't create
134 # build failures
135 %define optflags -g -O2 -Werror
136 CONFIGURE_ARGS=""
137 %if %{build_lustre_tests}
138 CONFIGURE_ARGS="$CONFIGURE_ARGS --enable-tests --enable-liblustre-tests"
139 %else
140 CONFIGURE_ARGS="$CONFIGURE_ARGS --disable-tests --disable-liblustre-tests"
141 %endif
142 %configure %{?configure_args:%configure_args} $CONFIGURE_ARGS
143 make -j $RPM_BUILD_NCPUS -s
144
145 %install
146 make install DESTDIR=$RPM_BUILD_ROOT
147 # hack to avoid changing the libsysio code for "make install"
148 rm -f $RPM_BUILD_ROOT%{_libdir}/libsysio.a
149 # Remove ldiskfs module(s) - they are packaged by the ldiskfs .spec.
150 rm -rf $RPM_BUILD_ROOT/lib/modules/%{kversion}/kernel/fs/lustre-ldiskfs
151
152 # hack to include the llog_test module in lustre-tests
153 llog_base=$RPM_BUILD_DIR/lustre-%{version}/lustre/obdclass/llog_test
154 if [ -e ${llog_base}.ko ]; then
155   cp ${llog_base}.ko $RPM_BUILD_ROOT/lib/modules/%{kversion}/kernel/fs/lustre
156 elif [ -e ${llog_base}.o ]; then
157   cp ${llog_base}.o $RPM_BUILD_ROOT/lib/modules/%{kversion}/kernel/fs/lustre
158 fi
159
160 # Create the pristine source directory.
161 cd $RPM_BUILD_DIR/lustre-%{version}
162 mkdir -p $RPM_BUILD_ROOT/usr/src
163 rm -f lustre-source
164 ln -s $RPM_BUILD_ROOT/usr/src lustre-source
165 make distdir distdir=lustre-source/lustre-%{version}
166 chmod -R go-w lustre-source/lustre-%{version}
167
168 cat >lustre.files <<EOF
169 %attr(-, root, root) /sbin/mount.lustre
170 %attr(-, root, root) /usr/sbin/*
171 %attr(-, root, root) /usr/bin/*
172
173 %attr(-, root, root) /usr/share/lustre
174
175 %attr(-, root, root) %{_libdir}/libptlctl.a
176 %attr(-, root, root) %{_libdir}/liblustreapi.a
177 %attr(-, root, root) /usr/include/lustre
178
179 %attr(-, root, root) %{_mandir}/man?/*
180
181 %attr(-, root, root) %{_libexecdir}/lustre/lc_common
182
183 %attr(-, root, root) %{_sysconfdir}/udev/rules.d/99-lustre.rules
184 EOF
185
186 if [ -f $RPM_BUILD_ROOT%{_libdir}/libcfsutil.a ] ; then
187   echo '%attr(-, root, root) %{_libdir}/libcfsutil.a' >>lustre.files
188 fi
189
190 if [ -f $RPM_BUILD_ROOT%{_libdir}/liblustre.so ] ; then
191   echo '%attr(-, root, root) %{_libdir}/liblustre.a' >>lustre.files
192   echo '%attr(-, root, root) %{_libdir}/liblustre.so' >>lustre.files
193 fi
194
195 if [ -f $RPM_BUILD_DIR/lustre-%{version}/lustre/utils/libiam.c ] ; then
196   echo '%attr(-, root, root) %{_libdir}/libiam.a' >>lustre.files
197 fi
198
199 if [ -d $RPM_BUILD_ROOT%{_libdir}/lustre/snmp ] ; then
200   echo '%attr(-, root, root) %{_libdir}/lustre/snmp' >>lustre.files
201   echo '%attr(-, root, root) %{_datadir}/lustre/snmp/mibs' >>lustre.files
202 fi
203
204 # Have universal lustre headers 
205 if [ -f $RPM_BUILD_DIR/lustre-%{version}/lustre/include/lustre/lustre_idl.h ] ; then
206   echo '%attr(-, root, root) /usr/include/linux/lustre_user.h' >>lustre.files
207 else
208   echo '%attr(-, root, root) /usr/include/linux/lustre_idl.h' >>lustre.files
209 fi
210
211 if [ -f $RPM_BUILD_DIR/lustre-%{version}/lustre/include/linux/lustre_types.h ] ; then
212   echo '%attr(-, root, root) /usr/include/linux/lustre_types.h' >>lustre.files
213 fi
214
215 %if %{build_lustre_tests}
216 echo '%attr(-, root, root) %{_libdir}/lustre/tests/*' >lustre-tests.files
217 echo '%attr(-, root, root) /lib/modules/%{kversion}/kernel/fs/lustre/llog_test.*' >>lustre-tests.files
218 modules_excludes="|llog_test"
219 if [ -d $RPM_BUILD_ROOT%{_libdir}/lustre/liblustre/tests ] ; then
220   echo '%attr(-, root, root) %{_libdir}/lustre/liblustre/tests/*' >>lustre-tests.files
221 fi
222 %endif
223
224 pushd $RPM_BUILD_ROOT >/dev/null
225 find lib/modules/%{kversion}/kernel -type f | awk "!/(ZZZZZZZZZZ$modules_excludes)/ {print \"%attr(-, root, root) /\"\$0}" >>$RPM_BUILD_DIR/lustre-%{version}/lustre-modules.files
226 popd >/dev/null
227
228 %files -f lustre.files
229
230 %files modules -f lustre-modules.files
231 %attr(-, root, root) %doc COPYING
232 %attr(-, root, root) %doc ChangeLog-lustre
233 %attr(-, root, root) %doc ChangeLog-lnet
234
235 %files source
236 %attr(-, root, root) /usr/src/lustre-%{version}
237
238 # uncomment these lines to enable deps packages
239 # %files deps-sles
240 # %files deps-rhel
241
242 %if %{build_lustre_tests}
243 %files tests -f lustre-tests.files
244 %endif
245
246 %post modules
247 if [ -f /boot/System.map-%{kversion} ]; then
248         depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
249 else
250         depmod -ae %{kversion} || exit 0
251 fi
252 cat <<EOF
253 Congratulations on finishing your Lustre installation!  To register  
254 your copy of Lustre and find out more about Lustre Support, Service,  
255 and Training offerings please visit
256
257 http://www.sun.com/software/products/lustre/lustre_reg.jsp
258 EOF
259
260 # for update from < v1.4.6
261
262 for f in /etc/modules.conf /etc/modprobe.conf /etc/modprobe.conf.local ; 
263 do
264         if [ -f $f ]; then
265                 if grep 'lustre llite' $f >/dev/null 2>/dev/null ; then
266                         [ ! -f $f.rpmsave ] && cp $f $f.rpmsave
267                         TMPFILE=`mktemp $f.XXXXXX` && \
268                         rm -f $TMPFILE && touch $TMPFILE && \
269                         grep -v 'lustre llite' $f >> $TMPFILE && \
270                         mv $TMPFILE $f
271                 fi
272                 if egrep "^[^#]*(add below|install) ptlrpc" $f ; then
273                         [ ! -f $f.rpmsave ] && cp $f $f.rpmsave
274                         TMPFILE=`mktemp $f.XXXXXX` && \
275                         rm -f $TMPFILE && touch $TMPFILE && \
276                         sed -e "s/^[^#]*\(add below\|install\) ptlrpc.*/#&/" $f >> $TMPFILE && \
277                         mv $TMPFILE $f
278                 fi
279         fi
280 done
281
282 # If the kernel was built to reject unsupported modules (e.g. not a Lustre
283 # kernel), and this hasn't been overridden in /etc/modprobe.d yet, then
284 # print a warning so that users are aware of this issue.
285 if sysctl kernel.unsupported >/dev/null 2>&1 &&
286    [ "$(sysctl -n kernel.unsupported 2>/dev/null)" = "0" ] &&
287     ! modprobe -c | grep -q "^allow_unsupported_modules[ \t]1" ; then
288      echo "
289      warning: the Lustre modules are not supported by Novell. To use Lustre
290               on this system, you should put
291
292      allow_unsupported_modules 1
293
294      into /etc/modprobe.d/unsupported_modules"
295 fi
296
297 %postun modules
298 if [ -f /boot/System.map-%{kversion} ]; then
299         depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
300 else
301         depmod -ae %{kversion} || exit 0
302 fi
303
304 %if %{build_lustre_tests}
305 %post tests
306 if [ -f /boot/System.map-%{kversion} ]; then
307         depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
308 else
309         depmod -ae %{kversion} || exit 0
310 fi
311
312 %postun tests
313 if [ -f /boot/System.map-%{kversion} ]; then
314         depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
315 else
316         depmod -ae %{kversion} || exit 0
317 fi
318 %endif
319
320 %clean
321 rm -rf $RPM_BUILD_ROOT