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
#
2012-01-24 15:32:07 +01:00
# Copyright (c) 2012 SUSE LINUX Products 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/
#
2012-02-08 13:40:10 +01:00
2007-01-16 00:06:50 +01:00
Name : cfengine
2011-10-06 17:21:12 +02:00
%define libname libpromises
%define libsoname %{libname}1
2012-01-30 20:10:38 +01:00
%define basedir /var/lib/%{name}
%define workdir %{basedir}/work
2011-10-06 17:21:12 +02:00
Summary : A Tool to Maintain Complicated Networks
2012-01-24 15:32:07 +01:00
License : GPL-3.0
2007-01-16 00:06:50 +01:00
Group : Productivity/Networking/System
2012-01-24 15:32:07 +01:00
Version : 3.2.3
Release : 0
2007-11-21 22:09:52 +01:00
Url : http://www.cfengine.org/
2011-10-06 17:21:12 +02:00
Source : %{name} -%{version} .tar.gz
Source1 : http://www.cfengine.org/manuals/cf3-Reference.pdf
2009-12-16 17:43:19 +01:00
Source2 : cf-monitord
Source3 : cf-execd
Source4 : cf-serverd
2012-01-30 20:10:38 +01:00
Source10 : %{name} .cron
2007-01-16 00:06:50 +01:00
BuildRoot : %{_tmppath} /%{name} -%{version} -build
2011-10-06 17:21:12 +02:00
BuildRequires : bison
BuildRequires : db-devel
BuildRequires : flex
BuildRequires : libtool
BuildRequires : mysql-devel
BuildRequires : openssl-devel
BuildRequires : pcre-devel
BuildRequires : postgresql-devel
2012-02-07 13:27:12 +01:00
%if 0%{?centos_version} || 0%{?rhel_version}
Requires : vixie-cron
%else
2012-01-30 20:10:38 +01:00
Requires : cron
2012-02-07 13:27:12 +01:00
%endif
2011-10-06 17:21:12 +02:00
%if 0%{?suse_version}
2008-09-12 23:31:39 +02:00
PreReq : %install_info_prereq
2011-10-06 17:21:12 +02:00
BuildRequires : texlive
%endif
2007-01-16 00:06:50 +01:00
%description
GNU cfengine is an abstract programming language for system
administrators of huge heterogeneous networks. With cfengine, system
administrators have an easy and elegant way to maintain complicated
networks.
2011-10-06 17:21:12 +02:00
%package -n %{libsoname}
Summary : Shared library of cfengine
Group : System/Libraries
%description -n %{libsoname}
This package contains the shared libpromises (cfengine) library.
%package devel
Summary : Development package for cfengine
Group : Development/Libraries/C and C++
Requires : %{libsoname} = %{version}
Requires : glibc-devel
2007-01-16 00:06:50 +01:00
2011-10-06 17:21:12 +02:00
%description devel
A high-speed character set detection library
This package contains the files needed to compile programs that use the
libguess library.
%package doc
Summary : A Tool to Maintain Complicated Networks (docs)
Group : Productivity/Networking/System
%if 0%{?rhel_version} || 0%{?centos_version}
BuildRequires : texinfo
2012-01-24 15:32:07 +01:00
BuildRequires : tetex
BuildRequires : tetex-dvips
BuildRequires : tetex-latex
2011-10-06 17:21:12 +02:00
%endif
%description doc
Full documentation for cfengine
2007-01-16 00:06:50 +01:00
2012-01-24 15:32:07 +01:00
%package server
Summary : Files needed for cfengine server
Group : Productivity/Networking/System
Requires : %{name} = %{version} -%{release}
%description server
This package contains the files of the cfengine server.
2007-01-16 00:06:50 +01:00
%prep
%setup -q
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
2012-01-24 15:32:07 +01:00
### FIXME
# there are 3 different cfengine_stdlib.cf
## as of 3.2.3
# ./examples/cfengine_stdlib.cf - Rev: 95
# ./examples/example_config/cfengine_stdlib.cf - Rev: 61
# ./masterfiles/cfengine_stdlib.cf - Rev: 84
%{__cp} -a ./examples/cfengine_stdlib.cf ./examples/example_config/
%{__cp} -a ./examples/cfengine_stdlib.cf ./masterfiles/
2007-01-16 00:06:50 +01:00
%build
2011-10-06 17:21:12 +02:00
%if 0%{?suse_version}
2007-01-16 00:06:50 +01:00
%{suse_update_config -f}
2011-10-06 17:21:12 +02:00
%endif
#autoreconf -fi
CC=gcc CFLAGS=" $RPM_OPT_FLAGS - f n o - s t r i c t - a l i a s i n g " \
%configure \
2012-01-24 15:32:07 +01:00
--disable-static \
--datadir=/var/lib \
--docdir=%{_docdir} /%{name} \
--with-workdir=%{workdir}
2011-10-06 17:21:12 +02:00
%{__make} %{?_smp_mflags}
# --datadir=/var/lib/%{name}/inputs \
2007-01-16 00:06:50 +01:00
%install
2011-10-06 17:21:12 +02:00
%if 0%{?rhel_version} || 0%{?centos_version} || 0%{?fedora_version}
[ -d %{buildroot} ] && [ " %{buildroot} " != " / " ] && %{__rm} -rf %{buildroot}
%endif
%{__make} " D E S T D I R = %{buildroot} " install
2012-01-24 15:32:07 +01:00
%{__install} -d %{buildroot} /{usr/sbin,etc/init.d,%{workdir} /bin}
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
%{__install} -d %{buildroot} /%{basedir} /{backup,failsafe,config}
#%{__install} -d %{buildroot}/%{basedir}/config/{development,production}
2011-10-06 17:21:12 +02:00
# install missing AUTHORS LICENSE {S:1}
%{__install} -m0644 AUTHORS LICENSE %{S:1} %{buildroot} /%{_docdir} /%{name} /
2012-01-30 20:10:38 +01:00
# install cron file
%{__install} -D -m0644 %{S:10} %{buildroot} /%{_sysconfdir} /cron.d/%{name}
2011-10-06 17:21:12 +02:00
# install init scripts
%{__install} -m 0755 %{S:2} %{S:3} %{S:4} %{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
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 " \
%{buildroot} /etc/init.d/cf-* %{buildroot} /etc/cron.d/%{name}
2012-01-24 15:32:07 +01:00
# create symlinks for sbin_PROGRAMS
for i in cf-agent cf-execd cf-key cf-know cf-monitord cf-promises cf-report cf-runagent cf-serverd; do
2012-01-30 20:10:38 +01:00
%{__ln_s} -f ../../../../..%{_sbindir} /${i} %{buildroot} %{workdir} /bin/${i}
2012-01-24 15:32:07 +01:00
done
# mv all masterfiles/*.cf to masterfiles/*.cf.default
2012-01-30 20:10:38 +01:00
pushd %{buildroot} %{basedir} /masterfiles
2012-01-24 15:32:07 +01:00
for j in $(ls -1); do
mv ${j} ${j}.default
done
2011-10-06 17:21:12 +02:00
## FIXME: what is the purpose of theses libs ?
## are they really needed ?
#rm -rf %{buildroot}/%{_libdir}/libpromises.la
#{__rm} -rf %{buildroot}/%{_libdir}/libpromises.a
%preun
2012-02-08 13:40:10 +01:00
%if 0%{?suse_version}
2011-10-06 17:21:12 +02:00
%stop_on_removal cf-monitord
%stop_on_removal cf-execd
2012-02-08 13:40:10 +01:00
%else
/etc/init.d/cf-execd stop
/etc/init.d/cf-monitord stop
%endif
2007-01-16 00:06:50 +01:00
2008-09-12 23:31:39 +02:00
%post
2011-10-06 17:21:12 +02:00
%if 0%{?suse_version}
%if 0%{?suse_version} > 1010
%install _info --name=%{name} --info-dir=%{_infodir} %{_infodir}/cf3-reference.info.gz
%else
:
%endif
%else
%install _info --info-dir=%{_infodir} %{_infodir}/cf3-reference.info.gz
%endif
/sbin/ldconfig
2008-09-12 23:31:39 +02:00
2007-01-16 00:06:50 +01:00
%postun
2011-10-06 17:21:12 +02:00
%if 0%{?suse_version}
2012-02-08 13:40:10 +01:00
%insserv_cleanup
for i in execd monitord; do
%restart_on_update cf-${i}
done
2011-10-06 17:21:12 +02:00
%if 0%{?suse_version} > 1010
%install _info_delete --name=%{name} --info-dir=%{_infodir} %{_infodir}/cf3-reference.info.gz
%else
:
%endif
%else
%install _info_delete --info-dir=%{_infodir} %{_infodir}/cf3-reference.info.gz
2012-02-08 13:40:10 +01:00
for i in execd monitord; do
/etc/init.d/cf-${i} restart
done
2011-10-06 17:21:12 +02:00
%endif
/sbin/ldconfig
2007-01-16 00:06:50 +01:00
2012-01-24 15:32:07 +01:00
%preun server
2012-02-08 13:40:10 +01:00
%if 0%{?suse_version}
2012-01-24 15:32:07 +01:00
%stop_on_removal cf-serverd
2012-02-08 13:40:10 +01:00
%else
/etc/init.d/cf-serverd stop
%endif
2012-01-24 15:32:07 +01:00
%postun server
2012-02-08 13:40:10 +01:00
%if 0%{?suse_version}
2012-01-24 15:32:07 +01:00
%restart_on_update cf-serverd
2012-02-08 13:40:10 +01:00
%else
/etc/init.d/cf-serverd restart
%endif
2012-01-24 15:32:07 +01:00
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)
2011-10-06 17:21:12 +02:00
%{_docdir} /%{name} /LICENSE
%exclude %{_docdir} /%{name} /AUTHORS
%exclude %{_docdir} /%{name} /ChangeLog
%exclude %{_docdir} /%{name} /README
%exclude %{_docdir} /%{name} /example_config
%exclude %{_docdir} /%{name} /examples
2007-01-16 00:06:50 +01:00
/usr/sbin/*
2012-01-24 15:32:07 +01:00
%exclude /usr/sbin/cf-serverd
%exclude /usr/sbin/rccf-serverd
2008-09-12 23:31:39 +02:00
%{_mandir} /man?/*
2012-01-30 20:10:38 +01:00
%dir %{basedir}
%{basedir}
#%dir %{workdir}
#%{workdir}/*
%exclude %{basedir} /backup
%exclude %{basedir} /config
#%exclude %{basedir}/failsafe
2012-01-24 15:32:07 +01:00
%exclude %{workdir} /bin/cf-serverd
2012-01-30 20:10:38 +01:00
%config (noreplace) /etc/cron.d/%{name}
2011-10-06 17:21:12 +02:00
%config %attr (0755,root,root) /etc/init.d/*
2012-01-24 15:32:07 +01:00
%exclude /etc/init.d/cf-serverd
2011-10-06 17:21:12 +02:00
%files -n %{libsoname}
%defattr (-,root,root)
%{_libdir} /%{libname} .la
%{_libdir} /%{libname} .so.*
%files devel
%defattr (-,root,root)
%{_libdir} /%{libname} .so
%files doc
%defattr (-,root,root)
%{_docdir} /%{name}
%exclude %{_docdir} /%{name} /LICENSE
2007-11-26 20:28:30 +01:00
2012-01-24 15:32:07 +01:00
%files server
%defattr (-,root,root)
2012-01-30 20:10:38 +01:00
%{basedir} /backup
%{basedir} /config
2012-01-24 15:32:07 +01:00
/usr/sbin/cf-serverd
/usr/sbin/rccf-serverd
%{workdir} /bin/cf-serverd
/etc/init.d/cf-serverd
2007-04-01 12:04:29 +02:00
%changelog