2 %{!?version: %define version @VERSION@}
3 %{!?kver: %define kver ""}
4 %{!?kdir: %define kdir %(dir=$(echo "%configure_args" | sed -ne 's/.*--with-linux=\\([^ ][^ ]*\\).*$/\\1/p'); if [ -n "$dir" ]; then echo "$dir"; else if [ -n "%kver" ]; then kversion="%kver"; else kversion="$(uname -r)"; fi; echo "/lib/modules/$kversion/source"; fi)}
6 %{!?kobjdir: %define kobjdir %(dir=$(echo "%configure_args" | sed -ne 's/.*--with-linux-obj=\\([^ ][^ ]*\\).*$/\\1/p'); if [ -n "$dir" ]; then echo "$dir"; else if [ -n "%kver" ]; then kversion="%kver"; else kversion="$(uname -r)"; fi; if [ "%kdir" = "/lib/modules/$kversion/source" ]; then echo "/lib/modules/$kversion/build"; else echo "%kdir"; fi; fi)}
8 # as an alternative to this implementation we could simply "make -C $kdir kernelversion"
9 %{!?kversion: %define kversion %(if test -s %kobjdir/include/generated/utsrelease.h ; then LINUXRELEASEHEADER=%kobjdir/include/generated/utsrelease.h ; elif test -s %kobjdir/include/linux/utsrelease.h ; then LINUXRELEASEHEADER=%kobjdir/include/linux/utsrelease.h ; else LINUXRELEASEHEADER=%kobjdir/include/linux/version.h; fi; sed -ne '/^#define UTS_RELEASE/s/.*"\\(.*\\)"$/\\1/p' $LINUXRELEASEHEADER)}
11 %{!?downstream_release: %define downstream_release "@DOWNSTREAM_RELEASE@"}
13 %define buildid %(if [ -n "@BUILDID@" ]; then echo "_@BUILDID@"; fi)
15 %{!?myrelease: %define myrelease %(if [ -n "%downstream_release" ]; then echo -n "%{downstream_release}_"; fi; echo %kversion | tr '-' '_')}
17 # always append the buildid, even when the caller defines %release
18 %define fullrelease %{myrelease}%{buildid}
20 %{!?lustre_name: %define lustre_name lustre}
21 %{!?build_lustre_tests: %define build_lustre_tests 1}
23 # in order to get kernel symset and/or kernel module dependencies into
24 # the RPM, in order to support weak-modules, the internal dependency gen-
25 # erator needs to be disabled
26 # this is done with (reduce the double % down to a single %):
28 # %%global _use_internal_dependency_generator 0
30 # on SLES10, /usr/lib/rpm/macros already sets this, so no harm in also
31 # defining it here (until Suse changes their mind)
33 # on RHEL5, however, we do need to explicitly disable the internal dep-
34 # endency generator and allow the external one be used
35 # but since RedHat's kABI is only a subset of the total kernel ABI, it
36 # doesn't include all of the symbols we (or OFED for that matter) need
37 # until RedHat includes all of the symbols we need in their symsets we
38 # cannot support weak-modules
39 # we did e-mail the maintainer of all of this stuff @redhat but got no
41 #%%global _use_internal_dependency_generator 0
43 %define is_client %(bash -c "if [[ %{lustre_name} = *-client ]]; then echo -n '1'; else echo -n '0'; fi")
44 # for those uses that don't want the -smp/-bigsmp (or the .arch) on the end
46 %define krequires %(bash -c "echo %{kversion} | sed -e 's/\.x86_64$//' -e 's/\.i[3456]86$//' -e 's/-smp$//' -e 's/-bigsmp$//' -e 's/-ppc64$//' -e 's/-default$//'")
48 %define sles10 %(bash -c "if [ "%sles_version" = "10" ]; then echo -n '1'; else echo -n '0'; fi")
51 %define flavor %(bash -c "echo %{kversion} | sed -e 's/^.*-//'")
54 Summary: Lustre File System
57 Release: %{fullrelease}
59 Group: Utilities/System
60 Source: lustre-%{version}.tar.gz
61 URL: http://wiki.whamcloud.com/
62 BuildRoot: %{_tmppath}/lustre-%{version}-root
63 Obsoletes: lustre-lite, lustre-lite-utils, lustre-ldap nfs-utils-lustre
64 Provides: lustre-lite = %{version}, lustre-lite-utils = %{version}
65 Requires: %{name}-modules = %{version}
66 # GSS requires this: BuildRequires: pkgconfig, libgssapi-devel >= 0.10
69 Userspace tools and files for the Lustre file system.
72 Summary: Kernel Lustre modules for Linux %{kversion}
73 # for SLES11, we need nothing here
74 # for SLES10, we need (where %{flavor} is, i.e. smp):
76 Requires: kernel-%{flavor}
78 %if %{_vendor}=="redhat" || %{_vendor}=="fedora"
79 # for RHEL we need to require the specific kernel still since weak-modules
80 # support on RH is, well, weak, to be punny about it
81 Requires: kernel = %{krequires}
85 Requires: lustre-backend-fs
87 Group: Development/Kernel
90 Lustre file system, server and network drivers for Linux %{kversion}.
93 Summary: Object-Based Disk storage driver source
94 Group: Development/Kernel
97 Lustre sources for further development
99 # Since the RPMs we ship are to be used on both SLES and RHEL, we
100 # can't include any dependency information (since the package names
101 # are different on the two platforms).
103 # Instead, we can build these empty meta-packages that only include
104 # dependency information. These let people get the correct
105 # dependencies for their platform and lets them use tools like yum and
106 # red carpet to install the correct files.
108 # Unfortunately I have not seen this come up on the lists much, so I
109 # have disabled them (by commenting out their empty files section
110 # below) until it's clear that they resolve more confusion than they
114 Summary: Lustre dependencies meta-package for SLES
115 Group: Utilities/System
116 Provides: lustre-deps = %{version}
117 Requires: %{name} = %{version}, sles-release
118 Conflicts: %{name}-deps-rhel
120 %description deps-sles
121 This package has RPM dependencies appropriate for SLES systems.
124 Summary: Lustre dependencies meta-package for RHEL
125 Group: Utilities/System
126 Provides: lustre-deps = %{version}
127 Requires: %{name} = %{version}, redhat-release
128 Conflicts: %{name}-deps-sles
130 %description deps-rhel
131 This package has RPM dependencies appropriate for RHEL, RHL, and FC
135 Summary: Lustre testing framework
136 Group: Development/Kernel
137 Provides: %{name}-tests = %{version}
138 Requires: %{name} = %{version}, %{name}-modules = %{version}
141 This package contains a set of test binaries and scripts that are intended
142 to be used by the Lustre testing framework.
144 %if 0%{?suse_version}
148 %setup -qn lustre-%{version}
149 ln lustre/ChangeLog ChangeLog-lustre
150 ln lnet/ChangeLog ChangeLog-lnet
153 # if RPM_BUILD_NCPUS unset, set it
154 if [ -z "$RPM_BUILD_NCPUS" ] ; then
155 RPM_BUILD_NCPUS=$(egrep -c "^cpu[0-9]+" /proc/stat 2>/dev/null || echo 0 :)
156 if [ $RPM_BUILD_NCPUS -eq 0 ] ; then
159 if [ $RPM_BUILD_NCPUS -gt 8 ] ; then
164 rm -rf $RPM_BUILD_ROOT
166 # Set an explicit path to our Linux tree, if we can.
167 cd $RPM_BUILD_DIR/lustre-%{version}
168 # override %optflags so that the vendor's overzealous flags don't create
170 %define optflags -g -O2 -Werror
171 CONFIGURE_ARGS="%{?configure_args} --with-release=%release"
172 %if %{build_lustre_tests}
173 CONFIGURE_ARGS="$CONFIGURE_ARGS --enable-tests --enable-liblustre-tests"
175 CONFIGURE_ARGS="$CONFIGURE_ARGS --disable-tests --disable-liblustre-tests"
178 # if %%kdir was given, make sure it's not in the configure arguments
179 if [ -n "%kdir" ]; then
180 CONFIGURE_ARGS=$(echo $CONFIGURE_ARGS | sed -e 's/"\?--with-linux=[^ ][^ ]* \?//')
182 # ditto for %%kobjdir
183 if [ -n "%kobjdir" ]; then
184 CONFIGURE_ARGS=$(echo $CONFIGURE_ARGS | sed -e 's/"\?--with-linux-obj=[^ ][^ ]* \?//')
187 # we need to eval "configure" because $CONFIGURE_ARGS could have a quoted
188 # string in it which we don't want word splitted by the shell
189 %define eval_configure %(echo '%configure' | sed -e 's#\./configure#eval ./configure#')
192 %{?kdir: --with-linux=%kdir} %{?kobjdir: --with-linux-obj=%kobjdir} \
194 make -j $RPM_BUILD_NCPUS -s
197 make install DESTDIR=$RPM_BUILD_ROOT
198 # hack to avoid changing the libsysio code for "make install"
199 rm -f $RPM_BUILD_ROOT%{_libdir}/libsysio.a
200 # Remove ldiskfs module(s) - they are packaged by the ldiskfs .spec.
201 rm -rf $RPM_BUILD_ROOT/lib/modules/%{kversion}/updates/kernel/fs/lustre-ldiskfs
203 # hack to include the llog_test module in lustre-tests
204 llog_base=$RPM_BUILD_DIR/lustre-%{version}/lustre/obdclass/llog_test
205 if [ -e ${llog_base}.ko ]; then
206 cp ${llog_base}.ko $RPM_BUILD_ROOT/lib/modules/%{kversion}/updates/kernel/fs/lustre
207 elif [ -e ${llog_base}.o ]; then
208 cp ${llog_base}.o $RPM_BUILD_ROOT/lib/modules/%{kversion}/updates/kernel/fs/lustre
211 # Create the pristine source directory.
212 cd $RPM_BUILD_DIR/lustre-%{version}
213 mkdir -p $RPM_BUILD_ROOT/usr/src
215 ln -s $RPM_BUILD_ROOT/usr/src lustre-source
216 make distdir distdir=lustre-source/lustre-%{version}
217 chmod -R go-w lustre-source/lustre-%{version}
219 cat >lustre.files <<EOF
220 %attr(-, root, root) /sbin/mount.lustre
221 %attr(-, root, root) /usr/sbin/*
222 %attr(-, root, root) /usr/bin/*
224 %attr(-, root, root) /usr/share/lustre
226 %attr(-, root, root) %{_libdir}/libptlctl.a
227 %attr(-, root, root) %{_libdir}/liblustreapi.a
228 %attr(-, root, root) %{_libdir}/liblustreapi.so
229 %attr(-, root, root) /usr/include/lustre
230 %attr(-, root, root) /usr/include/libcfs
232 %attr(-, root, root) %{_mandir}/man?/*
234 %attr(-, root, root) %{_libexecdir}/lustre/lc_common
236 %attr(-, root, root) %{_sysconfdir}/udev/rules.d/99-lustre.rules
238 %attr(-, root, root) %{_sysconfdir}/init.d/lnet
239 %attr(-, root, root) %{_sysconfdir}/init.d/lustre
240 %attr(-, root, root) %{_sysconfdir}/ldev.conf
241 %attr(-, root, root) %{_sysconfdir}/sysconfig/lustre
242 %attr(-, root, root) %{_libexecdir}/lustre/haconfig
243 %attr(-, root, root) %{_sysconfdir}/ha.d/resource.d/Lustre
246 if [ -f $RPM_BUILD_ROOT%{_libdir}/libcfsutil.a ] ; then
247 echo '%attr(-, root, root) %{_libdir}/libcfsutil.a' >>lustre.files
250 if [ -f $RPM_BUILD_ROOT%{_libdir}/liblustre.so ] ; then
251 echo '%attr(-, root, root) %{_libdir}/liblustre.a' >>lustre.files
252 echo '%attr(-, root, root) %{_libdir}/liblustre.so' >>lustre.files
255 if [ -f $RPM_BUILD_DIR/lustre-%{version}/lustre/utils/libiam.c ] ; then
256 echo '%attr(-, root, root) %{_libdir}/libiam.a' >>lustre.files
259 if [ -d $RPM_BUILD_ROOT%{_libdir}/lustre/snmp ] ; then
260 echo '%attr(-, root, root) %{_libdir}/lustre/snmp' >>lustre.files
261 echo '%attr(-, root, root) %{_datadir}/lustre/snmp/mibs' >>lustre.files
264 # Have universal lustre headers
265 if [ -f $RPM_BUILD_DIR/lustre-%{version}/lustre/include/lustre/lustre_idl.h ] ; then
266 echo '%attr(-, root, root) /usr/include/linux/lustre_user.h' >>lustre.files
268 echo '%attr(-, root, root) /usr/include/linux/lustre_idl.h' >>lustre.files
271 if [ -f $RPM_BUILD_DIR/lustre-%{version}/lustre/include/linux/lustre_types.h ] ; then
272 echo '%attr(-, root, root) /usr/include/linux/lustre_types.h' >>lustre.files
275 %if %{build_lustre_tests}
276 echo '%attr(-, root, root) %{_libdir}/lustre/tests/*' >lustre-tests.files
277 echo '%attr(-, root, root) /lib/modules/%{kversion}/updates/kernel/fs/lustre/llog_test.*' >>lustre-tests.files
278 modules_excludes="|llog_test"
279 if [ -d $RPM_BUILD_ROOT%{_libdir}/lustre/liblustre/tests ] ; then
280 echo '%attr(-, root, root) %{_libdir}/lustre/liblustre/tests/*' >>lustre-tests.files
284 pushd $RPM_BUILD_ROOT >/dev/null
285 > $RPM_BUILD_DIR/lustre-%{version}/lustre-modules.files
286 find lib/modules/%{kversion}/updates -type f | awk "!/(ZZZZZZZZZZ$modules_excludes)/ {print \"%attr(-, root, root) /\"\$0}" >>$RPM_BUILD_DIR/lustre-%{version}/lustre-modules.files
289 %files -f lustre.files
291 %files modules -f lustre-modules.files
292 %attr(-, root, root) %doc COPYING
293 %attr(-, root, root) %doc ChangeLog-lustre
294 %attr(-, root, root) %doc ChangeLog-lnet
297 %attr(-, root, root) /usr/src/lustre-%{version}
299 # uncomment these lines to enable deps packages
303 %if %{build_lustre_tests}
304 %files tests -f lustre-tests.files
308 if [ -f /boot/System.map-%{kversion} ]; then
309 depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
311 depmod -ae %{kversion} || exit 0
314 MODULES_RPM_NAME=$(rpm -q %{name}-modules | grep "%{version}-%{release}")
315 # "weak modules" support
317 if [ -x /usr/lib/module-init-tools/weak-modules ]; then
318 rpm -ql $MODULES_RPM_NAME | grep '\.ko$' |
319 /usr/lib/module-init-tools/weak-modules --add-modules
322 if [ -x /sbin/weak-modules ]; then
323 rpm -ql $MODULES_RPM_NAME | grep '\.ko$' |
324 /sbin/weak-modules --add-modules
327 # If the kernel was built to reject unsupported modules (e.g. not a Lustre
328 # kernel), and this hasn't been overridden in /etc/modprobe.d yet, then
329 # print a warning so that users are aware of this issue.
330 if sysctl kernel.unsupported >/dev/null 2>&1 &&
331 [ "$(sysctl -n kernel.unsupported 2>/dev/null)" = "0" ] &&
332 ! modprobe -c | grep -q "^allow_unsupported_modules[ \t]1" ; then
334 warning: the Lustre modules are not supported by Novell. To use Lustre
335 on this system, you should put
337 allow_unsupported_modules 1
339 into /etc/modprobe.d/unsupported_modules"
343 MODULES_RPM_NAME=$(rpm -q %{name}-modules | grep "%{version}-%{release}")
344 rpm -ql $MODULES_RPM_NAME | grep '\.ko$' > /var/run/%{name}-modules || true
347 if [ -f /boot/System.map-%{kversion} ]; then
348 depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
350 depmod -ae %{kversion} || exit 0
353 # "weak modules" support
355 if [ -x /usr/lib/module-init-tools/weak-modules ]; then
356 cat /var/run/%{name}-modules |
357 /usr/lib/module-init-tools/weak-modules --remove-modules
360 if [ -x /sbin/weak-modules ]; then
361 cat /var/run/%{name}-modules |
362 /sbin/weak-modules --remove-modules
364 rm /var/run/%{name}-modules
366 %if %{build_lustre_tests}
368 if [ -f /boot/System.map-%{kversion} ]; then
369 depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
371 depmod -ae %{kversion} || exit 0
375 if [ -f /boot/System.map-%{kversion} ]; then
376 depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
378 depmod -ae %{kversion} || exit 0
383 rm -rf $RPM_BUILD_ROOT