File booth.spec of Package booth

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


%if 0%{?suse_version}
%global booth_docdir %{_defaultdocdir}/%{name}
%else
# newer fedora distros have _pkgdocdir, rely on that when
# available
%{!?_pkgdocdir: %global _pkgdocdir %%{_docdir}/%{name}-%{version}}
# Directory where we install documentation
%global booth_docdir %{_pkgdocdir}
%endif

Url:            https://github.com/ClusterLabs/booth

%if 0%{?suse_version}
%define _libexecdir %{_libdir}
%endif
%define with_extra_warnings   	0
%define with_debugging  	0
%define without_fatal_warnings 	1
%if 0%{?fedora} || 0%{?centos} || 0%{?rhel}
%define pkg_group System Environment/Daemons
%else
%define pkg_group Productivity/Clustering/HA
%endif

%global test_path   	%{_datadir}/booth/tests

Name:           booth
Summary:        Ticket Manager for Multi-site Clusters
License:        GPL-2.0+
Group:          %{pkg_group}
Version:        0.2.0
Release:        0
Source:         booth.tar.bz2
Source1:        %name-rpmlintrc
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  asciidoc
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  glib2-devel
%if 0%{?fedora} || 0%{?centos} || 0%{?rhel}
BuildRequires:  cluster-glue-libs-devel
BuildRequires:  pacemaker-libs-devel
%else
BuildRequires:  libglue-devel
BuildRequires:  libpacemaker-devel
%endif
BuildRequires:  libxml2-devel
BuildRequires:  pkgconfig
%if 0%{?fedora} || 0%{?centos} || 0%{?rhel}
Requires:       cluster-glue-libs >= 1.0.6
Requires:       pacemaker >= 1.1.8
%else
Requires:       pacemaker-ticket-support >= 2.0
%endif

%description
Booth manages the ticket which authorizes one of the cluster sites located in
geographically dispersed distances to run certain resources. It is designed to
be an add-on of Pacemaker, which extends Pacemaker to support geographically
dispersed clustering.



Authors:
--------
    Jiaju Zhang <jjzhang@suse.de>
    Philipp Marek <philipp.marek@linbit.com>
    Dejan Muhamedagic <dejan@suse.de>

%prep
%setup -q -n %{name}

%build
./autogen.sh
%configure \
	--with-initddir=%{_initrddir} \
    --docdir=%{booth_docdir}

make

%install
make DESTDIR=$RPM_BUILD_ROOT install docdir=%{booth_docdir}

mkdir -p %{buildroot}/%{_mandir}/man8/
gzip < docs/boothd.8 > %{buildroot}/%{_mandir}/man8/booth.8.gz
ln %{buildroot}/%{_mandir}/man8/booth.8.gz %{buildroot}/%{_mandir}/man8/boothd.8.gz 

# systemd
mkdir -p %{buildroot}/usr/lib/systemd/system/
cp -a conf/booth@.service %{buildroot}/usr/lib/systemd/system/booth@.service

#install test-parts

mkdir -p %{buildroot}/%{test_path}
cp -a unit-tests/ script/unit-test.py test conf %{buildroot}/%{test_path}/
chmod +x %{buildroot}/%{test_path}/test/live_test.sh
chmod +x %{buildroot}/%{test_path}/test/booth_path

mkdir -p %{buildroot}/%{test_path}/src/
ln -s %{_sbindir}/boothd %{buildroot}/%{test_path}/src/
rm -f %{buildroot}/%{test_path}/test/*.pyc

%check
%if 0%{?run_build_tests}
echo "%%run_build_tests set to %run_build_tests; including tests"
make check
%else
echo "%%run_build_tests set to %run_build_tests; skipping tests"
%endif

%clean
if
  [ -n "${RPM_BUILD_ROOT}" -a "${RPM_BUILD_ROOT}" != "/" ]
then
  rm -rf $RPM_BUILD_ROOT
fi

%files
%defattr(-,root,root,-)
%{_sbindir}/booth
%{_sbindir}/boothd
%{_mandir}/man8/booth.8.gz
%{_mandir}/man8/boothd.8.gz
%dir /usr/lib/ocf
%dir /usr/lib/ocf/resource.d
%dir /usr/lib/ocf/resource.d/pacemaker
%dir %{_sysconfdir}/booth
%exclude %{_initddir}/booth-arbitrator
/usr/lib/ocf/resource.d/pacemaker/booth-site
%config %{_sysconfdir}/booth/booth.conf.example

/usr/lib/systemd/system/booth@.service

%dir %{_datadir}/booth
%{_datadir}/booth/service-runnable

%doc README COPYING

%package test
Summary:        Test scripts for Booth
Group:          %{pkg_group}
Requires:       booth
Requires:       python

%description test
This package contains automated tests for Booth,
the Cluster Ticket Manager for Pacemaker.

%files test
%defattr(-,root,root)

%doc README-testing
%{test_path}

%changelog
openSUSE Build Service is sponsored by