File cluster-glue.spec of Package cluster-glue

#
# spec file for package cluster-glue
#
# Copyright (c) 2015 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 glue_release 1

%define uid 90
%define gname haclient
%define uname hacluster
%if 0%{?sles_version} == 11 
# these three architectures have a problem with glib2
%ifarch ppc ppc64 ia64
%define warnings_fatal no
%else
%define warnings_fatal yes
%endif
%else
# Enable warnings for Factory
%define warnings_fatal yes
%endif
# Directory where we install documentation
%global glue_docdir %{_defaultdocdir}/%{name}

Name:           cluster-glue
Summary:        Reusable cluster components
License:        GPL-2.0 and LGPL-2.1+
Group:          Productivity/Clustering/HA
Version:        1.0.12
Release:        %{?glue_release}
Url:            http://www.linux-ha.org/wiki/Cluster_Glue
Source:         cluster-glue.tar.bz2
Source2:        baselibs.conf
Source3:        hb_report.in
# PATCH-FIX-OPENSUSE: load libplumb symbols manually (thanks to lge) (bnc#694243)
Patch1:         bug-694243_cluster-glue_symbol-conflict.patch
# PATCH-FIX-OPENSUSE: drop lrm as it's not used anymore by pacemaker
Patch4:         cluster-glue_droplrm.patch
# PATCH-FIX-OPENSUSE: fix build with GCC 5
Patch6:         cluster-glue-gcc5.patch
# PATCH-FIX-UPSTREAM: Dev: stonith: external/ec2: Be able to omit the "port" option. (bsc#947026) (fate#319008)
Patch11:        0006-ec2-instance-tag-bsc-947026.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  OpenIPMI-devel
BuildRequires:  asciidoc
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  docbook-xsl-stylesheets
BuildRequires:  docbook_4
BuildRequires:  e2fsprogs-devel
BuildRequires:  glib2-devel
BuildRequires:  help2man
BuildRequires:  libaio-devel
BuildRequires:  libbz2-devel
BuildRequires:  libtool
BuildRequires:  libxml2-devel
BuildRequires:  libxslt
BuildRequires:  net-snmp-devel
BuildRequires:  openhpi-devel
BuildRequires:  pkgconfig
BuildRequires:  python-devel
%if 0%{?suse_version} > 1130
BuildRequires:  libnet-devel
PreReq:         sysvinit(network) sysvinit(syslog)
%else
BuildRequires:  libnet
%endif

Requires(pre):  %fillup_prereq

%if 0%{?suse_version} > 1230
BuildRequires:  systemd-rpm-macros
%{?systemd_requires}
%endif
Conflicts:      pacemaker < 1.1.8
Conflicts:      heartbeat-common < 3.0.2
Obsoletes:      heartbeat-common < 3.0.2
Requires:       perl-TimeDate
Requires:       sudo
# The following is necessary since sbd is dropped from
# cluster-glue itself:
Recommends:     sbd
Requires(pre):    /usr/sbin/groupadd /usr/bin/getent /usr/sbin/useradd
# SLES10 needs tcpd-devel but doesn't have libcurl
%if 0%{?suse_version} < 1020
BuildRequires:  sgml-skel
BuildRequires:  tcpd-devel
%else
BuildRequires:  libcurl-devel
%endif

%if ! %{defined _rundir}
%define _rundir %{_localstatedir}/run
%endif

%description
A collection of common tools that are useful for writing cluster managers 
such as Pacemaker.
Provides a local resource manager that understands the OCF and LSB
standards, and an interface to common STONITH devices.

%package -n libglue2
Summary:        Reusable cluster libraries
Group:          Productivity/Clustering/HA
Obsoletes:      libheartbeat2 < 3.0.2
Conflicts:      libheartbeat2 < 3.0.2
Requires:       %{name} = %{version}-%{release}

%description -n libglue2
A collection of libraries that are useful for writing cluster managers
such as Pacemaker.

# %package -n stonith-snmp
# Summary:        Stonith agents based on SNMP
# Group:          Productivity/Clustering/HA

