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