Whamcloud - gitweb
50fa9f7e6ca2e3cc7aeec4458555b3dbc0c3826c
[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 %if ! %{is_client}
35 %package source
36 Summary: Object-Based Disk storage driver source
37 Group: Development/Kernel
38
39 %description source
40 Lustre sources for further development
41 %endif
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 %if ! %{is_client}
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 %endif
89
90 %prep
91 %setup -qn lustre-%{version}
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         --sysconfdir=%{_sysconfdir} \
111         --mandir=%{_mandir} \
112         --libdir=%{_libdir}
113 make -j $RPM_BUILD_NCPUS -s
114
115 %install
116 make install DESTDIR=$RPM_BUILD_ROOT
117 # hack to avoid changing the libsysio code for "make install"
118 rm -f $RPM_BUILD_ROOT%{_libdir}/libsysio.a
119 # Remove ldiskfs module(s) - they are packaged by the ldiskfs .spec.
120 rm -rf $RPM_BUILD_ROOT/lib/modules/%{kversion}/kernel/fs/lustre-ldiskfs
121
122 %if %{is_client}
123 # remove the tests that were installed
124 rm -rf $RPM_BUILD_ROOT%{_libdir}/lustre/tests \
125        $RPM_BUILD_ROOT%{_libdir}/lustre/liblustre/tests
126 %else
127 # hack to include the llog_test module in lustre-tests
128 llog_base=$RPM_BUILD_DIR/lustre-%{version}/lustre/obdclass/llog_test
129 if [ -e ${llog_base}.ko ]; then
130   cp ${llog_base}.ko $RPM_BUILD_ROOT/lib/modules/%{kversion}/kernel/fs/lustre
131 elif [ -e ${llog_base}.o ]; then
132   cp ${llog_base}.o $RPM_BUILD_ROOT/lib/modules/%{kversion}/kernel/fs/lustre
133 fi
134
135 # Create the pristine source directory.
136 cd $RPM_BUILD_DIR/lustre-%{version}
137 mkdir -p $RPM_BUILD_ROOT/usr/src
138 rm -f lustre-source
139 ln -s $RPM_BUILD_ROOT/usr/src lustre-source
140 make distdir distdir=lustre-source/lustre-%{version}
141 chmod -R go-w lustre-source/lustre-%{version}
142 %endif
143
144 cat >lustre.files <<EOF
145 %attr(-, root, root) /sbin/mount.lustre
146 %attr(-, root, root) /usr/sbin/*
147 %attr(-, root, root) /usr/bin/*
148
149 %attr(-, root, root) /usr/share/lustre
150
151 %attr(-, root, root) %{_libdir}/libptlctl.a
152 %attr(-, root, root) %{_libdir}/liblustreapi.a
153 %attr(-, root, root) /usr/include/lustre
154
155 %attr(-, root, root) %{_mandir}/man?/*
156
157 %attr(-, root, root) %{_libdir}/lustre/lc_common
158 EOF
159
160 if [ -f $RPM_BUILD_ROOT%{_libdir}/libcfsutil.a ] ; then
161   echo '%attr(-, root, root) %{_libdir}/libcfsutil.a' >>lustre.files
162 fi
163
164 if [ -f $RPM_BUILD_ROOT%{_libdir}/liblustre.so ] ; then
165   echo '%attr(-, root, root) %{_libdir}/liblustre.a' >>lustre.files
166   echo '%attr(-, root, root) %{_libdir}/liblustre.so' >>lustre.files
167 fi
168
169 if [ -f $RPM_BUILD_DIR/lustre-%{version}/lustre/utils/libiam.c ] ; then
170   echo '%attr(-, root, root) %{_libdir}/libiam.a' >>lustre.files
171 fi
172
173 if [ -d $RPM_BUILD_ROOT%{_libdir}/lustre/snmp ] ; then
174   echo '%attr(-, root, root) %{_libdir}/lustre/snmp' >>lustre.files
175   echo '%attr(-, root, root) %{_datadir}/lustre/snmp/mibs' >>lustre.files
176 fi
177
178 # Have universal lustre headers 
179 if [ -f $RPM_BUILD_DIR/lustre-%{version}/lustre/include/lustre/lustre_idl.h ] ; then
180   echo '%attr(-, root, root) /usr/include/linux/lustre_user.h' >>lustre.files
181 else
182   echo '%attr(-, root, root) /usr/include/linux/lustre_idl.h' >>lustre.files
183 fi
184
185 if [ -f $RPM_BUILD_DIR/lustre-%{version}/lustre/include/linux/lustre_types.h ] ; then
186   echo '%attr(-, root, root) /usr/include/linux/lustre_types.h' >>lustre.files
187 fi
188
189 echo '%attr(-, root, root) %{_libdir}/lustre/tests/*' >lustre-tests.files
190 echo '%attr(-, root, root) /lib/modules/%{kversion}/kernel/fs/lustre/llog_test.*' >>lustre-tests.files
191 modules_excludes="llog_test"
192 if [ -d $RPM_BUILD_ROOT%{_libdir}/lustre/liblustre/tests ] ; then
193   echo '%attr(-, root, root) %{_libdir}/lustre/liblustre/tests/*' >>lustre-tests.files
194 fi
195
196 pushd $RPM_BUILD_ROOT >/dev/null
197 find lib/modules/%{kversion}/kernel -type f | awk "!/($modules_excludes)/ {print \"/\"\$0}" >>$RPM_BUILD_DIR/lustre-%{version}/lustre-modules.files
198 popd >/dev/null
199
200 %files -f lustre.files
201
202 %files modules -f lustre-modules.files
203 %attr(-, root, root) %doc COPYING
204
205 %if ! %{is_client}
206 %files source
207 %attr(-, root, root) /usr/src/lustre-%{version}
208 %endif
209
210 # uncomment these lines to enable deps packages
211 # %files deps-sles
212 # %files deps-rhel
213
214 %if ! %{is_client}
215 %files tests -f lustre-tests.files
216 %endif
217
218 %post modules
219 if [ -f /boot/System.map-%{kversion} ]; then
220         depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
221 else
222         depmod -ae %{kversion} || exit 0
223 fi
224 cat <<EOF
225 Congratulations on finishing your Lustre installation!  To register  
226 your copy of Lustre and find out more about Lustre Support, Service,  
227 and Training offerings please visit
228
229 http://www.sun.com/software/products/lustre/lustre_reg.jsp
230 EOF
231
232 # for update from < v1.4.6
233
234 for f in /etc/modules.conf /etc/modprobe.conf /etc/modprobe.conf.local ; 
235 do
236         if [ -f $f ]; then
237                 if grep 'lustre llite' $f >/dev/null 2>/dev/null ; then
238                         [ ! -f $f.rpmsave ] && cp $f $f.rpmsave
239                         TMPFILE=`mktemp $f.XXXXXX` && \
240                         rm -f $TMPFILE && touch $TMPFILE && \
241                         grep -v 'lustre llite' $f >> $TMPFILE && \
242                         mv $TMPFILE $f
243                 fi
244                 if egrep "^[^#]*(add below|install) ptlrpc" $f ; then
245                         [ ! -f $f.rpmsave ] && cp $f $f.rpmsave
246                         TMPFILE=`mktemp $f.XXXXXX` && \
247                         rm -f $TMPFILE && touch $TMPFILE && \
248                         sed -e "s/^[^#]*\(add below\|install\) ptlrpc.*/#&/" $f >> $TMPFILE && \
249                         mv $TMPFILE $f
250                 fi
251         fi
252 done
253
254 %postun modules
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 %if ! %{is_client}
262 %post tests
263 if [ -f /boot/System.map-%{kversion} ]; then
264         depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
265 else
266         depmod -ae %{kversion} || exit 0
267 fi
268
269 %postun tests
270 if [ -f /boot/System.map-%{kversion} ]; then
271         depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
272 else
273         depmod -ae %{kversion} || exit 0
274 fi
275 %endif
276
277 %clean
278 rm -rf $RPM_BUILD_ROOT