# # spec file for package cfengine # # 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/ # Name: cfengine %define libname libpromises %define libsoname %{libname}1 %define basedir /var/lib/%{name} %define workdir %{basedir}/work Summary: A Tool to Maintain Complicated Networks License: GPL-3.0 Group: Productivity/Networking/System Version: 3.2.3 Release: 0 Url: http://www.cfengine.org/ Source: %{name}-%{version}.tar.gz Source1: http://www.cfengine.org/manuals/cf3-Reference.pdf Source2: cf-monitord Source3: cf-execd Source4: cf-serverd Source10: %{name}.cron BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: bison BuildRequires: db-devel BuildRequires: flex BuildRequires: libtool BuildRequires: mysql-devel BuildRequires: openssl-devel BuildRequires: pcre-devel BuildRequires: postgresql-devel Requires: cron %if 0%{?suse_version} PreReq: %install_info_prereq BuildRequires: texlive %endif %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. %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 %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 BuildRequires: tetex BuildRequires: tetex-dvips BuildRequires: tetex-latex %endif %description doc Full documentation for cfengine %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. %prep %setup -q ##### 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|' {} \; ### 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/ %build %if 0%{?suse_version} %{suse_update_config -f} %endif #autoreconf -fi CC=gcc CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" \ %configure \ --disable-static \ --datadir=/var/lib \ --docdir=%{_docdir}/%{name} \ --with-workdir=%{workdir} %{__make} %{?_smp_mflags} # --datadir=/var/lib/%{name}/inputs \ %install %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,etc/init.d,%{workdir}/bin} # create dirs needed for better organizing dirs and files %{__install} -d %{buildroot}/%{basedir}/{backup,failsafe,config} #%{__install} -d %{buildroot}/%{basedir}/config/{development,production} # install missing AUTHORS LICENSE {S:1} %{__install} -m0644 AUTHORS LICENSE %{S:1} %{buildroot}/%{_docdir}/%{name}/ # install cron file %{__install} -D -m0644 %{S:10} %{buildroot}/%{_sysconfdir}/cron.d/%{name} # 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 # 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} # 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 %{__ln_s} -f ../../../../..%{_sbindir}/${i} %{buildroot}%{workdir}/bin/${i} done # mv all masterfiles/*.cf to masterfiles/*.cf.default pushd %{buildroot}%{basedir}/masterfiles for j in $(ls -1); do mv ${j} ${j}.default done ## 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 %stop_on_removal cf-monitord %stop_on_removal cf-execd %post %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 %postun %if 0%{?suse_version} %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 %endif %insserv_cleanup /sbin/ldconfig for i in execd monitord serverd; do %restart_on_update cf-${i} done %preun server %stop_on_removal cf-serverd %postun server %restart_on_update cf-serverd %post -n %{libsoname} -p /sbin/ldconfig %postun -n %{libsoname} -p /sbin/ldconfig %files %defattr(-,root,root) %{_docdir}/%{name}/LICENSE %exclude %{_docdir}/%{name}/AUTHORS %exclude %{_docdir}/%{name}/ChangeLog %exclude %{_docdir}/%{name}/README %exclude %{_docdir}/%{name}/example_config %exclude %{_docdir}/%{name}/examples /usr/sbin/* %exclude /usr/sbin/cf-serverd %exclude /usr/sbin/rccf-serverd %{_mandir}/man?/* %dir %{basedir} %{basedir} #%dir %{workdir} #%{workdir}/* %exclude %{basedir}/backup %exclude %{basedir}/config #%exclude %{basedir}/failsafe %exclude %{workdir}/bin/cf-serverd %config(noreplace) /etc/cron.d/%{name} %config %attr(0755,root,root) /etc/init.d/* %exclude /etc/init.d/cf-serverd %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 %files server %defattr(-,root,root) %{basedir}/backup %{basedir}/config /usr/sbin/cf-serverd /usr/sbin/rccf-serverd %{workdir}/bin/cf-serverd /etc/init.d/cf-serverd %changelog