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