File lvm2.spec of Package lvm2.631

#
# spec file for package lvm2
#
# Copyright (c) 2015 SUSE LINUX Products 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/
#


%define lvm2_version			2.02.98
%define device_mapper_version		1.02.78
%define thin_provisioning_version	0.2.4

%define dm_compat_version		1.02

Name:           lvm2
Requires:       device-mapper >= %{device_mapper_version}
Version:        %{lvm2_version}
Release:        0
Summary:        Logical Volume Manager Tools
License:        GPL-2.0 and LGPL-2.1
Group:          System/Base
Url:            http://www.sourceware.org/lvm2/

Source:         ftp://sources.redhat.com/pub/%{name}/LVM2.%{version}.tgz
Source42:       ftp://sources.redhat.com/pub/%{name}/LVM2.%{version}.tgz.asc
Source1:        lvm.conf
Source8:        clvmd.ocf
Source10:       cmirrord.ocf
Source14:       baselibs.conf
Source16:       csm-converter.tar.gz
Source50:       thin-provisioning-tools-v0.2.4.tar.gz

# Upstream patches first
Patch5:         0001-RAID-Make-RAID-4-5-6-display-sync-status-under-headi.patch
Patch10:        do_not_read_from_mirrors_have_failed_devices.diff
Patch15:        avoid_reading_failed_dev_in_mirrored_log.diff
Patch20:        lvmetad-Init-lazily-to-avoid-socket-access-on-config.patch
Patch25:        remove-fedora-systemd.patch
Patch30:        remove-quote-in-lvm2-monitor.patch
Patch35:        mirrored_log_fixed_when_double_fault_occurs.diff
Patch40:        device_is_usable_mem_leak.diff
Patch45:        0001-clvmd-avoid-logging-in-signal-handler.patch
Patch50:        clmvd-fix-decriptor-leak-on-restart.patch
Patch55:        make_raid1_default.diff
Patch60:        systemd-lvm2-activation-generator-report-only-error.patch
Patch65:        0001-toolcontext-Only-reopen-stdin-if-readable.patch
Patch70:        clvmd-Avoid-a-3-way-deadlock-in-dead-client-cleanup.patch
Patch75:        clvmd-Fix-node-up-down-handing-in-corosync-module.patch
Patch80:        man_page_sectors.diff
Patch85:        display-skipped-prompt-in-silent-mode.patch
Patch90:        systemd-use-umask-022-for-generated-systemd-units-by.patch
Patch95:        retry-cleanup-deactivation.patch
Patch100:       cmirrord-fix-s390-endian-issue.patch
Patch105:       segault_for_truncated_string_token.patch
Patch110:       udev_sync-cookie_set-1-on-each-dm_task_set_cookie-ca.patch
Patch115:       clvmd-fix-debugging-level-set-in-clvmd_set_debug-function.patch

# Upstream thin-provisioning-tools patches
Patch200:       s390-sectorsize4096.patch

# Local patches
Patch1001:      improve_probing.diff
Patch1002:      no-inc-audit.diff
Patch1003:      no_buildroot_shared.diff
Patch1004:      sys_mount_instead_linux_fs.diff
Patch1005:      pipe_buff-definition.diff
Patch1006:      support-drbd-filter.diff
Patch1007:      handle_extended_devt.diff
Patch1008:      display-dm-name-for-lv-name.diff
Patch1009:      device-mapper-type_punning.diff
Patch1010:      lvm-path.patch
Patch1011:      make-mirror-legs-on-different-tag-pvs.patch
Patch1012:      improve-mirror-legs-on-different-tag-pvs.patch
Patch1013:      suppress_locking_failer_message.patch

#fate#315092
Patch1014:      cmirrord_improvment_performance.patch

#fate#314367
Patch1015:      cluster_support_mirrord_log.diff
Patch1016:      lvconvert-cluster-mirrored-disk-failed.patch

Patch1017:      add_scm_support.patch

#forward-port from sle11
Patch1018:      suppress_format1_size_warning.diff
Patch1019:      pvmove_support_clustered_vg.diff

