File cluster-glue.spec of Package cluster-glue.10407

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

%define gid 90
%define uid 90
%define gname haclient
%define uname hacluster
# Directory where we install documentation
%global glue_docdir %{_defaultdocdir}/%{name}
Name:           cluster-glue
Version:        1.0.12+v1.git.1534346580.be86a9f2
Release:        0
Summary:        Reusable cluster components
License:        GPL-2.0-only AND LGPL-2.1-or-later
Group:          Productivity/Clustering/HA
Source:         %{name}-%{version}.tar.bz2
Source2:        baselibs.conf
# 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-UPSTREAM: fix warnings seen by GCC7
# PATCH-FIX-OPENSUSE: Port scripts to Python 3
Patch5:         0001-Port-scripts-to-Python-3.patch

BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  docbook-xsl-stylesheets
BuildRequires:  docbook_4
BuildRequires:  e2fsprogs-devel
BuildRequires:  help2man
BuildRequires:  libaio-devel
BuildRequires:  libtool
BuildRequires:  libxslt
BuildRequires:  net-snmp-devel
BuildRequires:  pkgconfig
BuildRequires:  systemd-rpm-macros
BuildRequires:  pkgconfig(OpenIPMI)
BuildRequires:  pkgconfig(bzip2)
BuildRequires:  pkgconfig(glib-2.0)
BuildRequires:  pkgconfig(libcurl)
BuildRequires:  pkgconfig(libxml-2.0)
Requires:       perl-TimeDate
Requires:       sudo
Requires(pre):  shadow
# The following is necessary since sbd is dropped from
# cluster-glue itself:
Recommends:     sbd
Conflicts:      heartbeat-common < 3.0.2
Conflicts:      pacemaker < 1.1.8
Obsoletes:      heartbeat-common < 3.0.2
%if 0%{?suse_version} >= 1330
Requires(pre):  group(nobody)
Requires(pre):  user(nobody)

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
Requires:       %{name} = %{version}-%{release}
Conflicts:      libheartbeat2 < 3.0.2
Obsoletes:      libheartbeat2 < 3.0.2

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

%package -n libglue-devel
Summary:        Headers and libraries for writing cluster managers
Group:          Development/Libraries/C and C++
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.

%setup -q
%patch1 -p1
%patch4 -p1
%patch5 -p1

export CFLAGS="${CFLAGS} %{optflags}"
export PYTHON="%{_bindir}/python3"
find . -type f -exec perl -pi -e 'BEGIN{undef $/};s[^#\!%{_bindir}/env perl][#\!%{_bindir}/perl]' {} \;
%configure \
    --disable-static \
    --enable-ipmilan=no \
    --enable-libnet=no \
    --disable-fatal-warnings \
    --with-package-name=%{name} \
    --with-daemon-group=%{gname} \
    --with-daemon-user=%{uname} \
    --with-systemdsystemunitdir=%{_unitdir} \
    --with-rundir=%{_rundir} \
make %{?_smp_mflags}

# Dont package static libs or compiled python
find %{buildroot} -type f "(" -name "*.la" -o -name "*.pyc" -o -name "*.pyo" ")" -delete -print
install -D -m 755 %{SOURCE3} %{buildroot}%{_sbindir}/hb_report
%if %{defined _unitdir}
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rclogd

getent group %{gname} >/dev/null || groupadd -r -g %{gid} %{gname} 
getent passwd %{uname} >/dev/null || useradd -r -u %{uid} -g %{gname} -d %{_localstatedir}/lib/heartbeat/cores/%{uname} -s /sbin/nologin -c "heartbeat processes" %{uname}
%service_add_pre logd.service

%service_add_post logd.service

%service_del_preun logd.service

%service_del_postun logd.service

%post -n libglue2 -p /sbin/ldconfig
%postun -n libglue2 -p /sbin/ldconfig

%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}
%doc logd/
%exclude %{_libdir}/stonith/plugins/stonith2/
%exclude %{_libdir}/stonith/plugins/stonith2/
%exclude %{_libdir}/stonith/plugins/external/ssh

%files -n libglue2

%files -n libglue-devel
%dir %{_libdir}/heartbeat
%dir %{_libdir}/heartbeat/plugins
%dir %{_libdir}/heartbeat/plugins/test
%dir %{_datadir}/%{name}
%exclude %{_includedir}/heartbeat/lrm

openSUSE Build Service is sponsored by