2007-01-16 00:06:50 +01:00
#
2011-10-06 17:21:12 +02:00
# spec file for package cfengine
2007-01-16 00:06:50 +01:00
#
2015-02-25 07:44:30 +01:00
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
2007-01-16 00:06:50 +01:00
#
2008-09-12 23:31:39 +02:00
# 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.
2007-01-16 00:06:50 +01:00
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
2015-03-18 15:27:40 +01:00
%define srcname core-%{version}
%define libname libpromises
%define libsoname %{libname}3
2012-10-08 15:04:19 +02:00
# Yes, its not FHS conformant but in sync with cfengine documentation
2012-12-14 09:31:14 +01:00
# reported upstream as https://cfengine.com/dev/issues/1896
2015-03-17 14:41:48 +01:00
%define basedir %{_localstatedir}/%{name}
2012-10-08 15:04:19 +02:00
%define workdir %{basedir}
2015-03-17 14:41:48 +01:00
%if 0%{?suse_version} >= 1210
%define have_systemd 1
%else
%define have_systemd 0
%endif
2015-03-18 15:27:40 +01:00
# pass --with-bla to enable the build
%bcond_with mysql
%bcond_with postgresql
%bcond_with libvirt
2015-03-17 14:41:48 +01:00
Name : cfengine
Version : 3.6.5
Release : 0
2014-02-21 01:13:10 +01:00
# This is the place where workdir should be
#define basedir /var/lib/%{name}
#define workdir %{basedir}/work
2012-10-04 10:52:41 +02:00
Summary : CFEngine automates large-scale IT computing infrastructure
2012-01-24 15:32:07 +01:00
License : GPL-3.0
2007-01-16 00:06:50 +01:00
Group : Productivity/Networking/System
2007-11-21 22:09:52 +01:00
Url : http://www.cfengine.org/
2014-05-30 09:50:42 +02:00
Source : %{srcname} .tar.gz
2014-04-03 15:11:06 +02:00
Source1 : %{name} .SuSEfirewall2
2012-01-30 20:10:38 +01:00
Source10 : %{name} .cron
2013-05-15 13:58:34 +02:00
Source11 : %{name} -rpmlintrc
2014-02-21 01:13:10 +01:00
# docs
Source101 : http://www.cfengine.org/manuals/cf3-Reference.pdf
Source102 : http://www.cfengine.org/manuals/cf3-conceptguide.pdf
Source103 : http://www.cfengine.org/manuals/cf3-glossary.pdf
Source104 : http://www.cfengine.org/manuals/cf3-quickstart.pdf
Source105 : http://www.cfengine.org/manuals/cf3-solutions.pdf
Source106 : http://www.cfengine.org/manuals/cf3-tutorial.pdf
Source107 : http://www.verticalsysadmin.com/cfengine/primer.pdf
# SLE 11 or RHEL5 autoconf does not support AM_SUBST_NOTMAKE, kkaempf@suse.de
Patch2 : remove-am_subst_notmake.patch
2014-04-10 16:31:27 +02:00
# PATCH-FIX-UPSTREAM add 'suse' class for consistency with other vendor classes
# PATCH-FEATURE-UPSTREAM better /etc/SuSE-release parsing, upstream #5423
2014-05-02 14:07:23 +02:00
# kkaempf@suse.de
2014-04-11 09:32:56 +02:00
Patch5 : 0001-Simplify-and-fix-parsing-of-etc-SuSE-release-fixes-i.patch
2014-05-02 14:07:23 +02:00
# PATCH-FIX-SUSE
# set cfengine's notion of bindir to /usr/sbin instead of /var/cfengine/bin
# kkaempf@suse.de
2014-10-09 09:24:21 +02:00
Patch6 : 0001-Set-sys.bindir-to-usr-sbin-expect-cf-components-ther.patch
2015-03-17 14:51:53 +01:00
# PATCH-FIX-UPSTREAM: Use ssl exponent of 65537 for FIPS bnc#922571
Patch7 : cfengine-fips.patch
2015-03-23 11:20:00 +01:00
Patch8 : 0001-Do-not-use-insecure-MD5-but-rather-SHA256.patch
2011-10-06 17:21:12 +02:00
BuildRequires : bison
BuildRequires : db-devel
BuildRequires : flex
2015-03-17 14:41:48 +01:00
BuildRequires : libacl-devel
2011-10-06 17:21:12 +02:00
BuildRequires : libtool
2012-10-05 14:21:25 +02:00
BuildRequires : libxml2-devel
2014-02-03 19:31:18 +01:00
BuildRequires : lmdb-devel
2015-03-17 14:41:48 +01:00
BuildRequires : openssl-devel
2014-02-03 19:31:18 +01:00
BuildRequires : pam-devel
2015-03-17 14:41:48 +01:00
BuildRequires : pcre-devel
2015-06-17 15:29:35 +02:00
# for testing
BuildRequires : fakeroot
2015-03-17 14:41:48 +01:00
Requires : %{libsoname} = %{version}
BuildRoot : %{_tmppath} /%{name} -%{version} -build
%if %{have_systemd}
Source7 : cf-execd.service
Source8 : cf-monitord.service
Source9 : cf-serverd.service
%else
Source7 : cf-monitord
Source8 : cf-execd
Source9 : cf-serverd
%endif
2015-03-18 15:27:40 +01:00
%if %{with mysql}
2011-10-06 17:21:12 +02:00
BuildRequires : mysql-devel
2012-10-05 14:43:48 +02:00
%endif
2015-03-18 15:27:40 +01:00
%if %{with libvirt}
2013-04-26 11:21:54 +02:00
BuildRequires : libvirt-devel
2014-07-03 15:41:44 +02:00
%endif
2015-03-18 15:27:40 +01:00
%if %{with postgresql}
2011-10-06 17:21:12 +02:00
BuildRequires : postgresql-devel
2014-07-03 15:41:44 +02:00
%endif
2015-03-17 14:41:48 +01:00
%if %{have_systemd}
2012-10-04 10:52:41 +02:00
BuildRequires : systemd
%{?systemd_requires}
2015-03-18 15:27:40 +01:00
%else
# Without systemd we require cron
Requires : cron
2015-06-17 15:29:35 +02:00
%if 0%{?suse_version}
2015-03-18 15:27:40 +01:00
Requires(post) : %insserv_prereq %fillup_prereq
2012-10-04 10:52:41 +02:00
%endif
2015-06-17 15:29:35 +02:00
%endif
2015-03-18 15:27:40 +01:00
# FHS was a hit with sle11 so it dies out otherwise
%if 0%{?suse_version} <= 1110
BuildRequires : -post-build-checks
2015-03-17 14:54:21 +01:00
%endif
2014-02-09 13:07:50 +01:00
2015-06-17 15:29:35 +02:00
%if 0%{?suse_version} > 1020
BuildRequires : fdupes
%endif
2007-01-16 00:06:50 +01:00
%description
2012-12-14 09:30:38 +01:00
CFEngine is the core of a configuration management system: ensuring
2012-10-04 10:52:41 +02:00
the availability, security and compliance of mission-critical
applications and services. Based on popular and flexible open source
configuration management software, CFEngine configuration management
products are highly scalable through decentralized, autonomous agents
that can continuously monitor, self-repair, and update the IT
infrastructure of a global multi-site enterprise - with negligible
impact on system resources or performance.
2007-01-16 00:06:50 +01:00
2011-10-06 17:21:12 +02:00
%package -n %{libsoname}
Summary : Shared library of cfengine
Group : System/Libraries
2014-03-19 19:23:19 +01:00
Provides : %{libname} 1 = %{version}
Obsoletes : %{libname} 1 < %{version}
2011-10-06 17:21:12 +02:00
%description -n %{libsoname}
This package contains the shared libpromises (cfengine) library.
2013-12-11 08:28:27 +01:00
%package -n %{libname}-devel
Summary : Development package for libpromises
2011-10-06 17:21:12 +02:00
Group : Development/Libraries/C and C++
Requires : %{libsoname} = %{version}
Requires : glibc-devel
2015-03-17 14:41:48 +01:00
Provides : %{name} -devel = %{version}
Obsoletes : %{name} -devel < %{version}
2007-01-16 00:06:50 +01:00
2013-12-11 08:28:27 +01:00
%description -n %{libname}-devel
2011-10-06 17:21:12 +02:00
A high-speed character set detection library
2015-03-17 14:41:48 +01:00
2011-10-06 17:21:12 +02:00
This package contains the files needed to compile programs that use the
2013-12-11 08:28:27 +01:00
libpromises library.
2011-10-06 17:21:12 +02:00
%package doc
2012-10-04 10:52:41 +02:00
Summary : CFEngine automates large-scale IT computing infrastructure - documentation
2014-02-04 08:10:43 +01:00
Group : Documentation/Other
2011-10-06 17:21:12 +02:00
%description doc
Full documentation for cfengine
2007-01-16 00:06:50 +01:00
2014-02-04 08:10:43 +01:00
%package examples
Summary : CFEngine example promises
Group : Documentation/Other
%description examples
Lots of examples promises for CFEngine.
2007-01-16 00:06:50 +01:00
%prep
2014-05-30 09:50:42 +02:00
%setup -q -n %{srcname}
2015-03-18 15:27:40 +01:00
%if 0%{?suse_version} <= 1110
2013-08-02 10:46:05 +02:00
%patch2 -p1
2013-07-09 09:37:13 +02:00
%endif
2014-04-04 22:08:15 +02:00
%patch5 -p1
2014-05-02 14:07:23 +02:00
%patch6 -p1
2015-03-17 14:51:53 +01:00
%patch7 -p1
2015-03-23 11:20:00 +01:00
%patch8 -p1
2013-08-02 10:46:05 +02:00
2011-10-06 17:21:12 +02:00
##### rpmlint
#### wrong-file-end-of-line-encoding
#### incorrect-fsf-address
### http://www.fsf.org/about/contact/
find ./examples -type f -name " * . c f " -exec perl -p -i -e 's|\r\n|\n|,s|^# Foundation.*|# Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA|' {} \;
2007-01-16 00:06:50 +01:00
2014-02-21 01:13:10 +01:00
### install extra docs
2015-03-17 14:41:48 +01:00
install -d docs
2014-02-21 01:13:10 +01:00
cp -a $RPM_SOURCE_DIR /*pdf docs/
2007-01-16 00:06:50 +01:00
%build
2015-03-18 15:27:40 +01:00
autoreconf -fvi -I m4
2013-07-09 09:37:13 +02:00
# /usr/include/sys for acl.h
2015-03-18 15:27:40 +01:00
CC=cc CFLAGS=" %{optflags} - f n o - s t r i c t - a l i a s i n g " \
2011-10-06 17:21:12 +02:00
%configure \
2012-01-24 15:32:07 +01:00
--disable-static \
2015-03-18 15:32:21 +01:00
--disable-silent-rules \
2012-10-05 14:21:25 +02:00
--enable-fhs \
2012-10-08 15:04:19 +02:00
--datadir=/var \
2013-07-09 09:37:13 +02:00
--with-workdir=%{workdir} \
2015-03-18 15:27:40 +01:00
%if %{with postgresql}
2013-07-09 09:37:13 +02:00
--with-postgresql \
2014-07-03 15:41:44 +02:00
%endif
2015-03-18 15:27:40 +01:00
%if %{with mysql}
2014-02-09 13:02:43 +01:00
--with-mysql \
2014-02-21 01:13:10 +01:00
%endif
2014-02-09 13:02:43 +01:00
--without-qdbm \
--without-tokyocabinet \
--with-lmdb \
2013-07-09 09:37:13 +02:00
--with-pthreads \
--with-openssl \
--with-pcre \
2015-03-18 15:27:40 +01:00
%if %{with libvirt}
2013-07-09 09:37:13 +02:00
--with-libvirt \
2014-07-03 15:41:44 +02:00
%endif
2013-07-09 09:37:13 +02:00
--with-libacl \
2013-08-02 10:46:05 +02:00
--with-libxml2 \
2015-03-18 15:32:21 +01:00
--docdir=%{_docdir} /%{name} \
--with-pam
2013-08-02 10:46:05 +02:00
2015-03-17 14:41:48 +01:00
make %{?_smp_mflags}
2007-01-16 00:06:50 +01:00
2015-03-18 15:33:46 +01:00
%check
# FAIL: process_test
make check %{?_smp_mflags} || :
2007-01-16 00:06:50 +01:00
%install
2012-12-14 09:30:38 +01:00
chmod -x ChangeLog
2015-03-17 14:41:48 +01:00
make " D E S T D I R = %{buildroot} " install
2014-03-19 19:23:19 +01:00
# will appear in cfengine-examples
rm -rf %{buildroot} /%{_docdir} /%{name} /examples
2015-03-17 14:41:48 +01:00
install -d %{buildroot} /{usr/sbin,%{workdir} /{bin,inputs,reports}}
2011-10-06 17:21:12 +02:00
2012-01-30 20:10:38 +01:00
# create dirs needed for better organizing dirs and files
2015-03-17 14:41:48 +01:00
install -d %{buildroot} /%{basedir} /{backup,failsafe,config,plugins}
2012-01-30 20:10:38 +01:00
2015-03-17 14:41:48 +01:00
%if %{have_systemd}
2014-07-03 15:41:44 +02:00
# systemd: install sample cron file in docdir
2015-03-17 14:41:48 +01:00
install -D -m0644 %{SOURCE10} %{buildroot} /%{_docdir} /%{name}
2014-07-03 15:41:44 +02:00
%else
# no systemd -> use cron
2012-01-30 20:10:38 +01:00
# install cron file
2015-03-17 14:41:48 +01:00
install -D -m0644 %{SOURCE10} %{buildroot} /%{_sysconfdir} /cron.d/%{name}
2014-07-03 15:41:44 +02:00
%endif
2012-01-30 20:10:38 +01:00
2015-03-17 14:41:48 +01:00
%if %{have_systemd}
2012-10-04 10:52:41 +02:00
# install systemd scripts
2015-03-17 14:41:48 +01:00
install -D -m 0644 %{SOURCE7} %{buildroot} /%{_unitdir} /cf-execd.service
install -D -m 0644 %{SOURCE8} %{buildroot} /%{_unitdir} /cf-monitord.service
install -D -m 0644 %{SOURCE9} %{buildroot} /%{_unitdir} /cf-serverd.service
2015-03-18 15:27:40 +01:00
ln -s -f service %{buildroot} /%{_sbindir} /rccf-monitord
ln -s -f service %{buildroot} /%{_sbindir} /rccf-execd
ln -s -f service %{buildroot} /%{_sbindir} /rccf-serverd
2012-10-04 10:52:41 +02:00
%else
2011-10-06 17:21:12 +02:00
# install init scripts
2015-06-17 15:29:35 +02:00
install -d %{buildroot} %{_initddir}
2015-03-17 14:41:48 +01:00
install -m 0755 %{SOURCE7} %{SOURCE8} %{SOURCE9} %{buildroot} %{_initddir} /
ln -s -f ../..%{_initddir} /cf-monitord %{buildroot} /%{_sbindir} /rccf-monitord
ln -s -f ../..%{_initddir} /cf-execd %{buildroot} /%{_sbindir} /rccf-execd
ln -s -f ../..%{_initddir} /cf-serverd %{buildroot} /%{_sbindir} /rccf-serverd
2012-01-30 20:10:38 +01:00
# sed @workdir@ in initscripts/cron.d
sed -i\
-e " s , @ w o r k d i r @ , %{workdir} , g " \
-e " s , @ b a s e d i r @ , %{basedir} , g " \
2015-03-17 14:41:48 +01:00
%{buildroot} %{_initddir} /cf-* %{buildroot} %{_sysconfdir} /cron.d/%{name}
2012-10-04 10:52:41 +02:00
%endif
2012-01-24 15:32:07 +01:00
# create symlinks for sbin_PROGRAMS
2012-10-08 15:04:19 +02:00
# because: cf-promises needs to be installed in /var/cfengine/work/bin for pre-validation of full configuration
2014-04-04 21:37:14 +02:00
for i in cf-agent cf-execd cf-key cf-monitord cf-promises cf-runagent cf-serverd cf-upgrade; do
2015-03-17 14:41:48 +01:00
ln -s -f ../../..%{_sbindir} /${i} %{buildroot} %{workdir} /bin/${i}
2012-10-08 15:04:19 +02:00
done
2012-10-05 14:21:25 +02:00
rm -rf %{buildroot} /%{_libdir} /%{name} /libpromises.la
2011-10-06 17:21:12 +02:00
2012-12-14 09:30:38 +01:00
# will appear in %%docdir
2012-10-05 14:21:25 +02:00
rm -rf %{buildroot} /%{_datadir} /%{name} /ChangeLog
rm -rf %{buildroot} /%{_datadir} /%{name} /README
2014-03-19 19:23:19 +01:00
# create man pages, see https://cfengine.com/dev/issues/2989
2015-03-17 14:41:48 +01:00
install -d %{buildroot} /%{_mandir} /man8
2014-03-19 19:23:19 +01:00
for i in cf-agent cf-execd cf-key cf-monitord cf-promises cf-runagent cf-serverd
do
LD_LIBRARY_PATH=%{buildroot} %{_libdir} /%{name} %{buildroot} %{_sbindir} /$i -M > %{buildroot} %{_mandir} /man8/$i.8
gzip %{buildroot} %{_mandir} /man8/$i.8
done
2015-03-18 15:27:40 +01:00
# Firewall
2015-03-17 14:41:48 +01:00
install -D -m 644 %{SOURCE1} %{buildroot} %{_sysconfdir} /sysconfig/SuSEfirewall2.d/services/cfengine
2014-04-03 15:11:06 +02:00
2015-03-18 15:27:40 +01:00
# Ckeabyo dyoes
2015-06-17 15:29:35 +02:00
%if 0%{?suse_version} > 1020
2015-03-17 14:41:48 +01:00
%fdupes %{buildroot} %{_datadir} /cfengine
2015-06-17 15:29:35 +02:00
%endif
2014-04-04 21:37:14 +02:00
2012-10-04 10:52:41 +02:00
%pre
2015-03-18 15:27:40 +01:00
%if %{have_systemd}
2014-04-04 21:37:14 +02:00
%service_add_pre cf-execd.service cf-monitord.service cf-serverd.service
2015-03-18 15:27:40 +01:00
%endif
2012-10-04 10:52:41 +02:00
%post
2015-03-18 15:27:40 +01:00
%if %{have_systemd}
2014-04-04 21:37:14 +02:00
%service_add_post cf-execd.service cf-monitord.service cf-serverd.service
2015-03-18 15:27:40 +01:00
%else
for i in execd monitord serverd; do
%fillup_and_insserv cf-${i}
done
%endif
2012-10-04 10:52:41 +02:00
/sbin/ldconfig
2013-04-26 11:21:54 +02:00
if [ $1 -lt 2 ]; then
2014-04-04 21:37:14 +02:00
# first install, generate key pair
2013-04-16 12:12:34 +02:00
cf-key
2013-04-26 11:21:54 +02:00
fi
2012-10-04 10:52:41 +02:00
%preun
2015-03-18 15:27:40 +01:00
%if %{have_systemd}
2014-04-04 21:37:14 +02:00
%service_del_preun cf-execd.service cf-monitord.service cf-serverd.service
2015-03-18 15:27:40 +01:00
%else
for i in execd monitord serverd; do
%stop_on_removal cf-${i}
done
%endif
2012-10-04 10:52:41 +02:00
%postun
2015-03-18 15:27:40 +01:00
%if %{have_systemd}
2014-04-04 21:37:14 +02:00
%service_del_postun cf-execd.service cf-monitord.service cf-serverd.service
2015-03-18 15:27:40 +01:00
%else
%insserv_cleanup
for i in execd monitord serverd; do
%restart_on_update cf-${i}
done
%endif
2014-04-04 21:37:14 +02:00
if [ $1 -eq 0 ]; then
# clean up inputs cache dir on removal
rm -rf %{basedir} /inputs/*
fi
2012-10-04 10:52:41 +02:00
/sbin/ldconfig
2011-10-06 17:21:12 +02:00
%post -n %{libsoname} -p /sbin/ldconfig
%postun -n %{libsoname} -p /sbin/ldconfig
2007-11-21 22:09:52 +01:00
2007-01-16 00:06:50 +01:00
%files
%defattr (-,root,root)
2014-02-21 01:13:10 +01:00
%doc ChangeLog LICENSE README.md
2012-10-05 14:21:25 +02:00
%{_sbindir} /cf-agent
%{_sbindir} /cf-execd
%{_sbindir} /cf-key
%{_sbindir} /cf-monitord
%{_sbindir} /cf-promises
2014-04-04 21:37:14 +02:00
%{_sbindir} /cf-serverd
2014-02-03 19:31:18 +01:00
%{_sbindir} /cf-upgrade
2014-04-10 16:31:27 +02:00
%{_sbindir} /cf-runagent
2012-11-29 09:18:22 +01:00
%{_sbindir} /rpmvercmp
2015-03-17 14:41:48 +01:00
%if %{have_systemd}
%{_unitdir} /cf-execd.service
%{_unitdir} /cf-monitord.service
%{_unitdir} /cf-serverd.service
2012-10-04 10:52:41 +02:00
%else
2015-03-17 14:41:48 +01:00
%config %attr (0755,root,root) %{_initddir} /*
2015-03-18 15:27:40 +01:00
%endif
2012-10-05 14:43:48 +02:00
%{_sbindir} /rccf-execd
%{_sbindir} /rccf-monitord
2014-04-04 21:37:14 +02:00
%{_sbindir} /rccf-serverd
%config %{_sysconfdir} /sysconfig/SuSEfirewall2.d/services/cfengine
2014-03-19 19:23:19 +01:00
%{_mandir} /man8/*
2012-01-30 20:10:38 +01:00
%dir %{basedir}
2012-10-08 15:04:19 +02:00
%dir %{workdir}
%{workdir} /*
2015-03-17 14:41:48 +01:00
%if !%{have_systemd}
%config (noreplace) %{_sysconfdir} /cron.d/%{name}
2014-07-03 15:41:44 +02:00
%endif
2011-10-06 17:21:12 +02:00
%files -n %{libsoname}
%defattr (-,root,root)
2012-10-05 14:21:25 +02:00
%dir %{_libdir} /%{name}
%{_libdir} /%{name} /%{libname} .so.*
2011-10-06 17:21:12 +02:00
2013-12-11 08:28:27 +01:00
%files -n %{libname}-devel
2011-10-06 17:21:12 +02:00
%defattr (-,root,root)
2012-10-05 14:21:25 +02:00
%{_libdir} /%{name} /%{libname} .so
2011-10-06 17:21:12 +02:00
%files doc
%defattr (-,root,root)
2014-02-21 01:13:10 +01:00
%doc docs/*.pdf
2014-02-04 08:10:43 +01:00
%files examples
%defattr (-,root,root)
2014-02-21 01:13:10 +01:00
%doc examples/*cf
2007-11-26 20:28:30 +01:00
2007-04-01 12:04:29 +02:00
%changelog