#suse, bnc873538
Patch1020:      fix-closedown-before-thread-finish.patch
#suse, bnc#870824
Patch1021:      use-mirrortype-asdefault-whenclvmdrunning.patch
# Never upstream
Patch1022:      cmirrord_remove_date_time_from_compilation.patch
Patch1024:      device-mapper-dmsetup-export.patch
Patch1025:      device-mapper-gcc-warnings.patch
Patch1026:      device-mapper-static.patch
Patch1027:      bug-479104_device-mapper-dmsetup-deps-export.patch
Patch1028:      device-mapper-link
Patch1029:      increase-minor-version.diff
Patch1030:      udev-rules_update.diff
Patch1031:      udev-Check-for-DM_NR_VALID_PATHS.patch
Patch1032:      Import-ID_FS_XXX-variables-bnc909358.patch
Patch1033:      dab3ebce-devices-Do-not-support-unpartitioned-DASD.patch
#bsc#932300
Patch1034:      10-dm.rules-Reset-state-variable-for-spurious-events.patch

BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  libaio-devel
BuildRequires:  libselinux-devel
BuildRequires:  readline-devel
BuildRequires:  suse-module-tools
BuildRequires:  systemd-rpm-macros
BuildRequires:  pkgconfig(udev)
Requires:       device-mapper >= %{device_mapper_version}
Provides:       lvm = %version-%release
# Not a real replacement but we drop evms
Provides:       evms = 2.5.5
Provides:       evms-devel = 2.5.5
Provides:       evms-gui = 2.5.5
Provides:       evms-ha = 2.5.5
Obsoletes:      evms <= 2.5.5
Obsoletes:      evms-devel <= 2.5.5
Obsoletes:      evms-gui <= 2.5.5
Obsoletes:      evms-ha <= 2.5.5
%define _udevdir %(pkg-config --variable=udevdir udev)

%{systemd_requires}

%description
Programs and man pages for configuring and using the LVM2 Logical
Volume Manager.



%prep
%setup -q -n LVM2.%{version} -a 50 -a 16

# Upstream patches
%patch5 -p1
%patch10 -p1
%patch15 -p1
%patch20 -p1
%patch25 -p1
%patch30 -p1
%patch35 -p1
%patch40 -p1
%patch45 -p1
%patch50 -p1
%patch55 -p1
%patch60 -p1
%patch65 -p1
%patch70 -p1
%patch75 -p1
%patch80 -p1
%patch85 -p1
%patch90 -p1
%patch95 -p1
%patch100 -p1
%patch105 -p1
%patch110 -p1
%patch115 -p1

# Thin provisioning patches
pushd thin-provisioning-tools-%{thin_provisioning_version}
%patch200 -p1
popd

# Local patches
%patch1001 -p1
%patch1002
%patch1003
%patch1004
%patch1005 -p1
%patch1006 -p1
%patch1007 -p1
%patch1008 -p1
%patch1009 -p1
%patch1010 -p1
%patch1011 -p1
%patch1012 -p1
%patch1013 -p1
%patch1014 -p1
%patch1015 -p1
%patch1016 -p1
%patch1017 -p1
%patch1018 -p1
%patch1019 -p1
%patch1020 -p1
%patch1021 -p1
%patch1022 -p1
%patch1024 -p1
%patch1025 -p1
%patch1026 -p1
%patch1027 -p1
%patch1028 -p1
%patch1029 -p1
%patch1030 -p1
%patch1031 -p1
%patch1032 -p1
%patch1033 -p1
%patch1034 -p1

