cfengine/cfengine.spec

468 lines
13 KiB
RPMSpec
Raw Normal View History

#
# spec file for package cfengine
#
# Copyright (c) 2014 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/
#
Name: cfengine
%define srcname %{name}
%define libname libpromises
%define libsoname %{libname}3
# Yes, its not FHS conformant but in sync with cfengine documentation
# reported upstream as https://cfengine.com/dev/issues/1896
%define basedir /var/%{name}
%define workdir %{basedir}
Summary: CFEngine automates large-scale IT computing infrastructure
License: GPL-3.0
Group: Productivity/Networking/System
Version: 3.6.0b1
Release: 0
Url: http://www.cfengine.org/
- Update to 3.5.0 - Alpha 1 New Features: - Enable zeroconf-discovery of policy hubs for automatic bootstrapping if Avahi is present - Support for sys.cpus on more platforms than Linux & HPUX Changes: - Make parser output in GCC compatible format the only supported format (remove --gcc-brief-format flag) - Silence license warnings in Enterprise Free25 installations Bugfixes: - Allocate memory dynamically to avoid out-of-buffer or out-of-hash situations - fix edit_xml update of existing attributes (Redmine #2034) - use failsafe policy from compile-time specified workdir (Redmine #1991) - Update to 3.4.2 (Bugfix and Stability release) Bugfixes: - Fixes to policies in masterfiles (see masterfiles/Changelog for details) - Fixes for OpenBSD (GitHub #278) - Do not canonify values specified in abortbundleclasses/abortclasses (Redmine #1786) - Fix build issues on NetBSD, SLES 12.2 - Improve error message when libxml2 support is not compiled (Redmine #1799) - fix potential segmentation fault when trimming network socket data (GitHub #233) - fix potential segmentation fault when address-lookups in lastseen db failed (GitHub #233) - execute background promise serially when max_children was reached, rather than skipping them (GitHub #233) - fix segmentation fault in cf-promises when invoked with --reports (Redmine #1931) - fix compilation with Sun Studio 12 (Redmine #1901) - silence type-pun warning when building on HP-UX (GitHub #287) OBS-URL: https://build.opensuse.org/package/show/systemsmanagement/cfengine?expand=0&rev=37
2013-02-01 21:37:49 +01:00
Source: %{name}-%{version}.tar.gz
# there's no /usr/include/acl.h in SUSE or Fedora, kkaempf@suse.de
Patch1: libacl-headers.patch
# SLE 11 or RHEL5 autoconf does not support AM_SUBST_NOTMAKE, kkaempf@suse.de
Patch2: remove-am_subst_notmake.patch
Source1: http://www.cfengine.org/manuals/cf3-Reference.pdf
Source2: http://www.cfengine.org/manuals/cf3-conceptguide.pdf
Source3: http://www.cfengine.org/manuals/cf3-glossary.pdf
Source4: http://www.cfengine.org/manuals/cf3-quickstart.pdf
Source5: http://www.cfengine.org/manuals/cf3-solutions.pdf
Source6: http://www.cfengine.org/manuals/cf3-tutorial.pdf
# wtf? SLE_11 does not honor rpmlintrc
%if 0%{?suse_version} <= 1130
BuildRequires: -post-build-checks
%endif
%if 0%{?suse_version} >= 1210
Source7: cf-execd.service
Source8: cf-monitord.service
Source9: cf-serverd.service
%else
Source7: cf-monitord
Source8: cf-execd
Source9: cf-serverd
%endif
Source10: %{name}.cron
Source11: %{name}-rpmlintrc
Source12: masterfiles-%{version}.tar.gz
Source13: http://www.verticalsysadmin.com/cfengine/primer.pdf
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: bison
BuildRequires: db-devel
BuildRequires: flex
BuildRequires: libtool
BuildRequires: libxml2-devel
BuildRequires: lmdb-devel
BuildRequires: pam-devel
#
# Disable mysql for SLE_11:
#
# configure: error: MySQL client library exports symbols clashing with
# OpenSSL. Get the update from distribution provider, recompile MySQL
# library or disable MySQL connector. See
# http://bugs.mysql.com/bug.php?id=65055 for details.
#
%if 0%{?suse_version} != 1110
BuildRequires: mysql-devel
%endif
BuildRequires: libacl-devel
BuildRequires: libvirt-devel
BuildRequires: openssl-devel
BuildRequires: pcre-devel
BuildRequires: postgresql-devel
%if 0%{?centos_version} || 0%{?rhel_version}
Requires: vixie-cron
%else
Requires: cron
%endif
%if 0%{?suse_version}
PreReq: %install_info_prereq
BuildRequires: texlive
%endif
%if 0%{?suse_version} >= 1210
BuildRequires: systemd
%{?systemd_requires}
%endif
%if 0%{?suse_version} > 01020
BuildRequires: fdupes
%endif
%description
CFEngine is the core of a configuration management system: ensuring
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.
%package -n %{libsoname}
Summary: Shared library of cfengine
Group: System/Libraries
Provides: %{libname}1
Obsoletes: %{libname}1
%if 0%{?suse_version} == 1010
Requires: glibc
%endif
%description -n %{libsoname}
This package contains the shared libpromises (cfengine) library.
%package -n %{libname}-devel
Summary: Development package for libpromises
Group: Development/Libraries/C and C++
Provides: %{name}-devel < %{version}
Obsoletes: %{name}-devel < %{version}
Requires: %{libsoname} = %{version}
Requires: glibc-devel
%description -n %{libname}-devel
A high-speed character set detection library
This package contains the files needed to compile programs that use the
libpromises library.
%package doc
Summary: CFEngine automates large-scale IT computing infrastructure - documentation
Group: Documentation/Other
%if 0%{?rhel_version} || 0%{?centos_version}
BuildRequires: tetex
BuildRequires: tetex-dvips
BuildRequires: tetex-latex
BuildRequires: texinfo
%endif
%description doc
Full documentation for cfengine
%package examples
Summary: CFEngine example promises
Group: Documentation/Other
%description examples
Lots of examples promises for CFEngine.
%package server
Summary: CFEngine automates large-scale IT computing infrastructure - server
Group: Productivity/Networking/System
Requires: %{name} = %{version}-%{release}
%description server
This package contains the files of the cfengine server.
%prep
%setup -q -n %{srcname}-%{version}
%if 0%{?suse_version} || 0%{?fedora_version} || 0%{?rhel_version}
%patch1 -p1
%endif
%if 0%{?suse_version} > 0 && 0%{?suse_version} <= 1110
%patch2 -p1
%endif
%if 0%{?rhel_version} >= 500 && 0%{?rhel_version} < 600
%patch2 -p1
%endif
##### rpmlint
#### wrong-file-end-of-line-encoding
#### incorrect-fsf-address
### http://www.fsf.org/about/contact/
find ./examples -type f -name "*.cf" -exec perl -p -i -e 's|\r\n|\n|,s|^# Foundation.*|# Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA|' {} \;
%build
autoreconf -fi
# /usr/include/sys for acl.h
CC=gcc CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" \
%configure \
--disable-static \
--enable-fhs \
--datadir=/var \
--with-workdir=%{workdir} \
--with-postgresql \
--with-mysql \
--without-qdbm \
--without-tokyocabinet \
--with-lmdb \
--with-pthreads \
--with-openssl \
--with-pcre \
--with-libvirt \
--with-libacl \
--with-libxml2 \
%if 0%{?suse_version} >= 1110 || 0%{?rhel_version} >= 600
--docdir=%{_docdir}/%{name}
%endif
# SLE 10 and RHEL5 don't recognize --docdir
%{__make} %{?_smp_mflags}
# --datadir=/var/lib/%%{name}/inputs \
%install
chmod -x ChangeLog
%if 0%{?rhel_version} || 0%{?centos_version} || 0%{?fedora_version}
[ -d %{buildroot} ] && [ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
%endif
%{__make} "DESTDIR=%{buildroot}" install
%{__install} -d %{buildroot}/{usr/sbin,%{workdir}/{bin,inputs,reports}}
# create dirs needed for better organizing dirs and files
%{__install} -d %{buildroot}/%{basedir}/{backup,failsafe,config}
#%%{__install} -d %{buildroot}/%%{basedir}/config/{development,production}
# install cron file
%{__install} -D -m0644 %{S:10} %{buildroot}/%{_sysconfdir}/cron.d/%{name}
%if 0%{?suse_version} >= 1210
# install systemd scripts
%{__install} -D -m 0644 %{S:7} %{buildroot}/%_unitdir/cf-execd.service
%{__install} -D -m 0644 %{S:8} %{buildroot}/%_unitdir/cf-monitord.service
%{__install} -D -m 0644 %{S:9} %{buildroot}/%_unitdir/cf-serverd.service
%else
# install init scripts
%{__install} -d %{buildroot}/etc/init.d
%{__install} -m 0755 %{S:7} %{S:8} %{S:9} %{buildroot}/etc/init.d/
%{__ln_s} -f ../../etc/init.d/cf-monitord %{buildroot}/%{_sbindir}/rccf-monitord
%{__ln_s} -f ../../etc/init.d/cf-execd %{buildroot}/%{_sbindir}/rccf-execd
%{__ln_s} -f ../../etc/init.d/cf-serverd %{buildroot}/%{_sbindir}/rccf-serverd
# sed @workdir@ in initscripts/cron.d
sed -i\
-e "s,@workdir@,%{workdir},g"\
-e "s,@basedir@,%{basedir},g" \
%{buildroot}/etc/init.d/cf-* %{buildroot}/etc/cron.d/%{name}
%endif
# install docs
%{__install} -d %{buildroot}/%{_docdir}/%{name}
%{__install} -m 0644 %{S:1} %{S:2} %{S:3} %{S:4} %{S:5} %{S:6} %{buildroot}/%{_docdir}/%{name}
# create symlinks for sbin_PROGRAMS
# because: cf-promises needs to be installed in /var/cfengine/work/bin for pre-validation of full configuration
for i in cf-agent cf-execd cf-key cf-monitord cf-promises cf-runagent cf-serverd; do
%{__ln_s} -f ../../..%{_sbindir}/${i} %{buildroot}%{workdir}/bin/${i}
done
# Install masterfiles (as %%config(noreplace) )
%{__install} -d %{buildroot}/%{basedir}/masterfiles
tar xf %{S:12}
cd masterfiles-%{version}
make install DESTDIR=%{buildroot}/%{basedir}/masterfiles
# %{__install} -m 0644 masterfiles/def.cf %{buildroot}/%{basedir}/masterfiles
# %{__install} -m 0644 masterfiles/promises.cf %{buildroot}/%{basedir}/masterfiles
# %{__install} -m 0644 masterfiles/libraries/cfengine_stdlib.cf %{buildroot}/%{basedir}/masterfiles
rm -rf %{buildroot}/%{_libdir}/%{name}/libpromises.la
# will appear in %%docdir
rm -rf %{buildroot}/%{_datadir}/%{name}/ChangeLog
rm -rf %{buildroot}/%{_datadir}/%{name}/README
%if 0%{?suse_version} > 01020
%fdupes %{buildroot}/usr/share/cfengine
%endif
# systemd
%if 0%{?suse_version} >= 1210
%pre
%service_add_pre cf-execd.service cf-monitord.service
%post
%service_add_post cf-execd.service cf-monitord.service
%if 0%{?suse_version} > 1010
%install_info --name=%{name} --info-dir=%{_infodir} %{_infodir}/cf3-reference.info.gz
%endif
/sbin/ldconfig
if [ $1 -lt 2 ]; then
cf-key
fi
%preun
%service_del_preun cf-execd.service cf-monitord.service
%postun
%service_del_postun cf-execd.service cf-monitord.service
%if 0%{?suse_version} > 1010
%install_info_delete --name=%{name} --info-dir=%{_infodir} %{_infodir}/cf3-reference.info.gz
%endif
/sbin/ldconfig
%pre server
%service_add_pre cf-serverd.service
%post server
#if [ ${1:-0} -ne 1 ]; then
# cp -a /usr/share/cfengine/CoreBase/controls /var/cfengine/inputs
# cp -a /usr/share/cfengine/CoreBase/libraries /var/cfengine/inputs
# cp -a /usr/share/cfengine/CoreBase/services /var/cfengine/inputs
#fi
%service_add_post cf-serverd.service
%preun server
%service_del_preun cf-serverd.service
%postun server
%service_del_postun cf-serverd.service
%else # !systemd
%preun
%if 0%{?suse_version}
%stop_on_removal cf-monitord
%stop_on_removal cf-execd
%else
/etc/init.d/cf-execd stop
/etc/init.d/cf-monitord stop
%endif
%post
%if 0%{?suse_version} > 1010
%install_info --name=%{name} --info-dir=%{_infodir} %{_infodir}/cf3-reference.info.gz
%endif
/sbin/ldconfig
%postun
%if 0%{?suse_version} > 1010
%install_info_delete --name=%{name} --info-dir=%{_infodir} %{_infodir}/cf3-reference.info.gz
%insserv_cleanup
for i in execd monitord; do
%restart_on_update cf-${i}
done
%else
# Update ?
if [ ${1:-0} -eq 1 ]; then
for i in execd monitord; do
/etc/init.d/cf-${i} restart
done
else
:
fi
%endif
/sbin/ldconfig
%preun server
%if 0%{?suse_version}
%stop_on_removal cf-serverd
%else
/etc/init.d/cf-serverd stop
%endif
%postun server
%if 0%{?suse_version}
%restart_on_update cf-serverd
%else
# Update ?
if [ ${1:-0} -eq 1 ]; then
/etc/init.d/cf-serverd restart
else
:
fi
%endif
%endif # !systemd
%post -n %{libsoname} -p /sbin/ldconfig
%postun -n %{libsoname} -p /sbin/ldconfig
%files
%defattr(-,root,root)
%doc LICENSE
# %doc README
%doc ChangeLog
%exclude %{_docdir}/%{name}/examples
%exclude %{_docdir}/%{name}/*.pdf
%{_sbindir}/cf-agent
%{_sbindir}/cf-execd
%{_sbindir}/cf-key
%{_sbindir}/cf-monitord
%{_sbindir}/cf-promises
%{_sbindir}/cf-runagent
%{_sbindir}/cf-upgrade
%{_sbindir}/rpmvercmp
%if 0%{?suse_version} >= 1210
%_unitdir/cf-execd.service
%_unitdir/cf-monitord.service
%else
%exclude /etc/init.d/cf-serverd
%config %attr(0755,root,root) /etc/init.d/*
%{_sbindir}/rccf-execd
%{_sbindir}/rccf-monitord
%endif
# %{_mandir}/man?/*
%dir %{basedir}
/var/%{name}
%exclude %{basedir}/backup
%exclude %{basedir}/config
#%%exclude %%{basedir}/failsafe
# %dir %{_datadir}/%{name}
# %{_datadir}/%{name}/*
%dir %{workdir}
%{workdir}/*
%exclude %{workdir}/bin/cf-serverd
%config(noreplace) /etc/cron.d/%{name}
%dir %{basedir}/masterfiles
%config(noreplace) %{basedir}/masterfiles/*.cf
%files -n %{libsoname}
%defattr(-,root,root)
%dir %{_libdir}/%{name}
%{_libdir}/%{name}/%{libname}.so.*
%files -n %{libname}-devel
%defattr(-,root,root)
%{_libdir}/%{name}/%{libname}.so
%files doc
%defattr(-,root,root)
%doc %{_docdir}/%{name}/*.pdf
%exclude %{_docdir}/%{name}/examples
%files examples
%defattr(-,root,root)
%dir %{_docdir}/%{name}/examples
%doc %{_docdir}/%{name}/examples
%files server
%defattr(-,root,root)
%{basedir}/backup
%{basedir}/config
%{_sbindir}/cf-serverd
%{workdir}/bin/cf-serverd
%if 0%{?suse_version} >= 1210
%_unitdir/cf-serverd.service
%else
/etc/init.d/cf-serverd
%{_sbindir}/rccf-serverd
%endif
%changelog