# %description -n stonith-snmp
# All stonith plugins which require libnetsnmp (apcmastersnmp and
# wti_mpc).

%package -n stonith-bladehpi
Summary:        Stonith agent for IBM bladecenter
Group:          Productivity/Clustering/HA

%description -n stonith-bladehpi
This STONITH module talks to IBM BladeCenters via SNMP through
use of the OpenHPI BladeCenter plugin (snmp_bc). For more information
about installing OpenHPI, setting up the BladeCenter SNMP agent, etc.
please visit http://www.openhpi.org/.

%package -n libglue-devel 
Summary:        Headers and libraries for writing cluster managers
Group:          Productivity/Clustering/HA
Requires:       %{name} = %{version}-%{release}
Requires:       libglue2 = %{version}-%{release}
Conflicts:      libheartbeat-devel < 3.0.2
Obsoletes:      libheartbeat-devel < 3.0.2

%description -n libglue-devel
Headers and shared libraries for a useful for writing cluster managers 
such as Pacemaker.

%prep
###########################################################
%setup -n cluster-glue -q
%patch1 -p1
%patch4 -p1
%patch6 -p1
%patch11 -p1
###########################################################

%build
cp %{S:3} ./hb_report/hb_report.in
CFLAGS="${CFLAGS} ${RPM_OPT_FLAGS}"
export CFLAGS
./autogen.sh
# SLES <= 10 does not support ./configure --docdir=,
# hence, use this ugly hack
%if 0%{?suse_version} < 1020
export docdir=%{glue_docdir}
%configure \
    --enable-ipmilan=no \
    --enable-fatal-warnings=%{warnings_fatal} \
    --with-package-name=%{name} \
    --with-daemon-group=%{gname} \
    --with-daemon-user=%{uname}
%else
%configure \
    --enable-ipmilan=no \
    --enable-fatal-warnings=%{warnings_fatal} \
    --with-package-name=%{name} \
    --with-daemon-group=%{gname} \
    --with-daemon-user=%{uname} \
%if %{defined _unitdir}
    --with-systemdsystemunitdir=%{_unitdir} \
%endif
    --with-rundir=%{_rundir} \
    --docdir=%{glue_docdir}
%endif
make %{?_smp_mflags}
###########################################################

%install
###########################################################
make DESTDIR=$RPM_BUILD_ROOT install
# Dont package static libs or compiled python
find $RPM_BUILD_ROOT -name '*.a' -type f -print0 | xargs -0 rm -f
find $RPM_BUILD_ROOT -name '*.la' -type f -print0 | xargs -0 rm -f
find $RPM_BUILD_ROOT -name '*.pyc' -type f -print0 | xargs -0 rm -f
find $RPM_BUILD_ROOT -name '*.pyo' -type f -print0 | xargs -0 rm -f
%if %{defined _unitdir}
ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rclogd
%endif

###########################################################

%pre
if
  getent group %{gname} >/dev/null
then
  : OK group haclient already present
else
  /usr/sbin/groupadd -o -r -g %{uid} %{gname} 2>/dev/null
fi
if
  getent passwd %{uname} >/dev/null
then
  : OK hacluster user already present
else
  /usr/sbin/useradd -r -g %{gname} -c "heartbeat processes" \
        -d %{_var}/lib/heartbeat/cores/%{uname} -o -u %{uid} \
        %{uname} 2>/dev/null
fi
%if %{defined _unitdir}
  %service_add_pre logd.service
%endif

%if %{defined _unitdir}
%post
%service_add_post logd.service

%preun
%service_del_preun logd.service

%postun
%service_del_postun logd.service
%endif

%post -n libglue2
/sbin/ldconfig  

%postun -n libglue2
/sbin/ldconfig

