File pcs.spec of Package pcs
#
# spec file for package pcs
#
# Copyright (c) 2013 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/
#
%{!?py_ver: %{expand: %%global py_ver %%(echo `python -c "import sys; print sys.version[:3]"`)}}
%{!?py_prefix: %{expand: %%global py_prefix %%(echo `python -c "import sys; print sys.prefix"`)}}
%{!?py_libdir: %{expand: %%global py_libdir %%{expand:%%%%{py_prefix}/%%%%{_lib}/python%%%%{py_ver}}}}
%{!?py_sitedir: %{expand: %%global py_sitedir %%{expand:%%%%{py_libdir}/site-packages}}}
%if 0%{?fedora_version} || 0%{?centos_version} || 0%{?rhel_version} || 0%{?rhel} || 0%{?fedora}
%define pkg_group System Environment/Base
%else
%define pkg_group Productivity/Clustering/HA
%endif
Name: pcs
Version: 0.9.150
Release: 0
License: GPL-2.0
Summary: Pacemaker Configuration System
Url: http://github.com/feist/pcs
Group: %{pkg_group}
Source0: pcs-%{version}.tar.bz2
BuildRequires: python
BuildRequires: python-setuptools
BuildRequires: rubygem(%{rb_default_ruby_abi}:bundler)
BuildRequires: rubygem(%{rb_default_ruby_abi}:backports)
BuildRequires: rubygem(%{rb_default_ruby_abi}:json)
BuildRequires: rubygem(%{rb_default_ruby_abi}:rack:1.4)
BuildRequires: rubygem(%{rb_default_ruby_abi}:rack-test:0.6)
BuildRequires: rubygem(%{rb_default_ruby_abi}:rpam-ruby19)
BuildRequires: rubygem(%{rb_default_ruby_abi}:sinatra)
BuildRequires: rubygem(%{rb_default_ruby_abi}:sinatra-contrib)
BuildRequires: rubygem(%{rb_default_ruby_abi}:sinatra-sugar)
BuildRequires: rubygem(%{rb_default_ruby_abi}:tilt:1.4)
BuildRequires: rubygem(%{rb_default_ruby_abi}:multi_json:1) >= 1.11
BuildRequires: rubygem(%{rb_default_ruby_abi}:highline:1.6)
BuildRequires: rubygem(%{rb_default_ruby_abi}:eventmachine:1.0)
BuildRequires: rubygem(%{rb_default_ruby_abi}:monkey-lib)
BuildRequires: rubygem(%{rb_default_ruby_abi}:open4:1.3.4)
Requires: rubygem(%{rb_default_ruby_abi}:orderedhash)
BuildRequires: systemd
Requires(pre): %fillup_prereq
Requires(pre): %insserv_prereq
Requires: pacemaker
Requires: ruby
Requires: openssl
Requires: python-lxml
Requires: rubygem(%{rb_default_ruby_abi}:backports)
Requires: rubygem(%{rb_default_ruby_abi}:eventmachine:1.0)
Requires: rubygem(%{rb_default_ruby_abi}:json)
Requires: rubygem(%{rb_default_ruby_abi}:multi_json:1) >= 1.11
Requires: rubygem(%{rb_default_ruby_abi}:open4:1.3.4)
Requires: rubygem(%{rb_default_ruby_abi}:orderedhash)
Requires: rubygem(%{rb_default_ruby_abi}:rack:1.4)
Requires: rubygem(%{rb_default_ruby_abi}:rack-protection)
Requires: rubygem(%{rb_default_ruby_abi}:rack-test:0.6)
Requires: rubygem(%{rb_default_ruby_abi}:rpam-ruby19)
Requires: rubygem(%{rb_default_ruby_abi}:sinatra)
Requires: rubygem(%{rb_default_ruby_abi}:sinatra-contrib)
Requires: rubygem(%{rb_default_ruby_abi}:sinatra-sugar)
Requires: rubygem(%{rb_default_ruby_abi}:tilt:1.4)
Requires: rubygem(%{rb_default_ruby_abi}:highline:1.6)
Requires: rubygem(%{rb_default_ruby_abi}:monkey-lib)
Recommends: logrotate
%if %{defined systemd_requires}
%systemd_requires
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArchitectures: noarch
%description
pcs is a corosync and pacemaker configuration tool. It permits users to
easily view, modify and created pacemaker based clusters.
%prep
%setup -q
%build
%install
make install DESTDIR=%{buildroot} PYTHON_SITELIB=%{python_sitelib}
make install_pcsd BUILD_GEMS=false DESTDIR=%{buildroot} PYTHON_SITELIB=%{python_sitelib} hdrdir="%{_includedir}" rubyhdrdir="%{_includedir}" includedir="%{_includedir}"
%fillup_and_insserv
mkdir -p %{buildroot}%{_localstatedir}/adm/fillup-templates
mkdir -p %{buildroot}%{_localstatedir}/log/pcsd
mv %{buildroot}%{_sysconfdir}/sysconfig/pcsd %{buildroot}%{_localstatedir}/adm/fillup-templates/sysconfig.pcsd
chmod 644 %{buildroot}%{_sysconfdir}/bash_completion.d/pcs \
%{buildroot}%{_prefix}/lib/systemd/system/pcsd.service \
%{buildroot}%{_localstatedir}/adm/fillup-templates/sysconfig.pcsd \
%{buildroot}%{_sysconfdir}/pam.d/pcsd
rm %{buildroot}%{_prefix}/lib/pcsd/pcsd.service
[ -f %{buildroot}%{_prefix}/lib/pcsd/.gitignore ] && rm %{buildroot}%{_prefix}/lib/pcsd/.gitignore
find %{buildroot}%{_prefix}/lib/pcsd/public/css/ -type f -exec chmod a-x {} ';'
find "%{buildroot}%{python_sitelib}/" -name '*.pyc' -exec rm {} \;
python -c 'import compileall; compileall.compile_dir("%{buildroot}%{python_sitelib}/", ddir="%{python_sitelib}/",force=1)'
%if 0%{?suse_version}
%{__ln_s} -f %{_prefix}/lib/systemd/system/pcsd.service %{buildroot}%{_sbindir}/rcpcsd
%endif
%pre
%service_add_pre pcsd.service
%post
%{fillup_and_insserv -i -n pcsd}
%service_add_post pcsd.service
%preun
%service_del_preun pcsd.service
%postun
%service_del_postun pcsd.service
%files
%defattr(-,root,root,-)
%{python_sitelib}/pcs
%{python_sitelib}/pcs-%{version}-py2.*.egg-info
%{_sbindir}/pcs
%{_prefix}/lib/pcsd/
%{_unitdir}/pcsd.service
%dir %{_localstatedir}/lib/pcsd
%dir %{_localstatedir}/log/pcsd
%config(noreplace) %{_sysconfdir}/pam.d/pcsd
%config %{_sysconfdir}/bash_completion.d/pcs
%config(noreplace) %{_sysconfdir}/logrotate.d/pcsd
%{_localstatedir}/adm/fillup-templates/sysconfig.pcsd
%doc %{_mandir}/man8/pcs.8*
%doc COPYING README
%if 0%{?suse_version}
%attr(-,root,root) %{_sbindir}/rcpcsd
%endif
%changelog