pacemaker/pacemaker.spec
Yan Gao 2b3ea92213 Accepting request 401947 from home:scarabeus_iv:branches:network:ha-clustering:Factory
- Clean-up with spec-cleaner
- Drop heartbeat conditions, no heartbeat around
- Sort CMAN conditionals to be actually logical
- Run fdupes to not waste so much space
- Add logrotate to reqs of pacemaker-cli
- Cleanup rpmlintrc to contain only bare needed minimum
- Run basic sanity check in %check phase

- Drop sysvinit support we now run on sle12+ only
- Cleanup the define conditionals that are never used
- Drop profiling and coverage options it is not enabled by default
  and better to run separately

OBS-URL: https://build.opensuse.org/request/show/401947
OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/pacemaker?expand=0&rev=247
2016-06-20 11:39:16 +00:00

575 lines
17 KiB
RPMSpec

#
# spec file for package pacemaker
#
# 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/
#
%global gname haclient
%global uname hacluster
%global pcmk_docdir %{_docdir}/%{name}
%define with_corosync_support 1
%define with_nagios 1
%define with_esmtp 1
%define with_acl 1
%define with_cibsecrets 1
%define enable_lib_cluster_pkg 0
%define enable_fatal_warnings 1
%define with_regression_tests 0
%if ! %{defined _rundir}
%define _rundir %{_localstatedir}/run
%endif
# Conditionals
# Invoke "rpmbuild --without <feature>" or "rpmbuild --with <feature>"
# to disable or enable specific features
# Legacy stonithd fencing agents
%bcond_without stonithd
# We generate docs using Publican, Asciidoc and Inkscape, but they're not available everywhere
%bcond_with doc
# Use a different versioning scheme
%bcond_with pre_release
# Turn off cman support
%bcond_with cman
Name: pacemaker
# AGPL-3.0 licensed extra/clustermon.sh is not present in the binary
Version: 1.1.14+git20160612.dd46368
Release: 0
Summary: Scalable High-Availability cluster resource manager
License: GPL-2.0 and GPL-2.0+ and LGPL-2.1+
Group: Productivity/Clustering/HA
Url: http://www.clusterlabs.org
# eg. https://github.com/ClusterLabs/pacemaker/archive/8ae45302394b039fb098e150f156df29fc0cb576/pacemaker-8ae4530.tar.gz
Source0: %{name}-%{version}.tar.bz2
Source1: crm_report.in
Source100: pacemaker.rpmlintrc
Patch1: bug-806256_pacemaker-log-level-notice.patch
Patch2: bug-728579_pacemaker-stonith-dev-id.patch
Patch3: pacemaker-NodeUtilization-RA.patch
Patch4: pacemaker-cibsecret-tool-temp-disabled.patch
Patch5: pacemaker-nagios-plugin-dir.patch
Patch6: bug-812269_pacemaker-fencing-device-register-messages.patch
Patch7: pacemaker-Wno-format-signedness.patch
Patch8: bug-943295_pacemaker-lrmd-log-notice.patch
Patch9: bug-977201_pacemaker-controld-self-fencing.patch
# Required for core functionality (python-devel depends on python)
BuildRequires: autoconf
BuildRequires: automake
# Enables optional functionality
BuildRequires: bison
BuildRequires: docbook-xsl-stylesheets
BuildRequires: fdupes
BuildRequires: flex
BuildRequires: help2man
BuildRequires: libbz2-devel
BuildRequires: libgnutls-devel
# We need reasonably recent versions of libqb
BuildRequires: libqb-devel > 0.11.0
BuildRequires: libselinux-devel
BuildRequires: libtool
BuildRequires: libtool-ltdl-devel
BuildRequires: libuuid-devel
BuildRequires: libxml2-devel
BuildRequires: libxslt-devel
BuildRequires: ncurses-devel
BuildRequires: net-snmp-devel
BuildRequires: openssl-devel
BuildRequires: pam-devel
BuildRequires: pkgconfig
BuildRequires: python
BuildRequires: python-devel
# Required for agent_config.h which specifies the correct scratch directory
BuildRequires: resource-agents
BuildRequires: pkgconfig(dbus-1)
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(systemd)
Requires: %{name}-cli = %{version}-%{release}
Requires: libpacemaker3 = %{version}-%{release}
Requires: libqb > 0.11.0
Requires: psmisc
Requires: python
Requires: resource-agents
Recommends: crmsh
Recommends: fence-agents
Recommends: libdlm
Recommends: sbd
Suggests: graphviz
Conflicts: heartbeat < 3.0
Conflicts: libheartbeat2 < 3.0.0
Provides: pacemaker-ticket-support = 2.0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%{?systemd_requires}
%if %{enable_lib_cluster_pkg}
Requires: libpacemaker3-cluster = %{version}-%{release}
%endif
%if %{with cman}
BuildRequires: clusterlib-devel
# pacemaker initscript: cman initscript, fence_tool (+ some soft-dependencies)
# "post" scriptlet: ccs_update_schema
Requires: cman
%endif
%if %{with_corosync_support}
BuildRequires: libcorosync-devel
Requires: corosync
%endif
%if %{with stonithd}
BuildRequires: libglue-devel
%endif
%if %{with doc}
BuildRequires: asciidoc
BuildRequires: inkscape
BuildRequires: publican
%endif
%if %{with_esmtp}
BuildRequires: libesmtp-devel
%endif
%if %{with_regression_tests}
BuildRequires: procps
BuildRequires: python-curses
BuildRequires: python-xml
BuildRequires: vim-base
%endif
%description
Pacemaker is an advanced, scalable High-Availability cluster resource
manager for Corosync, CMAN and/or Linux-HA.
It supports more than 16 node clusters with significant capabilities
for managing resources and dependencies.
It will run scripts at initialization, when machines go up or down,
when related resources fail and can be configured to periodically check
resource health.
%package cli
Summary: Command line tools for controlling Pacemaker clusters
Group: Productivity/Clustering/HA
Requires: libpacemaker3 = %{version}
Requires: logrotate
Requires: perl-TimeDate
%description cli
Pacemaker is an advanced, scalable High-Availability cluster resource
manager for Corosync, CMAN and/or Linux-HA.
The %{name}-cli package contains command line tools that can be used
to query and control the cluster from machines that may, or may not,
be part of the cluster.
%package -n libpacemaker3
Summary: Core Pacemaker libraries
Group: Productivity/Clustering/HA
%description -n libpacemaker3
Pacemaker is an advanced, scalable High-Availability cluster resource
manager for Corosync, CMAN and/or Linux-HA.
The libpacemaker3 package contains shared libraries needed for cluster
nodes and those just running the CLI tools.
%if %{enable_lib_cluster_pkg}
%package -n libpacemaker3-cluster
Summary: Cluster Libraries used by Pacemaker
Group: Productivity/Clustering/HA
Requires: libpacemaker3 = %{version}
%description -n libpacemaker3-cluster
Pacemaker is an advanced, scalable High-Availability cluster resource
manager for Corosync, CMAN and/or Linux-HA.
The libpacemaker3-cluster package contains cluster-aware shared
libraries needed for nodes that will form part of the cluster nodes.
%endif
%package remote
Summary: Pacemaker remote daemon for non-cluster nodes
Group: Productivity/Clustering/HA
Requires: %{name}-cli = %{version}
Requires: libpacemaker3 = %{version}
Requires: resource-agents
%{?systemd_requires}
%description remote
Pacemaker is an advanced, scalable High-Availability cluster resource
manager for Corosync, CMAN and/or Linux-HA.
The %{name}-remote package contains the Pacemaker Remote daemon
which is capable of extending pacemaker functionality to remote
nodes not running the full corosync/cluster stack.
%package -n libpacemaker-devel
Summary: Pacemaker development package
Group: Development/Libraries/C and C++
Requires: %{name}-cts = %{version}-%{release}
Requires: glib2-devel
Requires: libbz2-devel
Requires: libcorosync-devel
Requires: libpacemaker3 = %{version}
Requires: libqb-devel
Requires: libtool-ltdl-devel
Requires: libuuid-devel
Requires: libxml2-devel
Requires: libxslt-devel
%if %{enable_lib_cluster_pkg}
Requires: libpacemaker3-cluster = %{version}
%endif
%if %{with_regression_tests}
# For the regression tests, we can run them only if all pacemaker
# packages are installed, so we pull that in here for the regression
# builds; this is supposed to be disabled for shipping code.
Requires: pacemaker
%endif
%description -n libpacemaker-devel
Pacemaker is an advanced, scalable High-Availability cluster resource
manager for Corosync, CMAN and/or Linux-HA.
The libpacemaker-devel package contains headers and shared libraries
for developing tools for Pacemaker.
%package cts
Summary: Test framework for cluster-related technologies like Pacemaker
Group: Productivity/Clustering/HA
Requires: libpacemaker3 = %{version}
Requires: python
%description cts
Testing framework for cluster-related technologies like Pacemaker
%if %{with doc}
%package doc
Summary: Documentation for Pacemaker
Group: Productivity/Clustering/HA
%description doc
Documentation for Pacemaker.
Pacemaker is an advanced, scalable High-Availability cluster resource
manager for Corosync, CMAN and/or Linux-HA.
%endif
%prep
%setup -q
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%build
autoreconf -fvi
%configure \
--disable-static \
--disable-silent-rules\
--without-profiling \
--without-coverage \
%{!?with_cman: --without-cman} \
--without-heartbeat \
%if %{with_nagios}
--with-nagios=true \
%endif
--with-snmp=true \
%if %{with_esmtp}
--with-esmtp=true \
%endif
%if %{with_acl}
--with-acl=true \
%endif
%if %{with_cibsecrets}
--with-cibsecrets=true \
%endif
%if !%{enable_fatal_warnings}
--enable-fatal-warnings=no \
%endif
%{!?with doc: --with-brand=} \
--with-initdir=%{_initddir} \
--localstatedir=%{_var} \
--with-version=%{version}
make %{?_smp_mflags} all
%install
make DESTDIR=%{buildroot} docdir=%{pcmk_docdir} install
install -d -m755 %{buildroot}%{_localstatedir}/adm/fillup-templates
install -m 644 mcp/pacemaker.sysconfig %{buildroot}%{_localstatedir}/adm/fillup-templates/sysconfig.pacemaker
install -m 644 tools/crm_mon.sysconfig %{buildroot}%{_localstatedir}/adm/fillup-templates/sysconfig.crm_mon
# Scripts that should be executable
chmod a+x %{buildroot}/%{_datadir}/pacemaker/tests/cts/CTSlab.py
# These are not actually scripts
find %{buildroot} -name '*.xml' -type f -print0 | xargs -0 chmod a-x
find %{buildroot} -type f -name "*.la" -delete -print
rm -f %{buildroot}/%{_libdir}/service_crm.so
# Don't ship init scripts for systemd based platforms
rm -f %{buildroot}/%{_initddir}/pacemaker
rm -f %{buildroot}/%{_initddir}/pacemaker_remote
# Don't ship fence_pcmk where it has no use
%if %{without cman}
rm -f %{buildroot}/%{_sbindir}/fence_pcmk
%endif
ln -s service %{buildroot}%{_sbindir}/rcpacemaker
ln -s service %{buildroot}%{_sbindir}/rcpacemaker_remote
ln -s service %{buildroot}%{_sbindir}/rccrm_mon
mv %{buildroot}%{_sbindir}/crm_report %{buildroot}%{_sbindir}/crm_report.pacemaker
install -m 755 %{SOURCE1} %{buildroot}%{_sbindir}/crm_report
%fdupes -s %{buildroot}
%check
# Prevent false positives in rpmlint
./BasicSanity.sh -V pengine cli 2>&1
%post
%service_add_post pacemaker.service
%pre
%service_add_pre pacemaker.service
%preun
%service_del_preun pacemaker.service
%postun
%service_del_postun pacemaker.service
%post remote
%service_add_post pacemaker_remote.service
%pre remote
%service_add_pre pacemaker_remote.service
%preun remote
%service_del_preun pacemaker_remote.service
%postun remote
%service_del_postun pacemaker_remote.service
%post cli
%fillup_only pacemaker
%service_add_post crm_mon.service
%fillup_only crm_mon
%pre cli
%service_add_pre crm_mon.service
%preun cli
%service_del_preun crm_mon.service
%postun cli
%service_del_postun crm_mon.service
%pre -n libpacemaker3
getent group %{gname} >/dev/null || groupadd -r %{gname} -g 189
getent passwd %{uname} >/dev/null || useradd -r -g %{gname} -u 189 -s /sbin/nologin -c "cluster user" %{uname}
exit 0
%post -n libpacemaker3 -p /sbin/ldconfig
%postun -n libpacemaker3 -p /sbin/ldconfig
%if %{enable_lib_cluster_pkg}
%post -n libpacemaker3-cluster -p /sbin/ldconfig
%postun -n libpacemaker3-cluster -p /sbin/ldconfig
%endif
%if %{with_regression_tests}
%post -n libpacemaker-devel
if [ ! -e /tmp/.pcmk_regression_tests_ran ]; then
touch /tmp/.pcmk_regression_tests_ran
# Needed so that the shell doesn't get stuck on escape
# sequences
export TERM=dumb
%{_datadir}/pacemaker/tests/cli/regression.sh || true
%{_datadir}/pacemaker/tests/pengine/regression.sh -V || true
echo Now running shell regression tests ; date
if ! %{_datadir}/pacemaker/tests/shell/regression.sh ; then
echo "Shell tests failed."
cat crmtestout/regression.out
fi
fi
%endif
%files
%defattr(-,root,root)
###########################################################
%defattr(-,root,root)
%{_sbindir}/pacemakerd
%{_unitdir}/pacemaker.service
%{_sbindir}/rcpacemaker
%exclude %{_libexecdir}/pacemaker/lrmd_test
%exclude %{_sbindir}/pacemaker_remoted
%dir %{_libexecdir}/pacemaker
%{_libexecdir}/pacemaker/*
%{_sbindir}/crm_node
%{_sbindir}/fence_legacy
%if %{with cman}
%{_sbindir}/fence_pcmk
%endif
%{_sbindir}/stonith_admin
%{_mandir}/man7/crmd.7%{ext_man}
%{_mandir}/man7/pengine.7%{ext_man}
%{_mandir}/man7/stonithd.7%{ext_man}
%if %{without cman}
%{_mandir}/man7/ocf_pacemaker_controld.7%{ext_man}
%endif
%{_mandir}/man7/ocf_pacemaker_o2cb.7%{ext_man}
%{_mandir}/man7/ocf_pacemaker_remote.7%{ext_man}
%{_mandir}/man8/crm_node.8%{ext_man}
%if %{with cman}
%{_mandir}/man8/fence_pcmk.8%{ext_man}
%endif
%{_mandir}/man8/fence_legacy.8%{ext_man}
%{_mandir}/man8/pacemakerd.8%{ext_man}
%{_mandir}/man8/stonith_admin.8%{ext_man}
%doc %{_datadir}/pacemaker/alerts
%doc COPYING AUTHORS ChangeLog
%dir %attr (750, %{uname}, %{gname}) %{_var}/lib/pacemaker/cib
%dir %attr (750, %{uname}, %{gname}) %{_var}/lib/pacemaker/pengine
%if %{without cman}
%{_libexecdir}/ocf/resource.d/pacemaker/controld
%endif
%{_libexecdir}/ocf/resource.d/pacemaker/o2cb
%{_libexecdir}/ocf/resource.d/pacemaker/remote
%{_libexecdir}/ocf/resource.d/.isolation
%files cli
%defattr(-,root,root)
%config(noreplace) %{_sysconfdir}/logrotate.d/pacemaker
%{_unitdir}/crm_mon.service
%{_sbindir}/rccrm_mon
%{_sbindir}/attrd_updater
%{_sbindir}/cibadmin
%{_sbindir}/crm_attribute
%{_sbindir}/crm_diff
%{_sbindir}/crm_error
%{_sbindir}/crm_failcount
%{_sbindir}/crm_master
%{_sbindir}/crm_mon
%{_sbindir}/crm_resource
%{_sbindir}/crm_standby
%{_sbindir}/crm_verify
%{_sbindir}/crmadmin
%{_sbindir}/iso8601
%{_sbindir}/crm_shadow
%{_sbindir}/crm_simulate
%{_sbindir}/crm_report
%{_sbindir}/crm_report.pacemaker
%{_sbindir}/crm_ticket
%exclude %{_datadir}/pacemaker/alerts
%exclude %{_datadir}/pacemaker/tests
%{_datadir}/pacemaker
%{_datadir}/snmp/mibs/PCMK-MIB.txt
%exclude %{_libexecdir}/ocf/resource.d/pacemaker/controld
%exclude %{_libexecdir}/ocf/resource.d/pacemaker/o2cb
%exclude %{_libexecdir}/ocf/resource.d/pacemaker/remote
%dir %{_libexecdir}/ocf
%dir %{_libexecdir}/ocf/resource.d
%{_libexecdir}/ocf/resource.d/pacemaker
%config(noreplace) %{_localstatedir}/adm/fillup-templates/sysconfig.pacemaker
%config(noreplace) %{_localstatedir}/adm/fillup-templates/sysconfig.crm_mon
%{_mandir}/man7/*
%exclude %{_mandir}/man7/crmd.*
%exclude %{_mandir}/man7/pengine.*
%exclude %{_mandir}/man7/stonithd.*
%exclude %{_mandir}/man7/ocf_pacemaker_controld.*
%exclude %{_mandir}/man7/ocf_pacemaker_o2cb.*
%exclude %{_mandir}/man7/ocf_pacemaker_remote.*
%{_mandir}/man8/*
%exclude %{_mandir}/man8/crm_node.*
%exclude %{_mandir}/man8/fence_pcmk.*
%exclude %{_mandir}/man8/fence_legacy.*
%exclude %{_mandir}/man8/pacemakerd.*
%exclude %{_mandir}/man8/pacemaker_remoted.*
%exclude %{_mandir}/man8/stonith_admin.*
%doc COPYING AUTHORS ChangeLog
%dir %attr (750, %{uname}, %{gname}) %{_var}/lib/pacemaker
%dir %attr (750, %{uname}, %{gname}) %{_var}/lib/pacemaker/blackbox
%dir %attr (750, %{uname}, %{gname}) %{_var}/lib/pacemaker/cores
%files -n libpacemaker3
%defattr(-,root,root)
%{_libdir}/libcib.so.*
%{_libdir}/liblrmd.so.*
%{_libdir}/libcrmservice.so.*
%{_libdir}/libcrmcommon.so.*
%{_libdir}/libpe_status.so.*
%{_libdir}/libpe_rules.so.*
%{_libdir}/libpengine.so.*
%{_libdir}/libstonithd.so.*
%{_libdir}/libtransitioner.so.*
%doc COPYING.LIB AUTHORS
%{_libdir}/libcrmcluster.so.*
%if %{enable_lib_cluster_pkg}
%files -n libpacemaker3-cluster
%defattr(-,root,root)
%{_libdir}/libcrmcluster.so.*
%doc COPYING.LIB AUTHORS
%endif
%files remote
%defattr(-,root,root)
%{_unitdir}/pacemaker_remote.service
%{_sbindir}/rcpacemaker_remote
%{_sbindir}/pacemaker_remoted
%{_mandir}/man8/pacemaker_remoted.8%{ext_man}
%doc COPYING AUTHORS
%if %{with doc}
%files doc
%defattr(-,root,root)
%doc %{pcmk_docdir}
%endif
%files cts
%defattr(-,root,root)
%{py_sitedir}/cts
%{_datadir}/pacemaker/tests/cts
%{_libexecdir}/pacemaker/lrmd_test
%doc COPYING AUTHORS
%files -n libpacemaker-devel
%defattr(-,root,root)
%exclude %{_datadir}/pacemaker/tests/cts
%{_datadir}/pacemaker/tests
%{_includedir}/pacemaker
%{_libdir}/*.so
%{_libdir}/pkgconfig/*.pc
%doc COPYING.LIB AUTHORS
%changelog