%files
###########################################################
%defattr(-,root,root)
%dir %{_libdir}/heartbeat
%dir %{_var}/lib/heartbeat
%dir %{_var}/lib/heartbeat/cores
%dir %attr (0700, root, root)           %{_var}/lib/heartbeat/cores/root
%dir %attr (0700, nobody, nobody)       %{_var}/lib/heartbeat/cores/nobody
%dir %attr (0700, %{uname}, %{gname})   %{_var}/lib/heartbeat/cores/%{uname}
%dir %{_libdir}/heartbeat/plugins
%dir %{_libdir}/heartbeat/plugins/RAExec
%dir %{_libdir}/heartbeat/plugins/InterfaceMgr
%dir %{_libdir}/heartbeat/plugins/compress
%dir %{_libdir}/stonith
%dir %{_libdir}/stonith/plugins
%dir %{_libdir}/stonith/plugins/stonith2
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/ha_cf_support.sh
%{_datadir}/%{name}/openais_conf_support.sh
%{_datadir}/%{name}/utillib.sh
%{_datadir}/%{name}/ha_log.sh
%{_sbindir}/ha_logger
%{_sbindir}/hb_report
#%{_sbindir}/lrmadmin
%{_sbindir}/cibsecret
%{_sbindir}/meatclient
%{_sbindir}/stonith

%if %{defined _unitdir}
%{_unitdir}/logd.service
%endif

#%{_sysconfdir}/init.d/logd
%doc %{_mandir}/man1/*
%doc %{_mandir}/man8/*
%doc AUTHORS
%doc COPYING
%doc logd/logd.cf
%{_sbindir}/rclogd
#%{_libdir}/heartbeat/lrmd
%{_libdir}/heartbeat/ha_logd
%{_libdir}/heartbeat/plugins/RAExec/*.so
%{_libdir}/heartbeat/plugins/InterfaceMgr/*.so
%{_libdir}/heartbeat/plugins/compress/*.so
%{_libdir}/stonith/plugins/external
%exclude %{_libdir}/stonith/plugins/stonith2/null.so
%exclude %{_libdir}/stonith/plugins/stonith2/ssh.so
%exclude %{_libdir}/stonith/plugins/external/ssh
%exclude %{_libdir}/stonith/plugins/stonith2/bladehpi.so
# %exclude %{_libdir}/stonith/plugins/stonith2/apcmastersnmp.so
# %exclude %{_libdir}/stonith/plugins/stonith2/wti_mpc.so
%{_libdir}/stonith/plugins/stonith2/*.so
%{_libdir}/stonith/plugins/stonith2/*.py
%{_libdir}/stonith/plugins/xen0-ha-dom0-stonith-helper

%files -n libglue2
%defattr(-,root,root)
%{_libdir}/lib*.so.*
%doc AUTHORS
%doc COPYING.LIB

# %files -n stonith-snmp
# %defattr(-,root,root)
# %{_libdir}/stonith/plugins/stonith2/apcmastersnmp.so
# %{_libdir}/stonith/plugins/stonith2/wti_mpc.so
# %doc AUTHORS
# %doc COPYING.LIB

%files -n stonith-bladehpi
%defattr(-,root,root)
%{_libdir}/stonith/plugins/stonith2/bladehpi.so
%doc AUTHORS
%doc COPYING.LIB

%files -n libglue-devel
%defattr(-,root,root)
%dir %{_libdir}/heartbeat
%dir %{_libdir}/heartbeat/plugins
%dir %{_libdir}/heartbeat/plugins/test
%dir %{_datadir}/%{name}
%{_libdir}/lib*.so
%{_libdir}/heartbeat/ipctest
%{_libdir}/heartbeat/ipctransientclient
%{_libdir}/heartbeat/ipctransientserver
%{_libdir}/heartbeat/transient-test.sh
%{_libdir}/heartbeat/base64_md5_test
%{_libdir}/heartbeat/logtest
%{_includedir}/clplumbing
%{_includedir}/heartbeat
%exclude %{_includedir}/heartbeat/lrm
%{_includedir}/stonith
%{_includedir}/pils
#%{_datadir}/%{name}/lrmtest
%{_libdir}/heartbeat/plugins/test/test.so
%{_libdir}/stonith/plugins/stonith2/null.so
%{_libdir}/stonith/plugins/stonith2/ssh.so
%{_libdir}/stonith/plugins/external/ssh
%doc AUTHORS
%doc COPYING
%doc COPYING.LIB

%changelog
openSUSE Build Service is sponsored by