File btrfsprogs.spec of Package btrfsprogs.3563

#
# spec file for package btrfsprogs
#
# Copyright (c) 2016 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/
#


%define udev_with_btrfs_builtin 190
%define udev_version %(rpm -q --queryformat %{VERSION} udev)
%define package_udev_rules %{udev_version} >= %{udev_with_btrfs_builtin}

%define _dracutmodulesdir %{_libexecdir}/dracut/modules.d

Name:           btrfsprogs
Version:        4.5.3
Release:        0
Summary:        Utilities for the Btrfs filesystem
License:        GPL-2.0
Group:          System/Filesystems
Url:            http://btrfs.wiki.kernel.org/index.php/Main_Page
#Git-Web:	http://git.kernel.org/cgit/linux/kernel/git/kdave/btrfs-progs.git
#Git-Clone:	git://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs
Source0:        https://www.kernel.org/pub/linux/kernel/people/kdave/btrfs-progs/btrfs-progs-v%{version}.tar.gz
Source1:        module-setup.sh
Source2:        dracut-fsck-help.txt

Patch103:       0103-btrfs-progs-free-qgroup-counts-in-btrfsck.patch
Patch104:       0104-btrfs-progs-btrfsck-verify-qgroups-above-level-0.patch
Patch105:       0105-btrfs-progs-btrfsck-write-corrected-qgroup-info-to-d.patch

Patch169:       0169-btrfs-progs-udev-add-rules-for-dm-devices.patch
Patch170:       0170-btrfs-progs-check-release-path-after-usage.patch
Patch1000:      local-version-override.patch

Patch2010:      2010-btrfs-convert-add-support-to-convert-reiserfs.patch

Patch2100:      2100-btrfs-progs-fsck-fix-segfault.patch
Patch2102:      2102-Btrfs-progs-make-find_and_setup_root-return-an-error.patch
Patch2103:      2103-Btrfs-progs-don-t-bug-out-if-we-can-t-find-the-last-.patch

BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  asciidoc
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  dracut
BuildRequires:  libattr-devel
BuildRequires:  libblkid-devel
BuildRequires:  libext2fs-devel
BuildRequires:  libreiserfscore-devel
BuildRequires:  libuuid-devel
BuildRequires:  lzo-devel
BuildRequires:  pkg-config
BuildRequires:  udev
%if 0%{?suse_version} == 1310
BuildRequires:  libudev-devel
%endif
BuildRequires:  xmlto
BuildRequires:  zlib-devel
Supplements:    filesystem(btrfs)
Recommends:     btrfsmaintenance
%if %{package_udev_rules}
Requires:       btrfsprogs-udev-rules
%endif

%description
Utilities needed to create and maintain btrfs file systems under Linux.

%package -n libbtrfs0
Summary:        Library for interacting with Btrfs
Group:          System/Libraries

%description -n libbtrfs0
This package contains the libbtrfs.so shared library needed for some
applications to interface with btrfs.

%package -n libbtrfs-devel
Summary:        Include Files and Libraries for developing with Btrfs
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}-%{release}
Requires:       libbtrfs0 = %{version}

%description -n libbtrfs-devel
This package contains the libraries and headers files for developers to
build applications to interface with btrfs.

# rpm < 4.6.0 (SLE11 uses 4.4) doesn't support noarch subpackages.
# Fortunately, it doesn't use systemd either so we can just skip it.
%if %{package_udev_rules}
%package udev-rules
Summary:        Udev rules for configuring btrfs file systems
Group:          System/Kernel
Conflicts:      udev < %{udev_with_btrfs_builtin}
BuildArch:      noarch

%description udev-rules
This package contains the udev rule file for configuring device mapper
devices that are components of btrfs file systems.  It is meant to be
used with versions of udev that contain the "built-in" btrfs command
(v190 and newer).  Older versions of udev will call the version of
"btrfs ready" contained in the btrfsprogs package, which does the right
thing.
%endif

%prep
%setup -q -n btrfs-progs-v%{version}
%patch103 -p1
%patch104 -p1
%patch105 -p1

