3 # Declare rpmbuild --with/--without parameters
7 %bcond_without lustre_tests
8 %bcond_without lustre_utils
9 %bcond_without lustre_iokit
10 %bcond_without lustre_modules
12 %bcond_without gss_keyring
13 %bcond_without manpages
18 %if %{without servers}
19 # --without servers overrides --with {ldiskfs|zfs}
20 # so undefine the internal variables set by bcond_*
21 %undefine with_ldiskfs
25 %{!?version: %global version @VERSION@}
26 %{!?kver: %global kver %(uname -r)}
27 %{!?kdir: %global kdir /lib/modules/%{kver}/source}
28 %{!?kobjdir: %global kobjdir %(if [ "%{kdir}" = "/lib/modules/%{kver}/source" ]; then echo "/lib/modules/%{kver}/build"; else echo "%{kdir}"; fi)}
30 # as an alternative to this implementation we could simply "make -C $kdir kernelversion"
31 %{!?kversion: %global kversion %(files="include/generated/utsrelease.h include/linux/utsrelease.h include/linux/version.h"; for f in $files; do if test -r %{kobjdir}/$f && grep UTS_RELEASE %{kobjdir}/$f >/dev/null; then sed -ne '/^#define UTS_RELEASE/s/.*"\\(.*\\)"$/\\1/p' %{kobjdir}/$f; break; fi; done)}
33 # We set this because kernel_module_package has its own method of identifying
34 # which kernel to build against, and it is unlikely that its decision will
35 # match with Lustre's method of selecting which kernel to build against.
36 # By setting this variable, we override kernel_module_package's kernel
37 # selection with our selection.
38 %{!?kernel_version: %global kernel_version %kversion}
40 # in order to get kernel symset and/or kernel module dependencies into
41 # the RPM, in order to support weak-modules, the internal dependency gen-
42 # erator needs to be disabled
43 # this is done with (reduce the double % down to a single %):
45 # %%global _use_internal_dependency_generator 0
47 # on SLES10, /usr/lib/rpm/macros already sets this, so no harm in also
48 # defining it here (until Suse changes their mind)
50 # on RHEL5, however, we do need to explicitly disable the internal dep-
51 # endency generator and allow the external one be used
52 # but since RedHat's kABI is only a subset of the total kernel ABI, it
53 # doesn't include all of the symbols we (or OFED for that matter) need
54 # until RedHat includes all of the symbols we need in their symsets we
55 # cannot support weak-modules
56 # we did e-mail the maintainer of all of this stuff @redhat but got no
58 #%%global _use_internal_dependency_generator 0
60 # Set the package name prefix
61 %if %{undefined lustre_name}
63 %global lustre_name lustre
65 %global lustre_name lustre-client
69 %if %{undefined kmoddir}
70 %if %{defined kernel_module_package_moddir}
71 %global kmoddir %{kernel_module_package_moddir}
73 %if %{defined suse_kernel_module_package}
74 %global kmoddir updates
81 %global modules_fs_path /lib/modules/%{kversion}/%{kmoddir}
83 %if %{_vendor}=="redhat" || %{_vendor}=="fedora"
84 %global requires_yaml_name libyaml
85 %global requires_kmod_name kmod-%{lustre_name}
86 %if %{with lustre_tests}
87 %global requires_kmod_tests_name kmod-%{lustre_name}-tests
89 %global requires_kmod_version %{version}
91 %global requires_yaml_name libyaml-0-2
92 %global requires_kmod_name %{lustre_name}-kmp
93 %if %{with lustre_tests}
94 %global requires_kmod_tests_name %{lustre_name}-tests-kmp
96 %define krequires %(echo %{kversion} | sed -e 's/\.x86_64$//' -e 's/\.i[3456]86$//' -e 's/-smp$//' -e 's/-bigsmp$//' -e 's/[-.]ppc64$//' -e 's/\.aarch64$//' -e 's/-default$//')
97 %if 0%{?suse_version} >= 1200
98 %global requires_kmod_version %{version}_k%(echo %{krequires} | sed -r 'y/-/_/; s/^(2\.6\.[0-9]+)_/\\1.0_/;')
100 %global requires_kmod_version %{version}_%(echo %{krequires} | sed -r 'y/-/_/; s/^(2\.6\.[0-9]+)_/\\1.0_/;')
104 # RHEL >= 7 comes with systemd
106 %define with_systemd 1
109 # Fedora >= 15 comes with systemd, but only >= 18 has
111 %if 0%{?fedora} >= 18
112 %define with_systemd 1
115 # opensuse >= 12.1 comes with systemd, but only >= 13.1
116 # has the proper macros
117 %if 0%{?suse_version} >= 1310
118 %define with_systemd 1
121 Summary: Lustre File System
126 Group: System Environment/Kernel
127 Source: lustre-%{version}.tar.gz
128 Source1: kmp-lustre.preamble
129 Source2: kmp-lustre.files
130 Source3: kmp-lustre-osd-ldiskfs.preamble
131 Source4: kmp-lustre-osd-ldiskfs.files
132 Source5: kmp-lustre-osd-zfs.preamble
133 Source6: kmp-lustre-osd-zfs.files
134 Source7: kmp-lustre-tests.files
135 URL: https://wiki.hpdd.intel.com/
136 BuildRoot: %{_tmppath}/lustre-%{version}-root
137 Requires: %{requires_kmod_name} = %{requires_kmod_version} zlib
138 Requires: %{requires_yaml_name}
139 BuildRequires: libtool libyaml-devel zlib-devel
142 Requires: lustre-osd-mount
143 Obsoletes: lustre-client < %{version}
144 Provides: lustre-client = %{version}-%{release}
146 # GSS requires this: BuildRequires: pkgconfig, libgssapi-devel >= 0.10
147 %if %{_vendor}=="redhat" || %{_vendor}=="fedora"
148 #suse don't support selinux
149 BuildRequires: libselinux-devel
152 %if %{with lustre_modules}
153 BuildRequires: %kernel_module_package_buildreqs
154 %if %{_vendor}=="redhat"
155 BuildRequires: redhat-rpm-config
160 Requires(post): systemd
161 Requires(preun): systemd
162 Requires(postun): systemd
163 BuildRequires: systemd
167 Userspace tools and files for the Lustre file system.
169 %if %{with lustre_modules}
170 %kernel_module_package -n %{name} -p %SOURCE1 -f %SOURCE2 default
173 %kernel_module_package -n %{name}-osd-ldiskfs -p %SOURCE3 -f %SOURCE4 default
174 %if %{with lustre_utils}
175 %package osd-ldiskfs-mount
176 Summary: osd-ldiskfs-mount contains mount's ldiskfs specific dso.
177 Provides: lustre-osd-mount = %{version}-%{fullrelease}
178 Group: System Environment/Kernel
180 %description osd-ldiskfs-mount
181 LDISKFS hooks for mount/mkfs into a dynamic library.
183 %endif # with lustre_utils
184 %endif # with ldiskfs
187 %kernel_module_package -n %{name}-osd-zfs -p %SOURCE5 -f %SOURCE6 default
188 %if %{with lustre_utils}
189 %package osd-zfs-mount
190 Summary: osd-zfs-mount contains mount's zfs specific dso.
191 Provides: lustre-osd-mount = %{version}-%{fullrelease}
192 Group: System Environment/Kernel
194 %description osd-zfs-mount
195 ZFS hooks for mount/mkfs into a dynamic library.
197 %endif # with lustre_utils
200 %endif # with lustre_modules
203 %package resource-agents
204 Summary: HA Resuable Cluster Resource Scripts for Lustre
205 Group: System Environment/Base
207 Requires: resource-agents
209 %description resource-agents
210 A set of scripts to operate Lustre resources in a High Availablity
211 environment for both Pacemaker and rgmanager.
214 %if %{with lustre_tests}
216 Summary: Lustre testing framework
217 Group: System Environment/Kernel
218 Provides: %{name}-tests = %{version}
219 %if %{with lustre_iokit}
220 Requires: %{name} = %{version}, lustre-iokit
222 Requires: %{name} = %{version}
224 Requires: %{requires_kmod_name} = %{requires_kmod_version}
225 Requires: %{requires_kmod_tests_name} = %{requires_kmod_version}
226 Requires: attr, rsync, perl, lsof, /usr/bin/getconf
229 This package contains a set of test binaries and scripts that are intended
230 to be used by the Lustre testing framework.
232 %if %{with lustre_modules}
233 %kernel_module_package -n %{name}-tests -f %SOURCE7 default
237 %if %{with lustre_iokit}
238 %package -n lustre-iokit
239 Summary: The Lustre IO-Kit is a collection of benchmark tools for a cluster with the Lustre file system.
240 Group: Applications/System
241 Requires: python > 2.2, sg3_utils
243 %description -n lustre-iokit
244 This package includes five tools:
246 A test of the 'bare metal' performance, bypassing as much of the kernel as we can. Uses the sgp_dd utility.
249 This survey can be run in 3 modes to test disk I/O including the filesystem,
250 network I/O, and disk I/O via the network. The script does sequential I/O
251 with varying numbers of threads and objects (files) by using lctl::test_brw
252 to drive the echo_client connected to local or remote obdfilter instances,
253 or remote obdecho instances.
256 This survey tests the client-to-disk performance of individual OSTs, and
257 ranks then for comparison.
260 This script will collect IO stats on a defined set of nodes.
263 A script to run the IOR benchmark. The latest version can be downloaded from
264 http://www.llnl.gov/asci/purple/benchmarks/limited/ior/
267 This survey tests the local metadata performance using the echo_client to drive
268 the MDD layer to perform operations. It is run with multiple threads (to
269 simulate MDT service threads) locally on the MDS node, and does not need Lustre
270 clients in order to run
273 %if 0%{?suse_version}
277 %setup -qn lustre-%{version}
278 ln lustre/ChangeLog ChangeLog-lustre
279 ln lnet/ChangeLog ChangeLog-lnet
282 # Set an explicit path to our Linux tree, if we can.
283 cd $RPM_BUILD_DIR/lustre-%{version}
284 # override %optflags so that the vendor's overzealous flags don't create
286 %define optflags -g -O2 -Werror
288 CONFIGURE_ARGS="%{?configure_args}"
289 if [ -n "$CONFIGURE_ARGS" ]; then
290 # make sure %%kdir and %%kobjdir are not in the configure arguments
291 CONFIGURE_ARGS=$(echo $CONFIGURE_ARGS | sed -e 's/"\?--with-linux=[^ ][^ ]* \?//')
292 CONFIGURE_ARGS=$(echo $CONFIGURE_ARGS | sed -e 's/"\?--with-linux-obj=[^ ][^ ]* \?//')
293 # remove --with-kmp-moddir from configure arguments,
294 # it will be set --with-kmp-moddir=%%kmoddir
295 CONFIGURE_ARGS=$(echo $CONFIGURE_ARGS | sed -e 's/"\?--with-kmp-moddir=[^ ][^ ]* \?//')
298 # we need to eval "configure" because $CONFIGURE_ARGS could have a quoted
299 # string in it which we don't want word splitted by the shell
300 # also remove (build|host|target) options because they will be specified
301 # inside $CONFIGURE_ARGS
302 # kmod tools/scripts require %{name} directory with kernel modules
303 %define eval_configure %(echo '%configure' | sed -e 's#\./configure#eval ./configure#' -e 's/--\\(build\\|host\\|target\\)=[^ ][^ ]* //g')
305 %eval_configure $CONFIGURE_ARGS \
306 %{?with_lustre_tests:--enable-tests}%{!?with_lustre_tests:--disable-tests} \
307 %{?with_lustre_utils:--enable-utils}%{!?with_lustre_utils:--disable-utils} \
308 %{?with_lustre_modules:--enable-modules}%{!?with_lustre_modules:--disable-modules} \
309 %{!?with_shared:--disable-shared} \
310 %{!?with_static:--disable-static} \
311 %{!?with_lustre_iokit:--disable-iokit} \
312 %{!?with_ldiskfs:--disable-ldiskfs} \
313 %{!?with_servers:--disable-server} \
314 %{!?with_zfs:--without-zfs} \
315 %{!?with_snmp:--disable-snmp} \
316 %{!?with_gss_keyring:--disable-gss-keyring} \
317 %{!?with_manpages:--disable-manpages} \
318 %{!?with_systemd:--with-systemdsystemunitdir=no} \
319 %{?with_systemd:--with-systemdsystemunitdir=%{_unitdir}} \
320 --with-linux=%{kdir} \
321 --with-linux-obj=%{kobjdir} \
322 --with-kmp-moddir=%{kmoddir}/%{name}
324 make %{?_smp_mflags} -s %{?make_args}
327 make install DESTDIR=$RPM_BUILD_ROOT
329 # RHEL's kernel_module_path macro expects that all the modules
330 # in a kmod package will be in modules_fs_path/<sub packagename>
331 # but Lustre installs all of the modules in a single pass into
332 # a shared location. Since this is a restriction imposed by
333 # RHEL, we handle this here in the spec file rather than in
334 # Lustre's build system. This is not expected to bother SLES's
335 # kernel_module_path macro.
336 basemodpath=$RPM_BUILD_ROOT%{modules_fs_path}/%{lustre_name}
338 mkdir -p $basemodpath-osd-ldiskfs/fs
339 mv $basemodpath/fs/osd_ldiskfs.ko $basemodpath-osd-ldiskfs/fs/osd_ldiskfs.ko
340 mv $basemodpath/fs/ldiskfs.ko $basemodpath-osd-ldiskfs/fs/ldiskfs.ko
343 mkdir -p $basemodpath-osd-zfs/fs
344 mv $basemodpath/fs/osd_zfs.ko $basemodpath-osd-zfs/fs/osd_zfs.ko
346 %if %{with lustre_tests}
347 mkdir -p $basemodpath-tests/fs
348 mv $basemodpath/fs/llog_test.ko $basemodpath-tests/fs/llog_test.ko
349 mkdir -p $RPM_BUILD_ROOT%{_libdir}/lustre/tests/kernel/
350 mv $basemodpath/fs/kinode.ko $RPM_BUILD_ROOT%{_libdir}/lustre/tests/kernel/
355 %if %{with servers} && %{with lustre_utils}
356 # The .ha_v2 extension identifies the heartbeat resource agent as using
357 # legacy syntax. Install a compatibility symlink to avoid conflicts when
358 # newer-style agents are added.
359 ln -s Lustre.ha_v2 $RPM_BUILD_ROOT%{_sysconfdir}/ha.d/resource.d/Lustre
360 echo '%{_sysconfdir}/ha.d/resource.d/Lustre.ha_v2' >>lustre.files
361 echo '%{_sysconfdir}/ha.d/resource.d/Lustre' >>lustre.files
364 # systemd is on redhat, fedora, and suse
366 echo '%{_unitdir}/lnet.service' >>lustre.files
369 %if %{_vendor}=="redhat"
370 # The following scripts are Red Hat specific
372 echo '%{_sysconfdir}/init.d/lustre' >>lustre.files
373 echo '%{_sysconfdir}/sysconfig/lustre' >>lustre.files
374 %if %{with gss_keyring}
375 echo '%{_sysconfdir}/init.d/lsvcgss' >>lustre.files
376 echo '%{_sysconfdir}/sysconfig/lsvcgss' >>lustre.files
380 %if %{without systemd}
381 echo '%{_sysconfdir}/init.d/lnet' >>lustre.files
385 CONFIGURE_ARGS="%{?configure_args}"
386 if [ -z "$(echo $CONFIGURE_ARGS | grep "\-\-disable\-gss\-keyring")" ]; then
387 echo '%config(noreplace) %{_sysconfdir}/request-key.d/lgssc.conf' >>lustre.files
391 mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/ocf/resource.d/lustre/
392 install -m 0755 contrib/scripts/pacemaker/* $RPM_BUILD_ROOT%{_prefix}/lib/ocf/resource.d/lustre/
395 # fc18 needs 'x' permission for library files
396 find $RPM_BUILD_ROOT -name \*.so -type f -exec chmod +x {} \;
398 rm -f $RPM_BUILD_ROOT%{_libdir}/liblnetconfig.la
400 echo '%attr(-, root, root) %{_libdir}/liblnetconfig.a' >>lustre.files
403 echo '%attr(-, root, root) %{_libdir}/liblnetconfig.so' >>lustre.files
404 echo '%attr(-, root, root) %{_libdir}/liblnetconfig.so.*' >>lustre.files
408 echo '%{_libdir}/libiam.a' >>lustre.files
412 mkdir -p $RPM_BUILD_ROOT/%{_libdir}/lustre/snmp
413 echo '%{_libdir}/lustre/snmp' >>lustre.files
416 %if %{with lustre_utils}
417 mkdir -p $RPM_BUILD_ROOT/%{_datadir}/lustre
418 if [ -d $RPM_BUILD_ROOT%{_libdir}/lustre ] ; then
419 find $RPM_BUILD_ROOT%{_libdir}/@PACKAGE@ -name \*.la -type f -exec rm -f {} \;
423 %if %{with lustre_modules}
424 # mark modules executable for find-debuginfo.sh
425 find $RPM_BUILD_ROOT/lib/modules -name \*.ko -type f -exec chmod u+x {} \;
428 rm -f $RPM_BUILD_ROOT%{_libdir}/liblustreapi.la
430 %if %{with lustre_tests}
431 :> lustre-tests.files
432 echo '%{_libdir}/lustre/tests/*' >>lustre-tests.files
433 echo '%{_bindir}/mcreate' >>lustre-tests.files
434 echo '%{_bindir}/munlink' >>lustre-tests.files
435 echo '%{_sbindir}/wirecheck' >>lustre-tests.files
436 echo '%{_sbindir}/wiretest' >>lustre-tests.files
439 %files -f lustre.files
440 %defattr(-,root,root)
442 %if %{with lustre_tests}
443 %exclude %{_sbindir}/wirecheck
444 %exclude %{_sbindir}/wiretest
447 %exclude %{_sbindir}/zfsobj2fid
449 %if %{with lustre_utils}
451 %{_libexecdir}/lustre/lc_common
452 %{_libexecdir}/lustre/haconfig
453 %{_bindir}/lustre_req_history
458 %{_bindir}/plot-llstat
461 %{_bindir}/lfs_migrate
464 %{_libdir}/liblustreapi.a
467 %{_libdir}/liblustreapi.so*
473 %{_includedir}/lustre
474 %{_includedir}/linux/lnet
475 %{_includedir}/linux/lustre
477 %{_sysconfdir}/udev/rules.d/99-lustre.rules
479 %config(noreplace) %{_sysconfdir}/ldev.conf
481 %config(noreplace) %{_sysconfdir}/lnet.conf
482 %config(noreplace) %{_sysconfdir}/modprobe.d/ko2iblnd.conf
483 %if %{with lustre_utils}
484 %config(noreplace) %{_sysconfdir}/lnet_routes.conf
486 %if %{with lustre_modules}
490 %if %{with lustre_utils}
491 %files osd-ldiskfs-mount
492 %defattr(-,root,root)
493 %{_libdir}/@PACKAGE@/mount_osd_ldiskfs.so
500 %if %{with lustre_utils}
502 %defattr(-,root,root)
503 %{_libdir}/@PACKAGE@/mount_osd_zfs.so
504 %{_sysconfdir}/zfs/zed.d/*
509 %endif # with lustre_modules
512 %files resource-agents
513 %defattr(0755,root,root)
514 %{_prefix}/lib/ocf/resource.d/lustre/
517 %if %{with lustre_tests}
518 %files tests -f lustre-tests.files
519 %defattr(-,root,root)
522 %if %{with lustre_iokit}
523 %files -n lustre-iokit
524 %defattr(-, root, root)
525 %{_bindir}/iokit-config
526 %{_bindir}/iokit-gather-stats
527 %{_bindir}/iokit-libecho
528 %{_bindir}/iokit-lstats
529 %{_bindir}/iokit-parse-ior
530 %{_bindir}/iokit-plot-obdfilter
531 %{_bindir}/iokit-plot-ost
532 %{_bindir}/iokit-plot-sgpdd
533 %{_bindir}/ior-survey
534 %{_bindir}/mds-survey
535 %{_bindir}/obdfilter-survey
536 %{_bindir}/ost-survey
537 %{_bindir}/sgpdd-survey
538 %doc lustre-iokit/ior-survey/README.ior-survey
539 %doc lustre-iokit/mds-survey/README.mds-survey
540 %doc lustre-iokit/obdfilter-survey/README.obdfilter-survey
541 %doc lustre-iokit/ost-survey/README.ost-survey
542 %doc lustre-iokit/sgpdd-survey/README.sgpdd-survey
543 %doc lustre-iokit/stats-collect/README.iokit-lstats
548 %systemd_post lnet.service
553 %systemd_preun lnet.service
558 %systemd_postun_with_restart lnet.service
562 rm -rf $RPM_BUILD_ROOT
563 rm -rf %{_tmppath}/kmp