File device-mapper.spec of Package device-mapper.17498
#
# spec file for package device-mapper
#
# Copyright (c) 2019 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 https://bugs.opensuse.org/
#
%define libname libdevmapper1_03
%define libname_event libdevmapper-event1_03
### COMMON-DEF-BEGIN ###
%define lvm2_version 2.02.180
%define device_mapper_version 1.02.149
%define thin_provisioning_version 0.7.0
### COMMON-DEF-END ###
Name: device-mapper
Version: %{device_mapper_version}
Release: 0
Summary: Device Mapper Tools
License: GPL-2.0-or-later AND LGPL-2.1-or-later
Group: System/Base
Url: http://www.sourceware.org/lvm2/
Source: ftp://sources.redhat.com/pub/lvm2/LVM2.%{lvm2_version}.tgz
Source1: ftp://sources.redhat.com/pub/lvm2/LVM2.%{lvm2_version}.tgz.asc
Source99: baselibs.conf
# To detect modprobe during build
BuildRequires: gcc-c++
BuildRequires: kmod-compat
BuildRequires: libaio-devel
BuildRequires: pkgconfig
BuildRequires: suse-module-tools
BuildRequires: thin-provisioning-tools >= %{thin_provisioning_version}
BuildRequires: pkgconfig(libselinux)
BuildRequires: pkgconfig(libsepol)
BuildRequires: pkgconfig(libudev)
BuildRequires: pkgconfig(systemd)
Requires: thin-provisioning-tools >= %{thin_provisioning_version}
Requires(post): coreutils
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%{?systemd_requires}
### COMMON-PATCH-BEGIN ###
# Upstream patches (order with creating time)
Patch0001: bug-1164718_01-vgcreate-close-exclusive-fd-after-pvcreate.patch
Patch0002: bug-1158358_bcache-reduce-MAX_IO-to-256.patch
Patch0003: bug-1145231_lvmetad-improve-scan-for-pvscan-all.patch
Patch0004: bug-1173503_lvmetad-fix-pvs-for-many-devices.patch
Patch0005: bug-1145231_scan-use-full-md-filter-when-md-1.0-devices-are-pres.patch
Patch0006: bug-1145231_scan-enable-full-md-filter-when-md-1.0-devices-are-p.patch
Patch0007: bug-1114113_metadata-prevent-writing-beyond-metadata-area.patch
Patch0008: bug-1164718_02-io-use-sync-io-if-aio-fails.patch
Patch0009: bug-1164718_03-bcache-sync-io-fixes.patch
Patch0010: bug-1164718_04-lvconvert-restrict-command-matching-for-no-option-va.patch
Patch0011: bug-1145231_scan-md-metadata-version-0.90-is-at-the-end-of-disk.patch
Patch0012: bug-1145231_pvscan-lvmetad-use-full-md-filter-when-md-1.0-device.patch
Patch0013: bug-1145231_pvscan-lvmetad-use-udev-info-to-improve-md-component.patch
Patch0014: bug-1164718_05-lvmetad-only-disable-if-repair-will-do-something.patch
Patch0015: bug-1164718_06-lvmetad-fix-disabling-in-previous-commit.patch
Patch0016: bug-1164718_07-filter-add-config-setting-to-skip-scanning-LVs.patch
Patch0017: bug-1164718_08-pvscan-lvmetad-init-should-set-updating-before-scann.patch
Patch0018: bug-1164718_09-config-change-scan_lvs-default-to-0.patch
Patch0019: bug-1145231_apply-obtain_device_list_from_udev-to-all-libudev-us.patch
Patch0021: bug-1164718_10-config-add-new-setting-io_memory_size.patch
Patch0022: bug-1164718_11-io-warn-when-metadata-size-approaches-io-memory-size.patch
Patch0023: bug-1164718_12-io-increase-the-default-io-memory-from-4-to-8-MiB.patch
Patch0024: bug-1164718_13-bcache-Fix-memory-leak.patch
Patch0025: bug-1155668_systemd-add-missing-Before-shutdown.target-to-LVM2.patch
Patch0026: bug-1172597_1-libdaemon-use-pselect-to-avoid-condition-checking-ra.patch
Patch0027: bug-1172597_2-cleanup-missed-string-specifier.patch
Patch0028: bug-1122666_devices-drop-open-error-message.patch
Patch0029: bug-1172597_3-libdaemon-ensure-threads-are-reaped-before-checking-.patch
Patch0030: bug-1135984_cache-support-no_discard_passdown.patch
Patch0031: bug-1164718_14-lvmcache-remove-unused_duplicate_devs-list-from-cmd.patch
Patch0032: bug-1164718_15-cov-release-iterator-on-error-path.patch
Patch0033: bug-1164718_16-cov-check-lv_info.patch
Patch0034: bug-1172597_4-cov-check-for-socket_path-being-set.patch
Patch0035: bug-1164718_17-cov-add-stack-tracing-for-error-paths.patch
Patch0036: bug-1164718_18-cov-validate-pagesize-is-not-negative.patch
Patch0037: bug-1164718_19-cov-remove-unused-headers.patch
Patch0038: bug-1137296_pvremove-vgextend-fix-using-device-aliases-with-lvmetad.patch
Patch0039: bug-1164718_20-cov-check-result-of-dev_get_block_size.patch
Patch0040: bug-1164718_21-gcc-clean-uninitialized-var-warning.patch
Patch0041: bug-1164718_22-cov-release-iterator-on-error-path.patch
Patch0042: bug-1164718_23-Fix-rounding-writes-up-to-sector-size.patch
Patch0043: bug-1164718_24-pvscan-avoid-redundant-activation.patch
Patch0044: bug-1164718_25-devs-check-for-no-dev-when-dropping-aliases.patch
Patch0045: bug-1164718_26-pvscan-fix-activation-of-incomplete-VGs.patch
Patch0046: bug-1175110_dmeventd-avoid-bail-out-preventing-repair-in-raid-pl.patch
Patch0047: bug-1164718_27-lvmetad-fix-sync-cache-to-lvmetad.patch
Patch0048: bug-1172597_5-lvmetad-fix-timeout-on-shutdown.patch
Patch0049: bug-1164718_28-lvmcache-free-resource-on-error-path.patch
Patch0050: bug-1149408_01-vgcreate-vgextend-restrict-PVs-with-mixed-block-size.patch
Patch0051: bug-1149408_02-tests-allow-mixed-block-sizes.patch
Patch0052: bug-1149408_03-tests-allow-mixed-block-sizes-skip-with-older-losetu.patch
Patch0053: bug-1149408_04-config-allow_mixed_block_sizes-set-default-to-1.patch
Patch0054: bug-1149408_05-config-allow_mixed_block_sizes-set-version-2.02.187.patch
Patch0055: bug-1172597_6-cov-missing-checks-of-syscalls.patch
Patch0056: bug-1172597_7-daemon-better-error-path-handling-for-shutdown.patch
Patch0057: bug-1172597_8-daemons-check-for-non-zero-thread_id.patch
Patch0058: bug-1150021_01-fix-dev_unset_last_byte-after-write-error.patch
Patch0059: bug-1150021_02-radix-tree-Bring-radix-tree-up-to-date-with-the-mast.patch
Patch0060: bug-1150021_03-cov-Fix-a-leak.patch
Patch0061: bug-1150021_04-bcache-Bring-bcache-into-sync-with-master-branch.patch
Patch0062: bug-1150021_05-bcache-add-bcache_abort.patch
Patch0063: bug-1150021_06-label-Use-bcache_abort_fd-to-ensure-blocks-are-no-lo.patch
Patch0064: bug-1150021_07-bcache-add-unit-test.patch
Patch0065: bug-1150021_08-bcache-pass-up-the-error-from-io_submit-rather-than.patch
Patch0066: bug-1150021_09-bcache-reverse-earlier-patch.patch
Patch0067: bug-1150021_10-bcache-bcache_invalidate_fd-only-remove-prefixes-on.patch
Patch0068: bug-1150021_11-radix-tree-Add-missing-test-case.patch
Patch0069: bug-1150021_12-base-Get-Makefile-from-master.patch
Patch0070: bug-1164126_lvmetad-fix-heap-memory-leak.patch
Patch0071: bug-1150021_13-Fix-rounding-writes-up-to-sector-size.patch
Patch0072: bug-1150021_14-bcache-Fix-memory-leak-in-error-path.patch
Patch0073: bug-1179326_pvmove-correcting-read_ahead-setting.patch
# SUSE patches: 1000+ for LVM
# Never upstream
Patch1001: cmirrord_remove_date_time_from_compilation.patch
Patch1002: fate-309425_display-dm-name-for-lv-name.patch
Patch1003: fate-31841_fsadm-add-support-for-btrfs.patch
Patch1004: bug-935623_dmeventd-fix-dso-name-wrong-compare.patch
Patch1005: bsc1080299-detect-clvm-properly.patch
Patch1006: bug-978055_clvmd-try-to-refresh-device-cache-on-the-first-failu.patch
Patch1007: bug-998893_make_pvscan_service_after_multipathd.patch
Patch1008: bug-1149408_06-suse-special-config-allow_mixed_block_sizes-set-version-2.02.180.patch
Patch1009: bug-1163526_suse-special-global-filter-compat.patch
Patch1010: bug-1123327-pvscan-service-use-StartLimitIntervalSec.patch
#SUSE patches 2000+ for device mapper, udev rules
Patch2001: bug-1012973_simplify-special-case-for-md-in-69-dm-lvm-metadata.patch
#######
# NOTE: for simplify patch job, speical patches for device mapper &
# clvmd/cmirrord are still stored in COMMON-PATCH sector, which not in
# device-mapper.spec & lvm2-clvm.spec
#######
### COMMON-PATCH-END ###
%description
Programs and man pages for configuring and using the device mapper.
%prep
%setup -q -n LVM2.%{lvm2_version}
### COMMON-PREP-BEGIN ###
%patch0001 -p1
%patch0002 -p1
%patch0003 -p1
%patch0004 -p1
%patch0005 -p1
%patch0006 -p1
%patch0007 -p1
%patch0008 -p1
%patch0009 -p1
%patch0010 -p1
%patch0011 -p1
%patch0012 -p1
%patch0013 -p1
%patch0014 -p1
%patch0015 -p1
%patch0016 -p1
%patch0017 -p1
%patch0018 -p1
%patch0019 -p1
%patch0021 -p1
%patch0022 -p1
%patch0023 -p1
%patch0024 -p1
%patch0025 -p1
%patch0026 -p1
%patch0027 -p1
%patch0028 -p1
%patch0029 -p1
%patch0030 -p1
%patch0031 -p1
%patch0032 -p1
%patch0033 -p1
%patch0034 -p1
%patch0035 -p1
%patch0036 -p1
%patch0037 -p1
%patch0038 -p1
%patch0039 -p1
%patch0040 -p1
%patch0041 -p1
%patch0042 -p1
%patch0043 -p1
%patch0044 -p1
%patch0045 -p1
%patch0046 -p1
%patch0047 -p1
%patch0048 -p1
%patch0049 -p1
%patch0050 -p1
%patch0051 -p1
%patch0052 -p1
%patch0053 -p1
%patch0054 -p1
%patch0055 -p1
%patch0056 -p1
%patch0057 -p1
%patch0058 -p1
%patch0059 -p1
%patch0060 -p1
%patch0061 -p1
%patch0062 -p1
%patch0063 -p1
%patch0064 -p1
%patch0065 -p1
%patch0066 -p1
%patch0067 -p1
%patch0068 -p1
%patch0069 -p1
%patch0070 -p1
%patch0071 -p1
%patch0072 -p1
%patch0073 -p1
%patch1001 -p1
%patch1002 -p1
%patch1003 -p1
%patch1004 -p1
%patch1005 -p1
%patch1006 -p1
%patch1007 -p1
%patch1008 -p1
%patch1009 -p1
%patch1010 -p1
%patch2001 -p1
### COMMON-PREP-END ###
%build
extra_opts=""
### COMMON-CONFIG-BEGIN ###
export PATH=$PATH:/sbin:%{_prefix}/sbin
# Why this messy fix here? someone released a wrong version...
sed -ie "s/%{device_mapper_version}/1.03.01/g" VERSION_DM
%configure \
--enable-dmeventd \
--enable-cmdlib \
--enable-udev_rules \
--enable-udev_sync \
--with-udev-prefix="%{_prefix}/" \
--enable-selinux \
--enable-pkgconfig \
--with-usrlibdir=%{_libdir} \
--with-usrsbindir=%{_sbindir} \
--with-default-dm-run-dir=/run \
--with-tmpfilesdir=%{_tmpfilesdir} \
--with-thin=internal \
--with-device-gid=6 \
--with-device-mode=0640 \
--with-device-uid=0 \
--with-dmeventd-path=%{_sbindir}/dmeventd \
--with-thin-check=%{_sbindir}/thin_check \
--with-thin-dump=%{_sbindir}/thin_dump \
--with-thin-repair=%{_sbindir}/thin_repair \
$extra_opts
### COMMON-CONFIG-END ###
%make_build device-mapper
%install
make DESTDIR=%{buildroot} \
install_device-mapper \
install_systemd_units install_systemd_generators
ln -s service %{buildroot}/%{_sbindir}/rcdm-event
# provide 1.02 compat links for the shared libraries
# this is needed for various binary packages
ln -s libdevmapper.so.1.03 %{buildroot}/%{_libdir}/libdevmapper.so.1.02
ln -s libdevmapper-event.so.1.03 %{buildroot}/%{_libdir}/libdevmapper-event.so.1.02
# remove blkd, will be in lvm2 proper
# without force on purpose to detect changes and fail if it happens
rm %{buildroot}%{_sbindir}/blkdeactivate
rm %{buildroot}%{_unitdir}/blk-availability.service
rm %{buildroot}%{_unitdir}/lvm2-monitor.service
rm %{buildroot}%{_mandir}/man8/blkdeactivate.8
rm %{buildroot}%{_mandir}/man8/lvm2-activation-generator.8
# compat symlinks in /sbin remove with Leap 43
mkdir -p %{buildroot}/sbin
ln -s %{_sbindir}/dmsetup %{buildroot}/sbin/dmsetup
%pre
%service_add_pre dm-event.service dm-event.socket
%post
%service_add_post dm-event.service dm-event.socket
%{?regenerate_initrd_post}
%posttrans
%{?regenerate_initrd_posttrans}
%preun
%service_del_preun dm-event.service dm-event.socket
%postun
%service_del_postun dm-event.service dm-event.socket
%{?regenerate_initrd_post}
%files
%defattr(-,root,root)
%license COPYING COPYING.LIB
%doc README
%doc udev/12-dm-permissions.rules
/sbin/dmsetup
%{_sbindir}/dmsetup
%{_sbindir}/dmeventd
%{_sbindir}/dmstats
%{_mandir}/man8/dmstats.8%{ext_man}
%{_mandir}/man8/dmsetup.8%{ext_man}
%{_mandir}/man8/dmeventd.8%{ext_man}
%{_udevrulesdir}/10-dm.rules
%{_udevrulesdir}/13-dm-disk.rules
%{_udevrulesdir}/95-dm-notify.rules
%{_unitdir}/dm-event.socket
%{_sbindir}/rcdm-event
%{_unitdir}/dm-event.service
%package -n %{libname}
Summary: Library for device-mapper
Group: System/Libraries
Conflicts: %{name} < %{version}
%description -n %{libname}
Device mapper main shared library
%files -n %{libname}
%defattr(-,root,root)
%{_libdir}/libdevmapper.so.1.03
%{_libdir}/libdevmapper.so.1.02
%post -n %{libname}
if [ -f /%{_lib}/libdevmapper.so.1.03 ]; then
# Special migration - the library is now in %{_libdir}, but up to the point where
# zypp removes the 'old' device-mapper package, the old library 'wins' the ldloader race
# resulting in binaries asking for the newer version still getting the old one.
# This in turn results in funny bugs like boo#1045396
# Remove /%{_lib}/libdevmapper.so.1.02 - and the run ldconfig
rm /%{_lib}/libdevmapper.so.1.03
fi
/sbin/ldconfig
%postun -n %{libname} -p /sbin/ldconfig
%package -n %{libname_event}
Summary: Event library for device-mapper
Group: System/Libraries
Conflicts: %{name} < %{version}
%description -n %{libname_event}
Device mapper event daemon shared library
%files -n %{libname_event}
%defattr(-,root,root)
%{_libdir}/libdevmapper-event.so.1.03
%{_libdir}/libdevmapper-event.so.1.02
%post -n %{libname_event} -p /sbin/ldconfig
%postun -n %{libname_event} -p /sbin/ldconfig
%package devel
Summary: Development package for the device mapper
Group: Development/Libraries/C and C++
Requires: %{libname_event} = %{device_mapper_version}
Requires: %{libname} = %{device_mapper_version}
Requires: device-mapper = %{device_mapper_version}
%description devel
Files needed for software development using the device mapper
%files devel
%defattr(-,root,root)
%{_libdir}/libdevmapper.so
%{_libdir}/libdevmapper-event.so
%{_includedir}/libdevmapper.h
%{_includedir}/libdevmapper-event.h
%{_libdir}/pkgconfig/devmapper.pc
%{_libdir}/pkgconfig/devmapper-event.pc
%changelog