1
0
multipath-tools/multipath-tools.spec
2017-06-20 09:04:28 +00:00

285 lines
8.0 KiB
RPMSpec

#
# spec file for package multipath-tools
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# Workaround for Leap 42.1 bug, bsc#940315
%if 0%{?suse_version} == 1315
%if 0%{?is_opensuse} == 1
%if 0%{?sle_version} == 0
%define sle_version 120100
%endif
%endif
%endif
# Whether to build with RADOS support
# Default YES on openSUSE factory and leap >= 42.2 and SLES12 >= SP3
# (but only on architectures for which ceph is enabled).
# Default NO on SLES 12 >= SP2
# Always NO on other distros
%if 0%{?suse_version} == 1315
%if 0%{?is_opensuse} == 1
#### Leap 42.x: Support from 42.2 on, for ceph-supported archs
#### (see ExclusiveArch in ceph spec file)
%ifarch x86_64 aarch64 ppc64 ppc64le
%if 0%{?sle_version} >= 120200
%bcond_without rados
%endif # 0%{?sle_version} >= 120200
%endif # arch
%else # 0%{?is_opensuse} == 1
#### SLE12: Support from SP3 on, for ceph-supported archs
#### (see ExclusiveArch in ceph spec file *on IBS*)
%ifarch x86_64 aarch64
%if 0%{?sle_version} >= 120300
%bcond_without rados
%else # 0%{?sle_version} >= 120300
#### SLE12 SP2: rados can be enabled here using --with rados
%if 0%{?sle_version} >= 120200
%bcond_with rados
%endif # 0%{?sle_version} >= 120200
%endif # 0%{?sle_version} >= 120300
%endif # arch
%endif # 0%{?is_opensuse} == 1
%else # 0%{?suse_version} == 1315
%if 0%{?suse_version} >= 1330
#### Factory / Tumbleweed
#### (see ExclusiveArch in ceph spec file)
%ifarch x86_64 aarch64 ppc64 ppc64le
%bcond_without rados
%endif # arch
%endif # 0%{?suse_version} >= 1330
%endif # 0%{?suse_version} == 1315
# Whether to build libdmmp
# Default YES on openSUSE factory and leap
# Default NO on SLES 12
# Always NO on other distros
%if 0%{?suse_version} == 1315
%if 0%{?is_opensuse} == 1
%bcond_without libdmmp
%else # 0%{?is_opensuse} == 1
%bcond_with libdmmp
%endif # 0%{?is_opensuse} == 1
%else # 0%{?is_opensuse} == 1
%if 0%{?suse_version} >= 1330
%bcond_without libdmmp
%endif # 0%{?suse_version} >= 1330
%endif # 0%{?suse_version} == 1315
# This should match the version in libdmmp/Makefile
%define _libdmmp_version 0.1.0
%define libdmmp_version %(echo %{_libdmmp_version} | tr . _)
# path prefix for systemd unit files and udev rules
%define _sysdir usr/lib
Name: multipath-tools
Url: http://christophe.varoqui.free.fr/
Version: 0.7.1+53+suse.07c2f6ac
Release: 0
Summary: Tools to Manage Multipathed Devices with the device-mapper
License: GPL-2.0
Group: System/Base
Source: multipath-tools-%{version}.tar.xz
Source1: multipath.conf
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%{?systemd_requires}
BuildRequires: device-mapper-devel
BuildRequires: libaio-devel
%if 0%{?with_rados} == 1
BuildRequires: librados-devel
%endif
%if 0%{?with_libdmmp} == 1
BuildRequires: libjson-c-devel
%endif
BuildRequires: libudev-devel
BuildRequires: liburcu-devel
BuildRequires: readline-devel
BuildRequires: udev
BuildRequires: pkgconfig(libsystemd)
BuildRequires: pkgconfig(systemd)
Requires: device-mapper >= 1.2.78
Requires: kpartx
Requires: sg3_utils
PreReq: coreutils grep
%description
This package provides the tools to manage multipathed devices by
instructing the device-mapper multipath module what to do. The tools
are:
- multipath: scans the system for multipathed devices, assembles
them, and updates the device-mapper's maps
- multipathd: waits for maps events then execs multipath
- devmap-name: provides a meaningful device name to udev for devmaps
- kpartx: maps linear devmaps to device partitions, which makes
multipath maps partionable
%package -n kpartx
Summary: Manages partition tables on device-mapper devices
Group: System/Base
Requires: device-mapper
%description -n kpartx
The kpartx program maps linear devmaps to device partitions, which
makes multipath maps partionable.
%package devel
Summary: Development libraries for multipath-tools
Group: Development/Libraries/C and C++
Requires: device-mapper
%description devel
This package contains the development libraries for multipath-tools
and libmpath_persist.
%if 0%{?with_libdmmp} == 1
%package -n libdmmp%{libdmmp_version}
Summary: C API for multipath-tools
Group: System/Libraries
Requires: multipath-tools
%description -n libdmmp%{libdmmp_version}
This library enables the use of libmultipath commands from C code.
%package -n libdmmp-devel
Summary: Header files for multipath-tools C API
Group: Development/Libraries/C and C++
Requires: libdmmp%{libdmmp_version}
%description -n libdmmp-devel
This package provides development files and documentation for libdmmp.
%endif
%define makeflags %{!?with_rados:ENABLE_RADOS=0} %{!?with_libdmmp:ENABLE_LIBDMMP=0}
%define dirflags LIB=%{_lib} usr_prefix=%{_prefix} SYSTEMDPATH=%{_sysdir}
%prep
%setup -q -n multipath-tools-%{version}
%build
[ -n "$SOURCE_DATE_EPOCH" ] && export KBUILD_BUILD_TIMESTAMP=@$SOURCE_DATE_EPOCH
make CC="%__cc" OPTFLAGS="%{optflags}" %{dirflags} %{makeflags}
%install
make DESTDIR=%{buildroot} %{dirflags} %{makeflags} install
mkdir -p %{buildroot}/var/cache/multipath/
rm %{buildroot}/%_lib/*.so
%if 0%{?with_libdmmp} == 1
rm %{buildroot}/%_libdir/*.so
%endif
mkdir -p %{buildroot}/usr/sbin
ln -sf /usr/sbin/service %{buildroot}/usr/sbin/rcmultipathd
mkdir -p %{buildroot}/usr/lib/modules-load.d
install -m 644 -D %{SOURCE1} "%{buildroot}/usr/lib/modules-load.d/multipath.conf"
%pre
[ -f /.buildenv ] && exit 0
if [ -f /etc/init.d/multipathd ] && dmsetup --target multipath table | grep -q multipath ; then
/etc/init.d/multipathd stop
%service_add_pre multipathd.socket
%service_add_pre multipathd.service
fi
%post
[ -f /.buildenv ] && exit 0
%{run_ldconfig}
if dmsetup --target multipath table | grep -q multipath ; then
%service_add_post multipathd.socket
%service_add_post multipathd.service
fi
%{?regenerate_initrd_post}
exit 0
%preun
%service_del_preun multipathd.service
%service_del_preun multipathd.socket
%postun
%{?regenerate_initrd_post}
%service_del_postun multipathd.service
%service_del_postun multipathd.socket
%{run_ldconfig}
%posttrans
%{?regenerate_initrd_posttrans}
%files
%defattr(-,root,root)
%doc COPYING README
%{_udevrulesdir}/11-dm-mpath.rules
%{_udevrulesdir}/56-multipath.rules
%{_udevrulesdir}/67-kpartx-compat.rules
/%{_lib}/libmultipath.so.0
/%{_lib}/libmpathcmd.so.0
/%{_lib}/libmpathpersist.so.0
/%{_lib}/multipath
/sbin/multipath
/sbin/multipathd
/sbin/mpathpersist
/usr/sbin/rcmultipathd
%attr (0700, root, root) /var/cache/multipath
%dir /%{_sysdir}/systemd/system
/%{_sysdir}/systemd/system/multipathd.service
/%{_sysdir}/systemd/system/multipathd.socket
%dir /usr/lib/modules-load.d
/usr/lib/modules-load.d/multipath.conf
%{_mandir}/man8/multipath.8*
%{_mandir}/man5/multipath.conf.5*
%{_mandir}/man8/multipathd.8*
%{_mandir}/man8/mpathpersist.8*
%files devel
%defattr(-,root,root)
/usr/include/mpath_cmd.h
/usr/include/mpath_persist.h
%{_mandir}/man3/mpath_persistent_*
%files -n kpartx
%defattr(-,root,root)
/sbin/kpartx
%{_udevrulesdir}/66-kpartx.rules
/%{_sysdir}/udev/kpartx_id
%{_mandir}/man8/kpartx.8*
%if 0%{?with_libdmmp} == 1
%post -n libdmmp%{libdmmp_version}
%{run_ldconfig}
%postun -n libdmmp%{libdmmp_version}
%{run_ldconfig}
%files -n libdmmp%{libdmmp_version}
%defattr(-,root,root)
/%{_libdir}/libdmmp.so.%{_libdmmp_version}
%files -n libdmmp-devel
%defattr(-,root,root)
%{_mandir}/man3/libdmmp.h*
%{_mandir}/man3/dmmp_*
%{_includedir}/libdmmp
%{_libdir}/pkgconfig/libdmmp.pc
%endif # with_libdmmp
%changelog