Whamcloud - gitweb
Revert "b=21951 Init scatterlist table."
[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 %if 0%{?suse_version}
90 %debug_package
91 %endif
92 %prep
93 %setup -qn lustre-%{version}
94 ln lustre/ChangeLog ChangeLog-lustre
95 ln lnet/ChangeLog ChangeLog-lnet
96
97 %build
98 # if RPM_BUILD_NCPUS unset, set it
99 if [ -z "$RPM_BUILD_NCPUS" ] ; then
100     RPM_BUILD_NCPUS=$(egrep -c "^cpu[0-9]+" /proc/stat 2>/dev/null || echo 0 :)
101     if [ $RPM_BUILD_NCPUS -eq 0 ] ; then
102         RPM_BUILD_NCPUS=1
103     fi
104     if [ $RPM_BUILD_NCPUS -gt 8 ] ; then
105         RPM_BUILD_NCPUS=8
106     fi
107 fi
108
109 rm -rf $RPM_BUILD_ROOT
110
111 # Set an explicit path to our Linux tree, if we can.
112 cd $RPM_BUILD_DIR/lustre-%{version}
113 # override %optflags so that the vendor's overzealous flags don't create
114 # build failures
115 %define optflags -g -O2 -Werror
116 CONFIGURE_ARGS=""
117 %if %{build_lustre_tests}
118 CONFIGURE_ARGS="$CONFIGURE_ARGS --enable-tests --enable-liblustre-tests"
119 %else
120 CONFIGURE_ARGS="$CONFIGURE_ARGS --disable-tests --disable-liblustre-tests"
121 %endif
122 %configure %{?configure_args:%configure_args} $CONFIGURE_ARGS
123 make -j $RPM_BUILD_NCPUS -s
124
125 %install
126 make install DESTDIR=$RPM_BUILD_ROOT
127 # hack to avoid changing the libsysio code for "make install"
128 rm -f $RPM_BUILD_ROOT%{_libdir}/libsysio.a
129 # Remove ldiskfs module(s) - they are packaged by the ldiskfs .spec.
130 rm -rf $RPM_BUILD_ROOT/lib/modules/%{kversion}/kernel/fs/lustre-ldiskfs
131
132 # hack to include the llog_test module in lustre-tests
133 llog_base=$RPM_BUILD_DIR/lustre-%{version}/lustre/obdclass/llog_test
134 if [ -e ${llog_base}.ko ]; then
135   cp ${llog_base}.ko $RPM_BUILD_ROOT/lib/modules/%{kversion}/kernel/fs/lustre
136 elif [ -e ${llog_base}.o ]; then
137   cp ${llog_base}.o $RPM_BUILD_ROOT/lib/modules/%{kversion}/kernel/fs/lustre
138 fi
139
140 # Create the pristine source directory.
141 cd $RPM_BUILD_DIR/lustre-%{version}
142 mkdir -p $RPM_BUILD_ROOT/usr/src
143 rm -f lustre-source
144 ln -s $RPM_BUILD_ROOT/usr/src lustre-source
145 make distdir distdir=lustre-source/lustre-%{version}
146 chmod -R go-w lustre-source/lustre-%{version}
147
148 cat >lustre.files <<EOF
149 %attr(-, root, root) /sbin/mount.lustre
150 %attr(-, root, root) /usr/sbin/*
151 %attr(-, root, root) /usr/bin/*
152
153 %attr(-, root, root) /usr/share/lustre
154
155 %attr(-, root, root) %{_libdir}/libptlctl.a
156 %attr(-, root, root) %{_libdir}/liblustreapi.a
157 %attr(-, root, root) /usr/include/lustre
158
159 %attr(-, root, root) %{_mandir}/man?/*
160
161 %attr(-, root, root) %{_libexecdir}/lustre/lc_common
162
163 %attr(-, root, root) %{_sysconfdir}/udev/rules.d/99-lustre.rules
164 EOF
165
166 if [ -f $RPM_BUILD_ROOT%{_libdir}/libcfsutil.a ] ; then
167   echo '%attr(-, root, root) %{_libdir}/libcfsutil.a' >>lustre.files
168 fi
169
170 if [ -f $RPM_BUILD_ROOT%{_libdir}/liblustre.so ] ; then
171   echo '%attr(-, root, root) %{_libdir}/liblustre.a' >>lustre.files
172   echo '%attr(-, root, root) %{_libdir}/liblustre.so' >>lustre.files
173 fi
174
175 if [ -f $RPM_BUILD_DIR/lustre-%{version}/lustre/utils/libiam.c ] ; then
176   echo '%attr(-, root, root) %{_libdir}/libiam.a' >>lustre.files
177 fi
178
179 if [ -d $RPM_BUILD_ROOT%{_libdir}/lustre/snmp ] ; then
180   echo '%attr(-, root, root) %{_libdir}/lustre/snmp' >>lustre.files
181   echo '%attr(-, root, root) %{_datadir}/lustre/snmp/mibs' >>lustre.files
182 fi
183
184 # Have universal lustre headers 
185 if [ -f $RPM_BUILD_DIR/lustre-%{version}/lustre/include/lustre/lustre_idl.h ] ; then
186   echo '%attr(-, root, root) /usr/include/linux/lustre_user.h' >>lustre.files
187 else
188   echo '%attr(-, root, root) /usr/include/linux/lustre_idl.h' >>lustre.files
189 fi
190
191 if [ -f $RPM_BUILD_DIR/lustre-%{version}/lustre/include/linux/lustre_types.h ] ; then
192   echo '%attr(-, root, root) /usr/include/linux/lustre_types.h' >>lustre.files
193 fi
194
195 %if %{build_lustre_tests}
196 echo '%attr(-, root, root) %{_libdir}/lustre/tests/*' >lustre-tests.files
197 echo '%attr(-, root, root) /lib/modules/%{kversion}/kernel/fs/lustre/llog_test.*' >>lustre-tests.files
198 modules_excludes="|llog_test"
199 if [ -d $RPM_BUILD_ROOT%{_libdir}/lustre/liblustre/tests ] ; then
200   echo '%attr(-, root, root) %{_libdir}/lustre/liblustre/tests/*' >>lustre-tests.files
201 fi
202 %endif
203
204 pushd $RPM_BUILD_ROOT >/dev/null
205 find lib/modules/%{kversion}/kernel -type f | awk "!/(ZZZZZZZZZZ$modules_excludes)/ {print \"%attr(-, root, root) /\"\$0}" >>$RPM_BUILD_DIR/lustre-%{version}/lustre-modules.files
206 popd >/dev/null
207
208 %files -f lustre.files
209
210 %files modules -f lustre-modules.files
211 %attr(-, root, root) %doc COPYING
212 %attr(-, root, root) %doc ChangeLog-lustre
213 %attr(-, root, root) %doc ChangeLog-lnet
214
215 %files source
216 %attr(-, root, root) /usr/src/lustre-%{version}
217
218 # uncomment these lines to enable deps packages
219 # %files deps-sles
220 # %files deps-rhel
221
222 %if %{build_lustre_tests}
223 %files tests -f lustre-tests.files
224 %endif
225
226 %post modules
227 if [ -f /boot/System.map-%{kversion} ]; then
228         depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
229 else
230         depmod -ae %{kversion} || exit 0
231 fi
232 cat <<EOF
233 Congratulations on finishing your Lustre installation!  To register  
234 your copy of Lustre and find out more about Lustre Support, Service,  
235 and Training offerings please visit
236
237 http://www.sun.com/software/products/lustre/lustre_reg.jsp
238 EOF
239
240 # for update from < v1.4.6
241
242 for f in /etc/modules.conf /etc/modprobe.conf /etc/modprobe.conf.local ; 
243 do
244         if [ -f $f ]; then
245                 if grep 'lustre llite' $f >/dev/null 2>/dev/null ; then
246                         [ ! -f $f.rpmsave ] && cp $f $f.rpmsave
247                         TMPFILE=`mktemp $f.XXXXXX` && \
248                         rm -f $TMPFILE && touch $TMPFILE && \
249                         grep -v 'lustre llite' $f >> $TMPFILE && \
250                         mv $TMPFILE $f
251                 fi
252                 if egrep "^[^#]*(add below|install) ptlrpc" $f ; then
253                         [ ! -f $f.rpmsave ] && cp $f $f.rpmsave
254                         TMPFILE=`mktemp $f.XXXXXX` && \
255                         rm -f $TMPFILE && touch $TMPFILE && \
256                         sed -e "s/^[^#]*\(add below\|install\) ptlrpc.*/#&/" $f >> $TMPFILE && \
257                         mv $TMPFILE $f
258                 fi
259         fi
260 done
261
262 # If the kernel was built to reject unsupported modules (e.g. not a Lustre
263 # kernel), and this hasn't been overridden in /etc/modprobe.d yet, then
264 # print a warning so that users are aware of this issue.
265 if sysctl kernel.unsupported >/dev/null 2>&1 &&
266    [ "$(sysctl -n kernel.unsupported 2>/dev/null)" = "0" ] &&
267     ! modprobe -c | grep -q "^allow_unsupported_modules[ \t]1" ; then
268      echo "
269      warning: the Lustre modules are not supported by Novell. To use Lustre
270               on this system, you should put
271
272      allow_unsupported_modules 1
273
274      into /etc/modprobe.d/unsupported_modules"
275 fi
276
277 %postun modules
278 if [ -f /boot/System.map-%{kversion} ]; then
279         depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
280 else
281         depmod -ae %{kversion} || exit 0
282 fi
283
284 %if %{build_lustre_tests}
285 %post tests
286 if [ -f /boot/System.map-%{kversion} ]; then
287         depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
288 else
289         depmod -ae %{kversion} || exit 0
290 fi
291
292 %postun tests
293 if [ -f /boot/System.map-%{kversion} ]; then
294         depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
295 else
296         depmod -ae %{kversion} || exit 0
297 fi
298 %endif
299
300 %clean
301 rm -rf $RPM_BUILD_ROOT