- Proceed bit more with cleaning, the RH sections are failing to build

for couple of years. Better readability without them so prune it
  out
- Convert the in-spec build switches to %bcond
- Provide rcbla links to systemd services

OBS-URL: https://build.opensuse.org/package/show/systemsmanagement/cfengine?expand=0&rev=121
This commit is contained in:
Tomáš Chvátal 2015-03-18 14:27:40 +00:00 committed by Git OBS Bridge
parent 3d119a579c
commit 2122063ef5
2 changed files with 60 additions and 118 deletions

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Wed Mar 18 14:18:09 UTC 2015 - tchvatal@suse.com
- Proceed bit more with cleaning, the RH sections are failing to build
for couple of years. Better readability without them so prune it
out
- Convert the in-spec build switches to %bcond
- Provide rcbla links to systemd services
-------------------------------------------------------------------
Tue Mar 17 13:51:18 UTC 2015 - tchvatal@suse.com

View File

@ -16,10 +16,6 @@
#
# set to 1 to enable adapter, leave 0 for minimal cfengine
%define with_mysql 0
%define with_postgresql 0
%define with_libvirt 0
%define srcname core-%{version}
%define libname libpromises
%define libsoname %{libname}3
@ -32,6 +28,10 @@
%else
%define have_systemd 0
%endif
# pass --with-bla to enable the build
%bcond_with mysql
%bcond_with postgresql
%bcond_with libvirt
Name: cfengine
Version: 3.6.5
Release: 0
@ -68,6 +68,7 @@ Patch6: 0001-Set-sys.bindir-to-usr-sbin-expect-cf-components-ther.patch
Patch7: cfengine-fips.patch
BuildRequires: bison
BuildRequires: db-devel
BuildRequires: fdupes
BuildRequires: flex
BuildRequires: libacl-devel
BuildRequires: libtool
@ -78,10 +79,6 @@ BuildRequires: pam-devel
BuildRequires: pcre-devel
Requires: %{libsoname} = %{version}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
# wtf? SLE_11 does not honor rpmlintrc
%if 0%{?suse_version} <= 1130
BuildRequires: -post-build-checks
%endif
%if %{have_systemd}
Source7: cf-execd.service
Source8: cf-monitord.service
@ -91,39 +88,26 @@ Source7: cf-monitord
Source8: cf-execd
Source9: cf-serverd
%endif
#
# 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 %{with_mysql}
%if 0%{?suse_version} != 1110 && 0%{?rhel_version} == 0
%if %{with mysql}
BuildRequires: mysql-devel
%endif
%endif
%if %{with_libvirt}
%if %{with libvirt}
BuildRequires: libvirt-devel
%endif
%if %{with_postgresql}
%if %{with postgresql}
BuildRequires: postgresql-devel
%endif
%if !%{have_systemd}
# no systemd -> use cron
%if 0%{?centos_version} || 0%{?rhel_version}
Requires: vixie-cron
%else
Requires: cron
%endif
%endif
%if %{have_systemd}
BuildRequires: systemd
%{?systemd_requires}
%else
# Without systemd we require cron
Requires: cron
Requires(post): %insserv_prereq %fillup_prereq
%endif
%if 0%{?suse_version} > 01020
BuildRequires: fdupes
# FHS was a hit with sle11 so it dies out otherwise
%if 0%{?suse_version} <= 1110
BuildRequires: -post-build-checks
%endif
%description
@ -162,12 +146,6 @@ 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
@ -181,10 +159,7 @@ Lots of examples promises for CFEngine.
%prep
%setup -q -n %{srcname}
%if 0%{?suse_version} > 0 && 0%{?suse_version} <= 1110
%patch2 -p1
%endif
%if 0%{?rhel_version} >= 500 && 0%{?rhel_version} < 600
%if 0%{?suse_version} <= 1110
%patch2 -p1
%endif
%patch5 -p1
@ -202,21 +177,19 @@ install -d docs
cp -a $RPM_SOURCE_DIR/*pdf docs/
%build
autoreconf -fi -I m4
autoreconf -fvi -I m4
# /usr/include/sys for acl.h
CC=gcc CFLAGS="%{optflags} -fno-strict-aliasing" \
CC=cc CFLAGS="%{optflags} -fno-strict-aliasing" \
%configure \
--disable-static \
--enable-fhs \
--datadir=/var \
--with-workdir=%{workdir} \
%if %{with_postgresql}
%if %{with postgresql}
--with-postgresql \
%endif
%if %{with_mysql}
%if 0%{?suse_version} != 1110 && 0%{?rhel_version} == 0 && 0%{?fedora_version} != 20
%if %{with mysql}
--with-mysql \
%endif
%endif
--without-qdbm \
--without-tokyocabinet \
@ -224,16 +197,12 @@ CC=gcc CFLAGS="%{optflags} -fno-strict-aliasing" \
--with-pthreads \
--with-openssl \
--with-pcre \
%if %{with_libvirt}
%if %{with libvirt}
--with-libvirt \
%endif
--with-libacl \
--with-libxml2 \
%if 0%{?suse_version} >= 1110
--docdir=%{_docdir}/%{name}
%else if 0%{?rhel_version} >= 600
--docdir=%{_docdir}/%{name}-%{version}
%endif
make %{?_smp_mflags}
@ -241,25 +210,18 @@ make %{?_smp_mflags}
chmod -x ChangeLog
make "DESTDIR=%{buildroot}" install
%if 0%{?suse_version} >= 1110 || 0%{?rhel_version} >= 600
# will appear in cfengine-examples
rm -rf %{buildroot}/%{_docdir}/%{name}/examples
%endif
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,plugins}
#%%{__install} -d %{buildroot}/%%{basedir}/config/{development,production}
%if %{have_systemd}
# systemd: install sample cron file in docdir
%if 0%{?suse_version}
install -D -m0644 %{SOURCE10} %{buildroot}/%{_docdir}/%{name}
%else
install -D -m0644 %{SOURCE10} %{buildroot}/%{_docdir}/%{name}-%{version}
%endif
%else
# no systemd -> use cron
# install cron file
install -D -m0644 %{SOURCE10} %{buildroot}/%{_sysconfdir}/cron.d/%{name}
@ -270,6 +232,9 @@ install -D -m0644 %{SOURCE10} %{buildroot}/%{_sysconfdir}/cron.d/%{name}
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
ln -s -f service %{buildroot}/%{_sbindir}/rccf-monitord
ln -s -f service %{buildroot}/%{_sbindir}/rccf-execd
ln -s -f service %{buildroot}/%{_sbindir}/rccf-serverd
%else
# install init scripts
install -d %{buildroot}%{_sysconfdir}/init.d
@ -304,26 +269,25 @@ do
gzip %{buildroot}%{_mandir}/man8/$i.8
done
%if 0%{?suse_version} > 1010
# Firewall
install -D -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/cfengine
%endif
%if 0%{?suse_version} > 01020
# Ckeabyo dyoes
%fdupes %{buildroot}%{_datadir}/cfengine
%endif
# systemd
%if %{have_systemd}
####################################################################
# Systemd
####################################################################
%pre
%if %{have_systemd}
%service_add_pre cf-execd.service cf-monitord.service cf-serverd.service
%endif
%post
%if %{have_systemd}
%service_add_post cf-execd.service cf-monitord.service cf-serverd.service
%else
for i in execd monitord serverd; do
%fillup_and_insserv cf-${i}
done
%endif
/sbin/ldconfig
if [ $1 -lt 2 ]; then
# first install, generate key pair
@ -331,55 +295,29 @@ if [ $1 -lt 2 ]; then
fi
%preun
%if %{have_systemd}
%service_del_preun cf-execd.service cf-monitord.service cf-serverd.service
%else
for i in execd monitord serverd; do
%stop_on_removal cf-${i}
done
%endif
%postun
%if %{have_systemd}
%service_del_postun cf-execd.service cf-monitord.service cf-serverd.service
%else
%insserv_cleanup
for i in execd monitord serverd; do
%restart_on_update cf-${i}
done
%endif
if [ $1 -eq 0 ]; then
# clean up inputs cache dir on removal
rm -rf %{basedir}/inputs/*
fi
/sbin/ldconfig
%else # !systemd
####################################################################
# Non-systemd
####################################################################
%preun
%if 0%{?suse_version}
%stop_on_removal cf-monitord
%stop_on_removal cf-execd
%stop_on_removal cf-serverd
%else
%{_initddir}/cf-execd stop
%{_initddir}/cf-monitord stop
%{_initddir}/cf-serverd stop
%endif
%post -p /sbin/ldconfig
%postun
%if 0%{?suse_version} > 1010
%insserv_cleanup
for i in execd monitord serverd; do
%restart_on_update cf-${i}
done
%else
# Update ?
if [ ${1:-0} -eq 1 ]; then
for i in execd monitord serverd; do
%{_initddir}/cf-${i} restart
done
else
:
fi
%endif
/sbin/ldconfig
%endif # !systemd
%post -n %{libsoname} -p /sbin/ldconfig
%postun -n %{libsoname} -p /sbin/ldconfig
@ -402,20 +340,15 @@ fi
%{_unitdir}/cf-serverd.service
%else
%config %attr(0755,root,root) %{_initddir}/*
%endif
%{_sbindir}/rccf-execd
%{_sbindir}/rccf-monitord
%{_sbindir}/rccf-serverd
%endif
%if 0%{?suse_version} > 1010
%config %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/cfengine
%endif
%{_mandir}/man8/*
%dir %{basedir}
%dir %{workdir}
%{workdir}/*
%if !%{have_systemd}
%config(noreplace) %{_sysconfdir}/cron.d/%{name}
%endif