%build
#set path so that thin_check can be found
#export before configure due to bnc#779965
export MODPROBE_CMD=/sbin/modprobe 
export CFLAGS="$RPM_OPT_FLAGS"
export PATH=$PATH:/sbin:/usr/sbin 
sed -ie "s/%{device_mapper_version}/1.03.01/g" VERSION_DM
autoreconf -fvi
%configure \
	--prefix=/ \
	--bindir=/bin \
	--libdir=/%_lib \
	--with-usrlibdir=%_libdir \
	--with-usrsbindir=%_sbindir \
	--sbindir=/sbin \
	--enable-dmeventd \
	--enable-udev_sync \
	--enable-udev_rules \
	--enable-cmdlib \
	--enable-applib \
	--enable-dmeventd \
	--enable-realtime \
	--enable-pkgconfig \
	--enable-selinux \
	--with-clvmd=corosync \
	--with-cluster=internal \
	--datarootdir="%_datadir" \
	--with-default-locking-dir=/run/lock/lvm \
	--enable-cmirrord \
	--enable-lvmetad \
	--with-default-pid-dir=/run \
	--with-default-dm-run-dir=/run \
	--with-default-run-dir=/run/lvm \
	--with-tmpfilesdir=%{_tmpfilesdir} \
	--with-thin=internal \
	--with-device-gid=6 \
	--with-device-mode=0640 \
	--with-device-uid=0 \
	--with-dmeventd-path=/sbin/dmeventd \
	--with-thin-check=%{_sbindir}/thin_check \
	--with-udev-prefix="%_prefix/"
export SUSE_ASNEEDED=0

make include

# Build the 1.02 libraries, this leaves the .so link that will be used
# to link the binaries
make -C libdm libdevmapper.so.%{dm_compat_version} \
	LIB_VERSION_DM=%{dm_compat_version}
make -C daemons/dmeventd libdevmapper-event.so.%{dm_compat_version} \
	LIB_VERSION_DM=%{dm_compat_version}

make %{?_smp_mflags} LIB_VERSION_DM=%{dm_compat_version}

#csm convert
pushd bnz
make %{?_smp_mflags}
popd

pushd thin-provisioning-tools-%{thin_provisioning_version}
autoreconf -fiv
%configure --sbindir=/sbin --prefix="%_prefix"
make %{?_smp_mflags}
popd

# Build the 1.03 libraries
rm -f libdm/libdevmapper.so daemons/dmeventd/libdevmapper-event.so
make -C libdm libdevmapper.so
make -C daemons/dmeventd libdevmapper-event.so

%install
%make_install
make install_system_dirs DESTDIR="%buildroot"
make install_systemd_units DESTDIR="%buildroot"
make install_systemd_generators DESTDIR="%buildroot"
make install_tmpfiles_configuration DESTDIR="%buildroot"
# Is this directory used anymore?
install -d -m 755 "%buildroot/%_sysconfdir/lvm/metadata"
install -m 644 %{SOURCE1} "%buildroot/%_sysconfdir/lvm/"
mkdir -p "%buildroot/%_initddir"
mkdir -p "%buildroot/%_sbindir"
install -m755 -D %{S:8} "%buildroot/%_prefix/lib/ocf/resource.d/lvm2/clvmd"
install -m755 -D %{S:10} "%buildroot/%_prefix/lib/ocf/resource.d/lvm2/cmirrord"

pushd "%buildroot/%_lib"
ln -sf liblvm2cmd.so.2.02 liblvm2cmd.so
ln -sf liblvm2app.so.2.2 liblvm2app.so
ln -sf libdevmapper-event-lvm2.so.2.02 "%buildroot/%_lib/libdevmapper-event-lvm2.so"
for i in libdevmapper-event-lvm2{mirror,raid,snapshot,thin}; do
       ln -sf "device-mapper/$i.so" "$i.so"
       ln -sf "device-mapper/$i.so" "$i.so.2.02"
done
popd

rm -f %buildroot/%_libdir/liblvm2{app,cmd}.so
rm -f %buildroot/%_libdir/libdevmapper-event-lvm2.so

# Install and link the multiversion libs explicitly so we don't
# depend on makefile magic to get it right
for lib in libdm/ioctl/libdevmapper.so \
          daemons/dmeventd/libdevmapper-event.so; do
   install -m755 -D $lib.1.02 %buildroot/%_lib/$(basename $lib).1.02
   install -m755 -D $lib.1.03 %buildroot/%_lib/$(basename $lib).1.03
   ln -sf /%_lib/$(basename $lib).1.03 %buildroot/%_libdir/$(basename $lib)
