File glusterfs.spec of Package glusterfs

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

Name:           glusterfs
%define lname_rpc	libgfrpc0
%define lname_xdr	libgfxdr0
%define lname_gf	libglusterfs0
Version:        3.2.4
Release:        0
Group:		System/Filesystems
Summary:	Aggregating distributed file system
License:        GPL-2.0+ ; GPL-3.0
Url:            http://gluster.org/

Source:         %name-%version.tar.xz
Patch1:         glusterfs-init.diff
Patch2:         glusterfs-date.diff
Patch3:         glusterfs-system-uuid.diff
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  automake
BuildRequires:  bison
BuildRequires:  fdupes
BuildRequires:  flex
BuildRequires:  fuse-devel >= 2.6.5
BuildRequires:  libtool
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(libxml-2.0)
BuildRequires:  pkgconfig(uuid)
BuildRequires:  python
BuildRequires:  readline-devel
BuildRequires:  xz
Requires:       python

%description
GlusterFS is a clustered file-system capable of scaling to several
petabytes. It aggregates various storage bricks over Infiniband RDMA
or TCP/IP interconnect into one large parallel network file system.
GlusterFS is one of the most sophisticated file systems in terms of
features and extensibility. It borrows a powerful concept called
Translators from GNU Hurd kernel. Much of the code in GlusterFS is in
user space and easily manageable.

%package -n %lname_rpc
Summary:	GlusterFS Remote Procedure Call library
Group:		System/Libraries

%description -n %lname_rpc
GlusterFS is a clustered file-system capable of scaling to several
petabytes.

%package -n %lname_xdr
Summary:	GlusterFS's External Data Representation library
Group:		System/Libraries

%description -n %lname_xdr
GlusterFS is a clustered file-system capable of scaling to several
petabytes.

%package -n %lname_gf
Summary:	GlusterFS's core library
Group:		System/Libraries

%description -n %lname_gf
GlusterFS is a clustered file-system capable of scaling to several
petabytes.

%package devel
Summary:	Development files for glusterfs
Group:		Development/Libraries/C and C++
Requires:       %name = %version
Requires:       %lname_rpc = %version, %lname_xdr = %version
Requires:       %lname_gf = %version

%description devel
GlusterFS is a clustered file-system capable of scaling to several
petabytes.

This package provides development files such as headers and library
links.

%prep
%setup -q
%patch -P 1 -P 2 -P 3 -p1

%build
./autogen.sh;
%configure --disable-static
# This section is not parallel safe or so due to bison/lex
make -C libglusterfs/src
make %{?_smp_mflags};

%install
b="%buildroot";
%make_install docdir=%_docdir/%name

mkdir -p "$b/%_localstatedir/log"/{glusterd,glusterfs,glusterfsd};

# The things seemingly forgotten by make install.
# - Manually populate devel dirs
mkdir -p "$b/%_includedir/%name";
install -pm0644 libglusterfs/src/*.h "$b/%_includedir/%name/";
# - hekafs wants this:
mkdir -p "$b/%_includedir/%name"/{rpc,server};
install -pm0644 rpc/rpc-lib/src/*.h rpc/xdr/src/*.h \
	"$b/%_includedir/%name/rpc/";
install -pm0644 xlators/protocol/server/src/*.h \
	"$b/%_includedir/%name/server/";
# - init script; there is no SuSE-release in the build env
mkdir -p "$b/%_initrddir";
install -pm0755 extras/init.d/glusterd-SuSE "$b/%_initrddir/glusterd";
# - wrapper umount script?
# - logrotate entry
mkdir -p "$b/%_localstatedir/log/%name";
# - vim syntax

# - state
mkdir -p "$b/%_localstatedir/lib/glusterd";
perl -i -pe \
	's{^(\s*option working-directory )\S+}{$1 %_localstatedir/lib/glusterd}g' \
	"$b/%_sysconfdir/%name/glusterd.vol";

# Clean, but must NOT remove .la from dirs not searched by
# default, thus maxdepth.
find "$b/%_libdir" -maxdepth 1 -type f -name "*.la" -delete;

# W: wrong-file-end-of-line-encoding
perl -i -pe 's{\x0d\x0a}{\x0a}gs' %_docdir/%name/glusterfs-mode.el;

%fdupes %buildroot

%post
/sbin/ldconfig
%insserv_cleanup
%restart_on_update glusterd

%preun
%stop_on_removal glusterd

%postun
/sbin/ldconfig
%insserv_cleanup

%post -n %lname_rpc -p /sbin/ldconfig

%postun -n %lname_rpc -p /sbin/ldconfig

%post -n %lname_xdr -p /sbin/ldconfig

%postun -n %lname_xdr -p /sbin/ldconfig

%post -n %lname_gf -p /sbin/ldconfig

%postun -n %lname_gf -p /sbin/ldconfig

%files
%defattr(-,root,root)
%_initrddir/glusterd
%dir %_sysconfdir/%name
%config(noreplace) %_sysconfdir/%name/glusterd.vol
%config %_sysconfdir/%name/*.sample
/sbin/mount.%name
%_libexecdir/%name
%_libdir/%name
%_sbindir/gluster*
%_mandir/man*/*
%_docdir/%name
%_localstatedir/lib/glusterd
%_localstatedir/log/%name

%files -n %lname_rpc
%defattr(-,root,root)
%_libdir/libgfrpc.so.0*

%files -n %lname_xdr
%defattr(-,root,root)
%_libdir/libgfxdr.so.0*

%files -n %lname_gf
%defattr(-,root,root)
%_libdir/libglusterfs.so.0*

%files devel
%defattr(-,root,root)
%_includedir/%name
%_libdir/*.so

%changelog
openSUSE Build Service is sponsored by