File lvm2.spec of Package lvm2.3105

#
# spec file for package lvm2
#
# Copyright (c) 2016 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.120
%define device_mapper_version     1.02.97
%define thin_provisioning_version 0.5.3
%define enable_testsuite 0

Name:           lvm2
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-v%{thin_provisioning_version}.tar.gz

# Upstream patches first
Patch1:         lvmetad.c-ignore-lvmetad-global-handle-on-disconnect.patch 
Patch2:         alloc-Fix-lvextend-failure-when-varying-stripes.patch
Patch3:         lvmcache-Remove-verbose-msg-when-rescanning-dev.patch
Patch4:         pvcreate-remove-recent-warning-message.patch
Patch5:         pvchange-pvresize-move-exported-VG-check.patch
Patch7:         pvscan-restore-polling-in-autoactivation-handler.patch
Patch8:         udev-use-for-SYSTEMD_WANTS-instead-of.patch
# SUSE patches 1000- for LVM, 2000- for device mapper
Patch1001:      improve_probing.diff
Patch1002:      no-inc-audit.diff
Patch1003:      no_buildroot_shared.diff
Patch1004:      sys_mount_instead_linux_fs.diff
Patch1005:      display-dm-name-for-lv-name.diff
Patch1006:      device-mapper-type_punning.diff
Patch1007:      make-mirror-legs-on-different-tag-pvs.patch
Patch1008:      improve-mirror-legs-on-different-tag-pvs.patch
Patch1009:      cmirrord_improvment_performance.patch
Patch1010:      cluster_support_mirrord_log.diff
Patch1011:      lvconvert-cluster-mirrored-disk-failed.patch
Patch1012:      suppress_format1_size_warning.diff
Patch1013:      pvmove_support_clustered_vg.diff
Patch1014:      cmirrord_remove_date_time_from_compilation.patch
Patch1015:      fix-closedown-before-thread-finish.patch
Patch1016:      use-mirrortype-asdefault-whenclvmdrunning.patch
Patch1017:      version-plugins-in-libdir
Patch1018:      fsadm-add-support-for-btrfs.patch
Patch1019:      manpage-lvscan-fix.patch
Patch1020:      dmeventd-fix-dso-name-wrong-compare.patch
Patch1021:      remove-unrecognized-RemoveOnStop-from-lvm2-lvmetad-socket.patch
Patch1022:      fix-build-error-caused-by-commit-b93b8537.patch
%if %{enable_testsuite}
Patch1023:      lvm2-testsuite.patch
%endif
Patch1024:      pvcreate-don-t-support-unpartitioned-DASD-devices-with-CDL-formatted.patch
Patch1025:      libdm-iface-not-output-error-message-inside-retry-loop.patch
Patch1026:      lvm2-lvmetad.service-add-Also-lvm2-lvmetad.socket.patch
Patch1027:      pvcreate-enhance-the-error-message.patch

# device-mapper patches
#suse, bnc#707253(also merged patch for bnc#479104)
Patch2000:      device-mapper-dmsetup-export.patch
Patch2001:      device-mapper-gcc-warnings.patch
Patch2002:      device-mapper-static.patch
Patch2003:      device-mapper-link
Patch2004:      udev_rules-update.diff
Patch2005:      udev-Check-for-DM_NR_VALID_PATHS.patch
Patch2006:      Import-ID_FS_XXX-variables-bnc909358.patch
Patch2007:      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
Requires(pre):  systemd-presets-branding
Requires(post): systemd-presets-branding
BuildRequires:  suse-module-tools
BuildRequires:  systemd-rpm-macros
BuildRequires:  pkgconfig(systemd)
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)

%if %{defined systemd_requires}
%{systemd_requires}
%endif

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


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

%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch7 -p1
%patch8 -p1
%patch1001 -p1
%patch1002 -p1
%patch1003 -p1
%patch1004 -p1
%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
%if %{enable_testsuite}
%patch1023 -p1
%endif
%patch1024 -p1
%patch1025 -p1
%patch1026 -p1
%patch1027 -p1

%patch2000 -p1
%patch2001 -p1
%patch2002 -p1
%patch2003 -p1
%patch2004 -p1
%patch2005 -p1
%patch2006 -p1
%patch2007 -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=/ \
	--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-thin-dump=%{_sbindir}/thin_dump \
	--with-thin-repair=%{_sbindir}/thin_repair \
	--with-udev-prefix="%_prefix/"

export SUSE_ASNEEDED=0

make %{?_smp_mflags}

#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

%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"
%if %{enable_testsuite}
make -C test install DESTDIR="%buildroot"
%endif
# 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"

# Make sure libdevmapper.so.1.02 libdevmapper-event.so.1.02 still available
# on Tumbleweed, as virtualbox.org didn't update their RPMs yet.
rm -f libdm/ioctl/libdevmapper.so daemons/dmeventd/libdevmapper-event.so
sed -i "s/1.03.01/%{device_mapper_version}/" VERSION_DM
make device-mapper
make install_device-mapper DESTDIR=%{buildroot}

