File pykolab.spec of Package pykolab
#
# spec file for package pykolab
#
# Copyright (c) 2023 SUSE LLC
# Copyright (c) 2014-2018 Aeneas Jaissle <aj@ajaissle.de>
# Copyright (c) 2012 Kolab Systems AG, Zuerich, Switzerland.
#
# 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 https://bugs.opensuse.org/
#
%global kolab_user kolab
%global kolab_user_id 412
%global kolab_group kolab
%global kolab_group_id 412
%global kolabn_user kolab-n
%global kolabn_user_id 413
%global kolabn_group kolab-n
%global kolabn_group_id 413
%global kolabr_user kolab-r
%global kolabr_user_id 414
%global kolabr_group kolab-r
%global kolabr_group_id 414
%if 0%{?suse_version} <= 1310
%{!?_rundir: %global _rundir %{_localstatedir}/run/}
%endif
%if ! %{defined _fillupdir}
%define _fillupdir %{_localstatedir}/adm/fillup-templates
%endif
%global tmpfilesdir %{_libexecdir}/tmpfiles.d
%bcond_without tests
Name: pykolab
Version: 0.9~dev1.0b08de
Release: 0
Summary: Kolab Python Utilities
License: GPL-3.0-or-later
Group: Productivity/Networking/Other
URL: https://kolab.org/about/pykolab
# From http://cgit.kolab.org/pykolab/
Source0: http://cgit.kolab.org/pykolab/snapshot/%{name}-master.tar.gz
Source200: pykolab-rpmlintrc
# PATCH-FIX-UPSTREAM -- Guess $myhostname via 'hostname -f'
Patch1: pykolab-0.7.20-tpl_amavisd.patch
# PATCH-FIX-UPSTREAM -- Reset encoding in to default/utf-8
Patch9: pykolab-0.7.17-wallace_locale_encoding.patch
# PATCH-FIX-OPENSUSE -- Start kolab-saslauth with another --socket option
Patch11: pykolab-0.6.11-SUSE_sysconfig_saslauthd.patch
# PATCH-FIX-OPENSUSE -- Adjust paths to what SUSE uses
Patch12: pykolab-0.7.11-SUSE_template_amavisd.patch
# PATCH-FIX-OPENSUSE -- Workaround for sieve not working with tls, adjust certificate paths
Patch13: pykolab-0.9~dev1-SUSE_template_imapd.patch
# PATCH-FIX-OPENSUSE -- use 'vscan' user
Patch14: pykolab-0.8.23-SUSE_template_freshclam.patch
# PATCH-FIX-OPENSUSE -- Remove --socket from kolab-saslauthd's systemd unit
Patch15: pykolab-0.7.11_SUSE_fix_sasl2_socket.patch
# PATCH-FIX-OPENSUSE -- Don't use assets_dir and assets_path, disable secure urls
Patch16: pykolab-0.7.20-tpl_roundcube.patch
BuildArch: noarch
#BuildRequires: apache-rpm-macros
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: fdupes
#BuildRequires: gcc
#BuildRequires: gettext
BuildRequires: glib2-devel
BuildRequires: intltool
BuildRequires: python3
BuildRequires: python3-dateutil
BuildRequires: python3-icalendar
BuildRequires: python3-ldap
BuildRequires: python3-libkolab0
BuildRequires: python3-libkolabxml1
BuildRequires: python3-nose
BuildRequires: python3-pyasn1
BuildRequires: python3-pyasn1-modules
BuildRequires: python3-pytz
BuildRequires: python3-sievelib
BuildRequires: python3-sqlalchemy
BuildRequires: python3-tzlocal
BuildRequires: systemd
%{?systemd_requires}
Requires: kolab-cli = %{version}-%{release}
Requires: python3-ldap >= 2.4
Requires: python3-pyasn1
Requires: python3-pyasn1-modules
Requires: python3-sqlalchemy
Requires: python3-tzlocal
Requires(pre): %fillup_prereq
Requires(pre): %{_sbindir}/groupadd
Requires(pre): %{_sbindir}/useradd
Requires(pre): %{_sbindir}/usermod
%if %{with tests}
BuildRequires: python3-Twisted
%endif
%package telemetry
Summary: Kolab Telemetry Logging Capabilities
Group: Productivity/Networking/Other
Requires: kolab-cli = %{version}-%{release}
Requires: python3-sqlalchemy
%package xml
Summary: Kolab XML format wrapper for %{name}
Group: Productivity/Networking/Other
Requires: %{name} = %{version}-%{release}
Requires: python3-dateutil
Requires: python3-icalendar
Requires: python3-libkolab0
Requires: python3-libkolabxml1
%package -n kolab-cli
Summary: Kolab CLI components
Group: Productivity/Networking/Other
Requires: %{name} = %{version}-%{release}
Requires: python3-augeas
Requires: python3-Cheetah
Requires: python3-sievelib
%if 0%{?suse_version} >= 1120
Requires: augeas-lenses
%endif
%package -n kolab-saslauthd
Summary: Kolab SASL Authentication Daemon
Group: Productivity/Networking/Other
Requires: %{name} = %{version}-%{release}
Requires: cyrus-sasl
Requires: cyrus-sasl-plain
Requires: python3-sqlalchemy
%package -n kolab-server
Summary: Kolab Server implemented in Python
Group: Productivity/Networking/Other
Requires: %{name} = %{version}-%{release}
%package -n postfix-kolab
Summary: Kolab SMTP Access Policy for Postfix
Group: Productivity/Networking/Other
Requires: %{name} = %{version}-%{release}
Requires: postfix
Requires: python3-mysql
Requires: python3-sqlalchemy
%package -n wallace
Summary: Kolab Content-Filter
Group: Productivity/Networking/Other
Requires: %{name} = %{version}-%{release}
Requires: %{name}-xml = %{version}-%{release}
Requires: python3-dateutil
Requires: python3-gnupg
Requires: python3-icalendar >= 3.0
Requires: python3-mysql
Requires: python3-pytz
Requires: python3-sqlalchemy
%description
Kolab is a secure, scalable and reliable groupware server. It is formed by a
number of well-known and proven components and adds intelligent interaction between them.
This package contains various Kolab Utilities written in Python.
%description telemetry
Kolab is a secure, scalable and reliable groupware server. It is formed by a
number of well-known and proven components and adds intelligent interaction between them.
This package contains Cyrus IMAP Telemetry logging handling capabilities for Kolab Groupware.
%description xml
Kolab Format XML bindings wrapper for %{name}.
%description -n kolab-cli
Kolab is a secure, scalable and reliable groupware server. It is formed by a
number of well-known and proven components and adds intelligent interaction between them.
This package contains Kolab 3 CLI utilities.
%description -n kolab-saslauthd
Kolab is a secure, scalable and reliable groupware server. It is formed by a
number of well-known and proven components and adds intelligent interaction between them.
This package contains Kolab SASL Authentication Daemon for multi-domain, multi-authn database deployments.
%description -n kolab-server
Kolab is a secure, scalable and reliable groupware server. It is formed by a
number of well-known and proven components and adds intelligent interaction between them.
This package contains the Kolab 3 Server implemented in Python.
%description -n postfix-kolab
Kolab is a secure, scalable and reliable groupware server. It is formed by a
number of well-known and proven components and adds intelligent interaction between them.
This package contains the Kolab 3 SMTP Access Policy for Postfix
%description -n wallace
Kolab is a secure, scalable and reliable groupware server. It is formed by a
number of well-known and proven components and adds intelligent interaction between them.
This is the Kolab Content Filter, with plugins.
%prep
%setup -q -n %{name}-master
# Upstream patches
%patch1 -p1
# Patches fixing upstream to work on SUSE
#patch9 -p1
# SUSE-needed to fix something else
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
# imapd.conf.tpl: cyrus-imapd < 2.5 has no sieve date and index extensions
sed -i 's/ date index//' share/templates/imapd.conf.tpl
# imapd.conf.tpl: PLAIN goes to the end
sed -i 's/PLAIN LOGIN/LOGIN CRAM-MD5 DIGEST-MD5 PLAIN/' share/templates/imapd.conf.tpl
#python3
sed -i 's/AM_PATH_PYTHON/AM_PATH_PYTHON([3.0])/g' configure.ac
sed -i 's|#!/usr/bin/python|#!/usr/bin/python3|g' kolabd.py
sed -i 's|#!/usr/bin/python|#!/usr/bin/python3|g' saslauthd.py
sed -i 's|#!/usr/bin/python|#!/usr/bin/python3|g' conf.py
sed -i 's|#!/usr/bin/python|#!/usr/bin/python3|g' setup-kolab.py
sed -i 's|#!/usr/bin/python|#!/usr/bin/python3|g' wallace.py
sed -i 's|#!/usr/bin/python|#!/usr/bin/python3|g' kolab-cli.py
sed -i 's|#!/usr/bin/python|#!/usr/bin/python3|g' bin/kolab_parse_telemetry.py
sed -i 's|#!/usr/bin/python|#!/usr/bin/python3|g' bin/kolab_smtp_access_policy.py
%build
autoreconf -fi
%configure
%install
%make_install
install -d %{buildroot}%{_unitdir}
install -p -m 644 kolabd/kolabd.systemd %{buildroot}%{_unitdir}/kolabd.service
install -p -m 644 saslauthd/kolab-saslauthd.systemd %{buildroot}%{_unitdir}/kolab-saslauthd.service
install -p -m 644 wallace/wallace.systemd %{buildroot}%{_unitdir}/wallace.service
install -d %{buildroot}%{tmpfilesdir}
install -p -m 644 kolabd/kolabd.tmpfiles.d.conf %{buildroot}%{tmpfilesdir}/kolabd.conf
install -p -m 644 wallace/wallace.tmpfiles.d.conf %{buildroot}%{tmpfilesdir}/wallace.conf
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rckolabd
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rckolab-saslauthd
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcwallace
%global sysconfdir %{_fillupdir}
install -d %{buildroot}%{sysconfdir}
install -p -m 644 kolabd/kolabd.sysconfig %{buildroot}%{sysconfdir}/sysconfig.kolabd
install -p -m 644 saslauthd/kolab-saslauthd.sysconfig %{buildroot}%{sysconfdir}/sysconfig.kolab-saslauthd
install -p -m 644 wallace/wallace.sysconfig %{buildroot}%{sysconfdir}/sysconfig.wallace
%find_lang pykolab
# Rename setup-kolab kolab-setup
mv %{buildroot}%{_sbindir}/setup-kolab %{buildroot}%{_sbindir}/kolab-setup
# fdupes
%fdupes %{buildroot}%{python3_sitelib}/kolabd/
%fdupes %{buildroot}%{python3_sitelib}/pykolab/
%fdupes %{buildroot}%{python3_sitelib}/saslauthd/
%fdupes %{buildroot}%{python3_sitelib}/wallace/
%pre
# Add the kolab user and group accounts
getent group %{kolab_group} &>/dev/null || groupadd -r %{kolab_group} -g %{kolab_group_id} &>/dev/null
getent passwd %{kolab_user} &>/dev/null || \
useradd -r -u %{kolab_user_id} -g %{kolab_group} -d %{_localstatedir}/lib/%{kolab_user} -s /sbin/nologin \
-c "Kolab System Account" %{kolab_user} &>/dev/null || :
gpasswd -a %{apache_group} kolab >/dev/null 2>&1 || :
getent group %{kolabn_group} &>/dev/null || groupadd -r %{kolabn_group} -g %{kolabn_group_id} &>/dev/null
getent passwd %{kolabn_user} &>/dev/null || \
useradd -r -u %{kolabn_user_id} -g %{kolabn_group} -d %{_localstatedir}/lib/%{kolabn_user} -s /sbin/nologin \
-c "Kolab System Account (N)" %{kolabn_user} &>/dev/null || :
gpasswd -a %{kolabn_user} %{kolab_group} &>/dev/null || :
getent group %{kolabr_group} &>/dev/null || groupadd -r %{kolabr_group} -g %{kolabr_group_id} &>/dev/null
getent passwd %{kolabr_user} &>/dev/null || \
useradd -r -u %{kolabr_user_id} -g %{kolabr_group} -d %{_localstatedir}/lib/%{kolabr_user} -s /sbin/nologin \
-c "Kolab System Account (R)" %{kolabr_user} &>/dev/null || :
# Make sure our user has the correct home directory
if [ $1 -gt 1 ] ; then
usermod -d %{_localstatedir}/lib/%{kolab_user} %{kolab_user} &>/dev/null || :
usermod -d %{_localstatedir}/lib/%{kolab_user} %{kolabn_user} &>/dev/null || :
usermod -d %{_localstatedir}/lib/%{kolab_user} %{kolabr_user} &>/dev/null || :
fi
# Register systemd services on openSUSE
%service_add_pre kolabd.service kolab-saslauthd.service wallace.service
%pre -n kolab-saslauthd
%service_add_pre kolab-saslauthd.service
%post -n kolab-saslauthd
%{fillup_only -n kolab-saslauthd}
%service_add_post kolab-saslauthd.service
if ! grep '%{_localstatedir}/run/sasl2/mux' %{_sysconfdir}/sysconfig/kolab-saslauthd > /dev/null 2>&1; then
if grep '^FLAGS="--fork -l warning"$' %{_sysconfdir}/sysconfig/kolab-saslauthd > /dev/null 2>&1; then
echo "Updating %{_sysconfdir}/sysconfig/kolab-saslauthd"
echo " - Creating backup at %{_sysconfdir}/sysconfig/kolab-saslauthd.$(date --rfc-3339=date).bkp"
cp %{_sysconfdir}/sysconfig/kolab-saslauthd %{_sysconfdir}/sysconfig/kolab-saslauthd.$(date --rfc-3339=date).bkp
echo " - Adding '--socket %{_localstatedir}/run/sasl2/mux' option"
echo 'FLAGS="--fork -l warning --socket %{_localstatedir}/run/sasl2/mux"' >> %{_sysconfdir}/sysconfig/kolab-saslauthd
else
echo "Consider adding '--socket %{_localstatedir}/run/sasl2/mux' to %{_sysconfdir}/sysconfig/kolab-saslauthd if you run into login issues!"
fi
fi
exit 0
%preun -n kolab-saslauthd
%service_del_preun kolab-saslauthd.service
%postun -n kolab-saslauthd
%service_del_postun kolab-saslauthd.service
%pre -n kolab-server
%service_add_pre kolabd.service
%post -n kolab-server
systemd-tmpfiles --create %{tmpfilesdir}/kolabd.conf
%{fillup_only -n kolabd}
%service_add_post kolabd.service
%preun -n kolab-server
%service_del_preun kolabd.service
%postun -n kolab-server
%service_del_postun kolabd.service
%pre -n wallace
%service_add_pre wallace.service
%post -n wallace
systemd-tmpfiles --create %{tmpfilesdir}/wallace.conf
%{fillup_only -n wallace}
%service_add_post wallace.service
%preun -n wallace
%service_del_preun wallace.service
%postun -n wallace
%service_del_postun wallace.service
%if %{with tests}
%check
nosetests tests/unit/ ||:
%endif
%files -f pykolab.lang
%license COPYING
%doc AUTHORS README README.tests
%doc conf/kolab.conf
%attr(0640,kolab-n,kolab) %config(noreplace) %{_sysconfdir}/kolab/kolab.conf
%dir %{_sysconfdir}/kolab/
%{python3_sitelib}/pykolab/
%exclude %{python3_sitelib}/pykolab/telemetry.*
%exclude %{python3_sitelib}/pykolab/xml/
%exclude %{python3_sitelib}/pykolab/cli/
%exclude %{python3_sitelib}/pykolab/plugins/
%exclude %{python3_sitelib}/pykolab/setup/
%exclude %{python3_sitelib}/pykolab/wap_client/
%{python3_sitelib}/cyruslib.py
%attr(0775,kolab,kolab-n) %dir %{_localstatedir}/lib/kolab/
%attr(0775,kolab,kolab-n) %dir %{_localstatedir}/log/kolab/
# These locales are not available on SLES
%if 0%{?suse_version} <= 1220
%exclude %{_datadir}/locale/ach/
%exclude %{_datadir}/locale/af_ZA/
%exclude %{_datadir}/locale/ak/
%endif
%files telemetry
%license COPYING
%doc AUTHORS
%{_sbindir}/kolab_parse_telemetry
%{python3_sitelib}/pykolab/telemetry.py
%{python3_sitelib}/pykolab/cli/telemetry/
%files xml
%{python3_sitelib}/pykolab/xml/
%files -n kolab-cli
%{_sbindir}/kolab
%{_sbindir}/kolab-conf
%{_sbindir}/kolab-setup
%dir %{_sysconfdir}/kolab/
%dir %{_sysconfdir}/kolab/templates
%dir %{_datadir}/kolab/
%{_datadir}/kolab/templates
%{python3_sitelib}/pykolab/cli/
%exclude %{python3_sitelib}/pykolab/cli/telemetry/
%{python3_sitelib}/pykolab/plugins/
%{python3_sitelib}/pykolab/setup/
%{python3_sitelib}/pykolab/wap_client/
%files -n kolab-saslauthd
%license COPYING
%doc AUTHORS
%{sysconfdir}/sysconfig.kolab-saslauthd
%{_unitdir}/kolab-saslauthd.service
%{_sbindir}/kolab-saslauthd
%{_sbindir}/rckolab-saslauthd
%{python3_sitelib}/saslauthd/
%files -n kolab-server
%license COPYING
%doc AUTHORS
%{sysconfdir}/sysconfig.kolabd
%{_unitdir}/kolabd.service
%{tmpfilesdir}/kolabd.conf
%{_sbindir}/kolabd
%{_sbindir}/rckolabd
%{python3_sitelib}/kolabd/
%ghost %{_rundir}/kolabd
%files -n postfix-kolab
%license COPYING
%doc AUTHORS
%dir %{_libexecdir}/postfix/
%{_libexecdir}/postfix/kolab_smtp_access_policy
%files -n wallace
%license COPYING
%doc AUTHORS
%{sysconfdir}/sysconfig.wallace
%{_unitdir}/wallace.service
%{tmpfilesdir}/wallace.conf
%{_sbindir}/wallaced
%{_sbindir}/rcwallace
%{python3_sitelib}/wallace/
%attr(0700,%{kolab_user},%{kolab_group}) %dir %{_var}/spool/pykolab
%attr(0700,%{kolab_user},%{kolab_group}) %dir %{_var}/spool/pykolab/wallace
%ghost %{_rundir}/wallaced
%changelog