File resource-agents.spec of Package resource-agents

#
# spec file for package resource-agents
#
# Copyright (c) 2012 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%{?fedora} || 0%{?centos_version} || 0%{?rhel}
%global agents_docdir %{_defaultdocdir}/%{name}-%{version}
%endif
%if 0%{?suse_version}
%global agents_docdir %{_defaultdocdir}/%{name}
%endif
# 
# Since this spec file supports multiple distributions, ensure we
# use the correct group for each.
#
%if 0%{?fedora} || 0%{?centos_version} || 0%{?rhel}
%define pkg_group System Environment/Daemons
%else
%define pkg_group Productivity/Clustering/HA
%endif
%define SSLeay		        perl-Net-SSLeay
%if 0%{?suse_version} < 1100
%define SSLeay			perl-Net_SSLeay
%endif

Name:           resource-agents
Summary:        The Heartbeat Subsystem for High-Availability Linux
License:        GPL-2.0 ; LGPL-2.1+
Group:          Productivity/Clustering/HA
Version:        3.9.2
Release:        0
Url:            http://linux-ha.org/
Source:         resource-agents-%{version}.tar.bz2
Source1:        resource-agents.conf
Patch1:         resource-agents-mysql-sle11.patch
Patch2:         lvm-vg-partial-active.diff
Patch3:         resource-agents-nfsserver-sle11.patch
Patch4:         no-var-lock-subsys.patch
Patch9:         sfex_uuid.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Obsoletes:      heartbeat-resources
Provides:       heartbeat-resources
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  glib2-devel
BuildRequires:  pkgconfig
BuildRequires:  python-devel
%if 0%{?suse_version}  
BuildRequires:  libglue-devel
%if %suse_version > 1130
BuildRequires:  libnet-devel
%else
BuildRequires:  libnet
%endif
BuildRequires:  docbook-xsl-stylesheets
BuildRequires:  docbook_4
BuildRequires:  libxslt
%endif
%if 0%{?fedora} || 0%{?centos_version} || 0%{?rhel}
BuildRequires:  cluster-glue-libs-devel
BuildRequires:  which
BuildRequires:  docbook-dtds
BuildRequires:  docbook-style-xsl
BuildRequires:  libxslt
%endif

%description
heartbeat is a sophisticated multinode resource manager for High
Availability clusters.

It can failover arbitrary resources, ranging from IP addresses over NFS
to databases that are tied in via resource scripts. The resources can
have arbitrary dependencies for ordering or placement between them.

heartbeat contains a cluster membership layer, fencing, and local and
clusterwide resource management functionality.

1.2/1.0 based 2-node only configurations are supported in a legacy
mode.

heartbeat implements the following kinds of heartbeats:

- Serial ports

- UDP/IPv4 broadcast, multi-cast, and unicast

- IPv4 "ping" pseudo-cluster members.



Authors:
--------
    Alan Robertson <alanr@unix.sh>
    Andrew Beekhof <abeekhof@suse.de>
    Guochun Shi <gshi@ncsa.uiuc.edu>
    Horms <horms@verge.net.net>
    Huang Zhen <zhenhltc@cn.ibm.com>
    Lars Marowsky-Bree <lmb@suse.de>
    Sun Jiang Dong <hasjd@cn.ibm.com>
    (See doc/AUTHORS)

%package -n ldirectord
Summary:        The Heartbeat Subsystem for High-Availability Linux
Group:          Productivity/Clustering/HA
Requires:       %{SSLeay} perl-libwww-perl ipvsadm
Obsoletes:      heartbeat-ldirectord
Provides:       heartbeat-ldirectord
Requires:       perl-MailTools perl-Socket6
%if 0%{?suse_version}
Requires:       logrotate
%endif
%if 0%{?fedora_version}
Requires(post): /sbin/chkconfig
Requires(preun):/sbin/chkconfig
%endif

%description -n ldirectord
heartbeat is a sophisticated multinode resource manager for High
Availability clusters.

It can failover arbitrary resources, ranging from IP addresses over NFS
to databases that are tied in via resource scripts. The resources can
have arbitrary dependencies for ordering or placement between them.

heartbeat contains a cluster membership layer, fencing, and local and
clusterwide resource management functionality.

1.2/1.0 based 2-node only configurations are supported in a legacy
mode.

heartbeat implements the following kinds of heartbeats:

- Serial ports

- UDP/IPv4 broadcast, multi-cast, and unicast

- IPv4 "ping" pseudo-cluster members.



Authors:
--------
    Alan Robertson <alanr@unix.sh>
    Andrew Beekhof <abeekhof@suse.de>
    Guochun Shi <gshi@ncsa.uiuc.edu>
    Horms <horms@verge.net.net>
    Huang Zhen <zhenhltc@cn.ibm.com>
    Lars Marowsky-Bree <lmb@suse.de>
    Sun Jiang Dong <hasjd@cn.ibm.com>
    (See doc/AUTHORS)

%prep
###########################################################
%setup -n resource-agents -q
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch9 -p1
###########################################################

%build
CFLAGS="${CFLAGS} ${RPM_OPT_FLAGS}"
export CFLAGS
CONF_OPTS="--with-ras-set=linux-ha \
    --enable-fatal-warnings=yes \
    --with-package-name=%{name}"