pushd "%buildroot/%_lib"
ln -sf liblvm2cmd.so.2.02 liblvm2cmd.so
ln -sf liblvm2app.so.2.2 liblvm2app.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

pushd "%buildroot/%_sbindir"
ln -sf ../../sbin/lvm lvm
ln -sf ../../sbin/lvmconf lvmconf
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}
%make_install
popd

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

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

%posttrans
%{?regenerate_initrd_posttrans}

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

%postun
/sbin/ldconfig
%service_del_postun blk-availability.service lvm2-monitor.service lvm2-lvmetad.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/profile
%dir %{_sysconfdir}/lvm/cache
%dir /usr/lib/systemd/system-generators
%dir /usr/lib/tmpfiles.d
%ghost %{_sysconfdir}/lvm/cache/.cache
%{_sysconfdir}/lvm/profile/*.profile
%{_sysconfdir}/lvm/lvmlocal.conf
%{_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
%{_unitdir}/lvm2-pvscan@.service
%{_tmpfilesdir}/lvm2.conf
%config(noreplace) %{_sysconfdir}/lvm/lvm.conf
/usr/lib/systemd/system-generators/lvm2-activation-generator
/sbin/blkdeactivate
/sbin/fsadm
/sbin/lv*
/sbin/pv*
/sbin/vg*
%_sbindir/lvm
%_sbindir/lvmconf
%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
/%_libdir/liblvm2app.so
/%_libdir/liblvm2cmd.so
/%_lib/libdevmapper-event-lvm2*.so.2.02
/%_libdir/libdevmapper-event-lvm2.so
%_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*
%_mandir/man7/lvm*.7*

%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 >= %{device_mapper_version}
Requires:       lvm2 = %{version}
Requires:       lvm2-cmirrord
Obsoletes:      cmirrord < %{version}
Provides:       cmirrord = %{version}
Summary:        Clustered LVM2
License:        GPL-2.0+ and LGPL-2.1+
Group:          Productivity/Clustering/HA

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

%pre clvm
%service_add_pre lvm2-cluster-activation.service lvm2-clvmd.service

%post clvm
%service_add_post lvm2-cluster-activation.service lvm2-clvmd.service

%preun clvm
%service_del_preun lvm2-cluster-activation.service lvm2-clvmd.service

%postun clvm
%service_del_postun lvm2-cluster-activation.service lvm2-clvmd.service

%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
%{_unitdir}/lvm2-clvmd.service
%{_unitdir}/lvm2-cluster-activation.service
/usr/lib/systemd/lvm2-cluster-activation

%package cmirrord
Url:            http://www.sourceware.org/lvm2/
Version:        %{lvm2_version}
Release:        0
Requires:       corosync
Requires:       device-mapper >= %{device_mapper_version}
Requires:       lvm2 = %{version}
Requires:       lvm2-clvm
Summary:        Clustered RAID 1 support using device-mapper and corosync
License:        GPL-2.0+ and LGPL-2.1+
Group:          Productivity/Clustering/HA

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

%pre cmirrord
%service_add_pre lvm2-cmirrord.service lvm2-cluster-activation.service

%post cmirrord
%service_add_post lvm2-cmirrord.service lvm2-cluster-activation.service

%preun cmirrord
%service_del_preun lvm2-cmirrord.service lvm2-cluster-activation.service

%postun cmirrord
%service_del_postun lvm2-cmirrord.service lvm2-cluster-activation.service

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

%package devel
Version:        %{lvm2_version}
Release:        0
Requires:       lvm2 = %{version}
Summary:        Development files for LVM2
License:        GPL-2.0+ and LGPL-2.1+
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
License:        GPL-2.0+ and LGPL-2.1+
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
%_sbindir/cache_*
%_sbindir/era_*
%_sbindir/pdata_tools
%_mandir/man8/cache_*.8*
%_mandir/man8/era_*.8*

%package -n device-mapper-devel
Summary:        Development package for the device mapper
License:        GPL-2.0+ and LGPL-2.1+
Group:          Development/Libraries/C and C++
Version:        %{device_mapper_version}
Release:        0
Requires:       device-mapper = %{device_mapper_version}

%description -n device-mapper-devel
Files needed for software development using the device mapper

%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

%if %{enable_testsuite}
%package testsuite
Summary:        LVM2 Testsuite
License:        LGPL-2.0+
Group:          Development

%description testsuite
An extensive functional testsuite for LVM2.

%files testsuite
%defattr(-,root,root,-)
#%{_libdir}/lvm2-testsuite/
%{_datarootdir}/lvm2-testsuite/
%{_libexecdir}/lvm2-testsuite/
%{_bindir}/lvm2-testsuite
%endif

%changelog
openSUSE Build Service is sponsored by