done

ln -sf liblvm2cmd.so.2.02 liblvm2cmd.so
ln -sf liblvm2app.so.2.2 liblvm2app.so 

pushd daemons/clvmd
make install DESTDIR=%buildroot
popd

pushd daemons/cmirrord
make install DESTDIR=%buildroot
popd

#csm-convert
pushd bnz
install -m755 -D csm-converter "%buildroot/%_sbindir/csm-converter"
install -m755 -D csm-converter-helper "%buildroot/%_sbindir/csm-converter-helper"
mv README.csm-converter ..
popd

pushd thin-provisioning-tools-%{thin_provisioning_version}
%makeinstall MANDIR=%{_mandir}
popd

%pre
%service_add_pre blk-availability.service lvm2-monitor.service lvm2-lvmetad.socket

%post
/sbin/ldconfig
%{?regenerate_initrd_post}
%service_add_post blk-availability.service lvm2-monitor.service lvm2-lvmetad.socket

%posttrans
%{?regenerate_initrd_posttrans}

%preun
%service_del_preun blk-availability.service lvm2-monitor.service

%postun
/sbin/ldconfig
%service_del_postun blk-availability.service lvm2-monitor.service

%files
%defattr(-,root,root)
%doc README WHATS_NEW doc/*
%dir %{_sysconfdir}/lvm
%dir %{_sysconfdir}/lvm/backup
%dir %{_sysconfdir}/lvm/archive
%dir %{_sysconfdir}/lvm/metadata
%dir %{_sysconfdir}/lvm/cache
%ghost %{_sysconfdir}/lvm/cache/.cache
%{_udevdir}/rules.d/11-dm-lvm.rules
%{_udevdir}/rules.d/69-dm-lvm-metad.rules
%{_unitdir}/blk-availability.service
%{_unitdir}/lvm2-monitor.service
%{_unitdir}/lvm2-lvmetad.socket
%{_unitdir}/lvm2-lvmetad.service
%dir %{_tmpfilesdir}
%{_tmpfilesdir}/lvm2.conf
%config(noreplace) %{_sysconfdir}/lvm/lvm.conf
%dir /usr/lib/systemd/system-generators
/usr/lib/systemd/system-generators/lvm2-activation-generator
/sbin/blkdeactivate
/sbin/fsadm
/sbin/lv*
/sbin/pv*
/sbin/vg*
%dir /%_lib/device-mapper
/%_lib/device-mapper/libdevmapper-event-lvm2*.so
/%_lib/libdevmapper-event-lvm2*.so
/%_lib/liblvm2cmd.so
/%_lib/liblvm2cmd.so.2.02
/%_lib/liblvm2app.so
/%_lib/liblvm2app.so.2.2
/%_lib/libdevmapper-event-lvm2*.so.2.02
%_mandir/man5/lvm.conf.5.gz
%_mandir/man8/blkdeactivate.8.gz
%_mandir/man8/fsadm.8.gz
%_mandir/man8/lv*.8*
%_mandir/man8/pv*.8*
%_mandir/man8/vg*.8*

%package clvm
Url:            http://sources.redhat.com/cluster/clvm/
Version:        %{lvm2_version}
Release:        0
BuildRequires:  libcorosync-devel
BuildRequires:  libdlm-devel
Requires:       corosync
Requires:       device-mapper >= 1.02.25
Requires:       lvm2 = %{version}
Requires:       lvm2-cmirrord
Summary:        Clustered LVM2
Group:          Productivity/Clustering/HA

%description clvm
A daemon for using LVM2 Logival Volumes in a clustered environment.



%files clvm
%defattr(-,root,root)
%{_sbindir}/clvmd
%dir /usr/lib/ocf
%dir /usr/lib/ocf/resource.d
%dir /usr/lib/ocf/resource.d/lvm2
/usr/lib/ocf/resource.d/lvm2/clvmd
%{_mandir}/man8/clvmd.8.gz
%doc README.csm-converter
%{_sbindir}/csm-converter
%{_sbindir}/csm-converter-helper

%package cmirrord
Url:            http://www.sourceware.org/lvm2/
Version:        %{lvm2_version}
Release:        0
Requires:       corosync
Requires:       device-mapper >= 1.02.25
Requires:       lvm2 = %{version}
Requires:       lvm2-clvm
Obsoletes:      cmirrord < %{version}
Provides:       cmirrord = %{version}
Summary:        Clustered RAID 1 support using device-mapper and corosync
Group:          Productivity/Clustering/HA

%description cmirrord
A daemon for using LVM2 Logival Volumes in a clustered environment.


%files cmirrord
%defattr(-,root,root)
%{_sbindir}/cmirrord
/usr/lib/ocf/resource.d/lvm2/cmirrord
%{_mandir}/man8/cmirrord.8.gz

%package devel
Version:        %{lvm2_version}
Release:        0
Requires:       lvm2 = %{version}
Summary:        Development files for LVM2
Group:          Development/Libraries/C and C++

%description devel
This package provides development files for the LVM2 Logical Volume Manager.


%files devel
%defattr(-,root,root)
%_includedir/lvm2cmd.h
%_includedir/lvm2app.h
%_libdir/pkgconfig/lvm2app.pc

##########################################
# Subpackage: device-mapper
##########################################
%package -n device-mapper

%ifarch ppc64
Obsoletes:      device-mapper-64bit
%endif
Version:        %{device_mapper_version}
Release:        0
Summary:        Device Mapper Tools
Group:          System/Base
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  boost-devel
BuildRequires:  gcc-c++
BuildRequires:  libexpat-devel
BuildRequires:  libselinux-devel
BuildRequires:  libsepol-devel
BuildRequires:  libstdc++-devel
BuildRequires:  suse-module-tools
BuildRequires:  systemd-rpm-macros
BuildRequires:  pkgconfig(libudev)
Requires:       expat
PreReq:         %insserv_prereq %fillup_prereq

%description -n device-mapper
Programs, libraries, and man pages for configuring and using the device
mapper.

%post -n device-mapper
%service_add_post dm-event.service dm-event.socket
/sbin/ldconfig
%{?regenerate_initrd_post}

%posttrans -n device-mapper
%{?regenerate_initrd_posttrans}

%pre -n device-mapper
%service_add_pre dm-event.service dm-event.socket

%preun -n device-mapper
%service_del_preun dm-event.service dm-event.socket

%postun -n device-mapper
%service_del_postun dm-event.service dm-event.socket
/sbin/ldconfig

%files -n device-mapper
%defattr(-,root,root)
%doc INSTALL COPYING COPYING.LIB README
%doc udev/12-dm-permissions.rules
/%_lib/libdevmapper.so.1.03
/%_lib/libdevmapper-event.so.1.03
/%_lib/libdevmapper.so.1.02
/%_lib/libdevmapper-event.so.1.02
/sbin/dmsetup
/sbin/dmeventd
%_sbindir/thin_*
%_mandir/man8/dmsetup.8.gz
%_mandir/man8/dmeventd.8.gz
%_mandir/man8/thin_*.8*
%_udevrulesdir/10-dm.rules
%_udevrulesdir/13-dm-disk.rules
%_udevrulesdir/95-dm-notify.rules
%_unitdir/dm-event.socket
%_unitdir/dm-event.service

%package -n device-mapper-devel
Summary:        Development package for the device mapper
Group:          System/Base
Version:        %{device_mapper_version}
Release:        0
Requires:       device-mapper = %{device_mapper_version}

%description -n device-mapper-devel
Files needed for software

%files -n device-mapper-devel
%defattr(-,root,root)
%_libdir/libdevmapper.so
%_libdir/libdevmapper-event.so
%_libdir/libdevmapper.a
%_includedir/libdevmapper*.h
%_libdir/pkgconfig/devmapper*.pc

%changelog
openSUSE Build Service is sponsored by