./autogen.sh
%if 0%{?suse_version} >= 1020 || 0%{?fedora} >= 11 || 0%{?centos_version} > 5 || 0%{?rhel} > 5
%configure $CONF_OPTS \
    --docdir=%{agents_docdir}
%else
export docdir=%{agents_docdir}
%configure $CONF_OPTS
%endif
export MAKE="make %{?jobs:-j%jobs}"
make %{?jobs:-j%jobs}
###########################################################

%install
###########################################################
make DESTDIR=$RPM_BUILD_ROOT install
(
  mkdir -p $RPM_BUILD_ROOT/etc/ha.d/resource.d
  ln -s %{_sbindir}/ldirectord $RPM_BUILD_ROOT/etc/ha.d/resource.d/ldirectord
) || true
test -d $RPM_BUILD_ROOT/sbin || mkdir $RPM_BUILD_ROOT/sbin
(
  cd $RPM_BUILD_ROOT/sbin
  ln -sf /etc/init.d/ldirectord rcldirectord 
) || true
# 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
# Unset execute permissions from things that shouln't have it
find $RPM_BUILD_ROOT -name 'ocf-*'  -type f -print0 | xargs -0 chmod a-x
find $RPM_BUILD_ROOT -name '*.dtd'  -type f -print0 | xargs -0 chmod a-x
chmod 0755 $RPM_BUILD_ROOT/usr/sbin/ocf-tester
chmod 0755 $RPM_BUILD_ROOT/usr/sbin/ocft
mkdir -p $RPM_BUILD_ROOT/usr/lib/tmpfiles.d
install -m 644 %{SOURCE1} $RPM_BUILD_ROOT/usr/lib/tmpfiles.d
(
cd $RPM_BUILD_ROOT/%{_libdir}/heartbeat
for f in ocf-returncodes ocf-shellfuncs
do
    ln -s /usr/lib/ocf/lib/heartbeat/$f
done
)
###########################################################

%clean
###########################################################
if
  [ -n "${RPM_BUILD_ROOT}" -a "${RPM_BUILD_ROOT}" != "/" ]
then
  rm -rf $RPM_BUILD_ROOT
fi
rm -rf $RPM_BUILD_DIR/resource-agents
###########################################################
%post
test -d /var/run/resource-agents || mkdir -m 1755 /var/run/resource-agents

%if 0%{?suse_version}

%preun -n ldirectord
%stop_on_removal ldirectord

%postun -n ldirectord
%insserv_cleanup
%endif
%if 0%{?fedora}

%preun -n ldirectord
/sbin/chkconfig --del ldirectord

%postun -n ldirectord -p /sbin/ldconfig

%post -n ldirectord
/sbin/chkconfig --add ldirectord
%endif

%files
###########################################################
%defattr(-,root,root)
%dir /usr/lib/ocf
%dir /usr/lib/ocf/resource.d
%dir /usr/lib/ocf/lib
%dir /usr/lib/tmpfiles.d
/usr/lib/tmpfiles.d/resource-agents.conf
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/ocft
%dir %{_datadir}/%{name}/ocft/configs
%config(noreplace) %{_datadir}/%{name}/ocft/configs/*
%{_datadir}/%{name}/ocft/caselib
%{_datadir}/%{name}/ocft/README
%{_datadir}/%{name}/ocft/README.zh_CN
/usr/lib/ocf/resource.d/heartbeat
/usr/lib/ocf/lib/heartbeat
%{_sbindir}/ocf-tester
%{_sbindir}/ocft
%{_sbindir}/sfex_init
%{_sbindir}/sfex_stat
%{_includedir}/heartbeat
%ghost %dir %attr (1755, root, root)  %{_var}/run/resource-agents
%doc AUTHORS
%doc COPYING
%doc COPYING.GPLv3
%doc %{_datadir}/%{name}/ra-api-1.dtd
%doc %{_mandir}/man7/*.7*
%doc %{_mandir}/man8/ocf-tester.8*
%doc %{_mandir}/man8/sfex_init.8*
%doc doc/README.webapps
# For compatability with pre-existing agents
%dir /etc/ha.d
/etc/ha.d/shellfuncs
%dir %{_libdir}/heartbeat
%{_libdir}/heartbeat/ocf-shellfuncs
%{_libdir}/heartbeat/ocf-returncodes
%{_libdir}/heartbeat/send_arp
%{_libdir}/heartbeat/sfex_daemon
%{_libdir}/heartbeat/findif
%{_libdir}/heartbeat/tickle_tcp

%files -n ldirectord
###########################################################
%defattr(-,root,root)
%doc ldirectord/ldirectord.cf
%doc %{_mandir}/man8/ldirectord.8*
%dir /etc/ha.d/resource.d
#%doc %{_mandir}/man8/supervise-ldirectord-config.8*
%{_sbindir}/ldirectord
/sbin/rcldirectord
#%{_sbindir}/supervise-ldirectord-config
%{_sysconfdir}/init.d/ldirectord
%{_sysconfdir}/ha.d/resource.d/ldirectord
%config(noreplace) %{_sysconfdir}/logrotate.d/ldirectord

%changelog
openSUSE Build Service is sponsored by