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