%patch169 -p1
%patch170 -p1
%patch2010 -p1
%patch2100 -p1
%patch2102 -p1
%patch2103 -p1
%patch1000 -p1

%build
./autogen.sh
%configure
make V=1 %{?_smp_mflags} all

%install
make install DESTDIR=${RPM_BUILD_ROOT} prefix=%{_prefix} bindir=%{_sbindir} mandir=%{_mandir} libdir=%{_libdir}
install -m 0755 -d ${RPM_BUILD_ROOT}/%{_sbindir}
install -m 0755 -d ${RPM_BUILD_ROOT}/%{_bindir}
# move some utilities out of /usr/sbin
mv ${RPM_BUILD_ROOT}/%{_sbindir}/btrfs-map-logical ${RPM_BUILD_ROOT}/%{_bindir}
# initrd rescue utilities
install -m 0755 btrfs-zero-log ${RPM_BUILD_ROOT}/%{_sbindir}
install -m 0755 btrfs-select-super ${RPM_BUILD_ROOT}/%{_sbindir}
install -m 0755 btrfs-image ${RPM_BUILD_ROOT}/%{_sbindir}
install -m 0755 btrfstune ${RPM_BUILD_ROOT}/%{_sbindir}
install -m 0755 btrfs-find-root ${RPM_BUILD_ROOT}/%{_sbindir}
#UsrMerge
install -m 0755 -d ${RPM_BUILD_ROOT}/sbin
ln -s %{_sbindir}/btrfs ${RPM_BUILD_ROOT}/sbin
ln -s %{_sbindir}/btrfs-zero-log ${RPM_BUILD_ROOT}/sbin
ln -s %{_sbindir}/btrfs-convert ${RPM_BUILD_ROOT}/sbin
ln -s %{_sbindir}/btrfs-select-super ${RPM_BUILD_ROOT}/sbin
ln -s %{_sbindir}/btrfs-image ${RPM_BUILD_ROOT}/sbin
ln -s %{_sbindir}/btrfstune ${RPM_BUILD_ROOT}/sbin
ln -s %{_sbindir}/btrfsck ${RPM_BUILD_ROOT}/sbin
ln -s %{_sbindir}/btrfs-find-root ${RPM_BUILD_ROOT}/sbin
ln -s %{_sbindir}/btrfs-debug-tree ${RPM_BUILD_ROOT}/sbin
ln -s %{_sbindir}/btrfs-show-super ${RPM_BUILD_ROOT}/sbin
ln -s %{_sbindir}/mkfs.btrfs ${RPM_BUILD_ROOT}/sbin
#EndUsrMerge
# command line options are not compatible (bnc#599224)
chmod +x ${RPM_BUILD_ROOT}/%{_sbindir}/fsck.btrfs
#UsrMerge
ln -s %{_sbindir}/fsck.btrfs ${RPM_BUILD_ROOT}/sbin
#EndUsrMerge
rm -f ${RPM_BUILD_ROOT}/%{_libdir}/*.la
# don't install .a for now
rm -f ${RPM_BUILD_ROOT}/%{_libdir}/*.a
# bash completion
install -m 0755 -d %{buildroot}/%{_datadir}/bash-completion/completions
install -m 0644 btrfs-completion %{buildroot}/%{_datadir}/bash-completion/completions/btrfs
install -m 0755 -D ${RPM_SOURCE_DIR}/module-setup.sh %{buildroot}/%{_dracutmodulesdir}/95suse-btrfs/module-setup.sh

%if 0%{!?for_debugging:1}
DEBUG_FILES="/sbin/btrfs-find-root
  %{_sbindir}/btrfs-find-root
  %_mandir/man8/btrfs-find-root.8.gz
  %_mandir/man8/btrfs-select-super.8.gz
  /sbin/btrfs-select-super
  %{_sbindir}/btrfs-select-super"
for file in $DEBUG_FILES; do
  rm -f ${RPM_BUILD_ROOT}$file
done
%endif

%post -n libbtrfs0 -p /sbin/ldconfig

%postun -n libbtrfs0 -p /sbin/ldconfig

%if 0%{?suse_version} >= 1310
%posttrans
%{?regenerate_initrd_posttrans}
%endif

%files
%defattr(-, root, root)
%doc COPYING
%doc ${RPM_SOURCE_DIR}/dracut-fsck-help.txt
/sbin/fsck.btrfs
# initrd utils
#UsrMerge
/sbin/btrfs
/sbin/btrfs-zero-log
/sbin/btrfs-convert
/sbin/btrfs-image
/sbin/btrfstune
/sbin/btrfsck
/sbin/mkfs.btrfs
/sbin/btrfs-debug-tree
/sbin/btrfs-show-super
#EndUsrMerge
%{_sbindir}/btrfs
%{_sbindir}/btrfs-zero-log
%{_sbindir}/btrfs-convert
%{_sbindir}/btrfs-image
%{_sbindir}/btrfstune
%{_sbindir}/btrfsck
%{_sbindir}/fsck.btrfs
%{_sbindir}/mkfs.btrfs
%{_sbindir}/btrfs-debug-tree
%{_sbindir}/btrfs-show-super
%{_bindir}/btrfs-map-logical
%{_mandir}/man8/btrfs-image.8.gz
%{_mandir}/man8/btrfsck.8.gz
%{_mandir}/man8/fsck.btrfs.8.gz
%{_mandir}/man8/mkfs.btrfs.8.gz
%{_mandir}/man8/btrfs.8.gz
%{_mandir}/man5/btrfs.5.gz
%{_mandir}/man8/btrfs-convert.8.gz
%{_mandir}/man8/btrfs-debug-tree.8.gz
%{_mandir}/man8/btrfs-map-logical.8.gz
%{_mandir}/man8/btrfs-show-super.8.gz
%{_mandir}/man8/btrfs-zero-log.8.gz
%{_mandir}/man8/btrfstune.8.gz
%{_mandir}/man8/btrfs-balance.8.gz
%{_mandir}/man8/btrfs-check.8.gz
%{_mandir}/man8/btrfs-device.8.gz
%{_mandir}/man8/btrfs-filesystem.8.gz
%{_mandir}/man8/btrfs-inspect-internal.8.gz
%{_mandir}/man8/btrfs-property.8.gz
%{_mandir}/man8/btrfs-qgroup.8.gz
%{_mandir}/man8/btrfs-quota.8.gz
%{_mandir}/man8/btrfs-receive.8.gz
%{_mandir}/man8/btrfs-replace.8.gz
%{_mandir}/man8/btrfs-rescue.8.gz
%{_mandir}/man8/btrfs-restore.8.gz
%{_mandir}/man8/btrfs-scrub.8.gz
%{_mandir}/man8/btrfs-send.8.gz
%{_mandir}/man8/btrfs-subvolume.8.gz
%dir %{_datadir}/bash-completion
%dir %{_datadir}/bash-completion/completions
%{_datadir}/bash-completion/completions/btrfs
%{_dracutmodulesdir}/95suse-btrfs/
%{_dracutmodulesdir}/95suse-btrfs/module-setup.sh

%if 0%{?for_debugging:1}
/sbin/btrfs-find-root
%{_sbindir}/btrfs-find-root
%{_mandir}/man8/btrfs-find-root.8.gz
/sbin/btrfs-select-super
%{_sbindir}/btrfs-select-super
%{_mandir}/man8/btrfs-select-super.8.gz
%endif

%files -n libbtrfs0
%defattr(-, root, root)
%{_libdir}/libbtrfs.so.*

%files -n libbtrfs-devel
%defattr(-, root, root)
%dir %{_includedir}/btrfs
%{_includedir}/btrfs/*
%{_libdir}/libbtrfs.so

%if %{package_udev_rules}
%files udev-rules
%defattr(-, root, root)
%dir %{_udevrulesdir}
%{_udevrulesdir}/64-btrfs-dm.rules
%endif

%changelog
openSUSE Build Service is sponsored by