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