File btrfsprogs.spec of Package btrfsprogs.10525

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

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

# enable building of btrfsprogs-static
%if 0%{?suse_version} <= 1310 || 0%{?suse_version} == 1315
%define build_static	0
# temporarily disable until libzstd-devel-static
%define build_static	0

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

Name:           btrfsprogs
Version:        4.15
Release:        0
Summary:        Utilities for the Btrfs filesystem
License:        GPL-2.0
Group:          System/Filesystems
#Git-Clone:	git://
# support for mkinitrd in < 13.1
Source3:        dracut-fsck-help.txt
Source5:        sles11-defaults.h

Patch1:         mkfs-default-features.patch

BuildRequires:  asciidoc
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  dracut
BuildRequires:  libattr-devel
BuildRequires:  libblkid-devel
BuildRequires:  libext2fs-devel
BuildRequires:  libreiserfscore-devel >= 3.6.27
Requires:       libreiserfscore0 >= 3.6.27
BuildRequires:  libuuid-devel
%if 0%{?suse_version} > 1500
BuildRequires:  libzstd-devel
BuildRequires:  lzo-devel
BuildRequires:  pkg-config
%if 0%{?suse_version} >= 1310
BuildRequires:  suse-module-tools
BuildRequires:  udev
%if 0%{?suse_version} == 1310
BuildRequires:  libudev-devel
BuildRequires:  xmlto
BuildRequires:  zlib-devel
%if 0%{?suse_version} >= 1310
Requires(post): coreutils
Requires(postun): coreutils
Supplements:    filesystem(btrfs)
Recommends:     btrfsmaintenance
%if %{package_udev_rules}
Requires:       btrfsprogs-udev-rules
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

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

%if %build_static
%package -n btrfsprogs-static
Summary:        Static build of utilities for the Btrfs filesystem
Group:          System/Filesystems
BuildRequires:  glibc-devel-static
BuildRequires:  libblkid-devel-static
BuildRequires:  libcom_err-devel-static
BuildRequires:  libext2fs-devel-static
BuildRequires:  libuuid-devel-static
BuildRequires:  lzo-devel-static
BuildRequires:  zlib-devel-static

%description -n btrfsprogs-static
Static build of utilities needed to create and maintain btrfs file systems
under Linux. Suitable for limited or rescue environments.

Warning: the zlib and lzo libraries are statically linked in and may lack
important updates

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

%description -n libbtrfs0
This package contains the 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

%setup -q -n btrfs-progs-v%{version}
%patch1 -p1

%if 0%{?suse_version} == 1110
cp %{SOURCE5} .
export CFLAGS="%optflags -include sles11-defaults.h"

%configure			\
%if 0%{?suse_version} <= 1500

make V=1 %{?_smp_mflags} all \
%if %build_static

make install		\
%if %build_static
	install-static 	\
	DESTDIR=%{buildroot} prefix=%{_prefix} bindir=%{_sbindir} mandir=%{_mandir} libdir=%{_libdir}

%if %build_static
make install-static DESTDIR=%{buildroot} prefix=%{_prefix} bindir=%{_sbindir} mandir=%{_mandir} libdir=%{_libdir}

install -m 0755 -d %{buildroot}/%{_sbindir}
install -m 0755 -d %{buildroot}/%{_bindir}
# move some utilities out of /usr/sbin
mv %{buildroot}/%{_sbindir}/btrfs-map-logical %{buildroot}/%{_bindir}
# initrd rescue utilities
install -m 0755 btrfs-zero-log %{buildroot}/%{_sbindir}
install -m 0755 btrfs-select-super %{buildroot}/%{_sbindir}
install -m 0755 btrfs-image %{buildroot}/%{_sbindir}
install -m 0755 btrfstune %{buildroot}/%{_sbindir}
install -m 0755 btrfs-find-root %{buildroot}/%{_sbindir}
install -m 0755 -d %{buildroot}/sbin
ln -s %{_sbindir}/btrfs %{buildroot}/sbin
ln -s %{_sbindir}/btrfs-zero-log %{buildroot}/sbin
ln -s %{_sbindir}/btrfs-convert %{buildroot}/sbin
ln -s %{_sbindir}/btrfs-select-super %{buildroot}/sbin
ln -s %{_sbindir}/btrfs-image %{buildroot}/sbin
ln -s %{_sbindir}/btrfstune %{buildroot}/sbin
ln -s %{_sbindir}/btrfsck %{buildroot}/sbin
ln -s %{_sbindir}/btrfs-find-root %{buildroot}/sbin
ln -s %{_sbindir}/btrfs-debug-tree %{buildroot}/sbin
ln -s %{_sbindir}/mkfs.btrfs %{buildroot}/sbin
ln -s %{_sbindir}/fsck.btrfs %{buildroot}/sbin
%if 0%{?suse_version} < 1310
install -d -m0755 %{buildroot}/lib/mkinitrd/scripts/
install -m 0755 %{SOURCE1} %{buildroot}/lib/mkinitrd/scripts/
install -m 0755 %{SOURCE4} %{buildroot}/lib/mkinitrd/scripts/
find %{buildroot} -type f -name "*.la" -delete -print
# don't install .a for now
rm -f %{buildroot}/%{_libdir}/*.a
# bash completion
install -m 0755 -d %{buildroot}/%{_datadir}/bash-completion/completions
install -m 0644 btrfs-completion %{buildroot}/%{_datadir}/bash-completion/completions/btrfs
sed -e 's,@@INSTALLDIR@@,%{_datadir}/%{name}/,;' %{SOURCE2} >
install -m 0755 -D %{buildroot}/%{_dracutmodulesdir}/95suse-btrfs/
rm -f
install -m 0644 -D %{SOURCE3} %{buildroot}/%{_datadir}/%{name}/dracut-fsck-help.txt

%if 0%{!?for_debugging:1}
for file in $DEBUG_FILES; do
  rm -f %{buildroot}$file

%post -n libbtrfs0 -p /sbin/ldconfig

%postun -n libbtrfs0 -p /sbin/ldconfig

%if 0%{?suse_version} >= 1310



%defattr(-, root, root)
%dir %{_datadir}/%{name}
%dir %{_dracutmodulesdir}/95suse-btrfs/
# mkinitrd utils
%if 0%{?suse_version} < 1310
%dir /lib/mkinitrd
%dir /lib/mkinitrd/scripts
%dir %{_datadir}/bash-completion
%dir %{_datadir}/bash-completion/completions

%if 0%{?for_debugging:1}

%if %build_static
%files -n btrfsprogs-static
%defattr(-, root, root)

%files -n libbtrfs0
%defattr(-, root, root)

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

%if %{package_udev_rules}
%files udev-rules
%defattr(-, root, root)
%dir %{_udevrulesdir}