16b9421
Name:             radicale
d9d0148
Version:          1.1.1
b4241ee
Release:          1%{?dist}
16b9421
Summary:          A simple CalDAV (calendar) and CardDAV (contact) server
16b9421
Group:            Applications/Internet
16b9421
License:          GPLv3+
16b9421
URL:              http://radicale.org
16b9421
Source0:          http://pypi.python.org/packages/source/R/Radicale/Radicale-%{version}.tar.gz
16b9421
Source1:          %{name}-service-unit
16b9421
Source2:          %{name}-logrotate
16b9421
Source3:          %{name}-httpd
88f7379
Source4:          %{name}.te
88f7379
Source5:          %{name}.fc
88f7379
Source6:          %{name}.if
0b326c3
Source7:          %{name}-tmpfiles.conf
0f63bce
# Patch0: config adjustments for systemwide installation
36994a6
Patch0:           %{name}-0.10-systemwide.patch
0f63bce
# Patch1: https://github.com/Kozea/Radicale/issues/117#issuecomment-84588704
b4241ee
#Patch1:           %%{name}-0.10-fix_delete_entry.patch
16b9421
16b9421
BuildArch:        noarch
16b9421
BuildRequires:    python2-devel
16b9421
BuildRequires:    systemd
16b9421
Requires(pre):    shadow-utils
16b9421
Requires(post):   systemd
16b9421
Requires(preun):  systemd
16b9421
Requires(postun): systemd
16b9421
Requires:         python-pam
16b9421
Requires:         python-ldap
16b9421
16b9421
%description
16b9421
The Radicale Project is a CalDAV (calendar) and CardDAV (contact) server. It
16b9421
aims to be a light solution, easy to use, easy to install, easy to configure.
16b9421
As a consequence, it requires few software dependencies and is pre-configured
16b9421
to work out-of-the-box.
16b9421
16b9421
The Radicale Project runs on most of the UNIX-like platforms (Linux, BSD,
16b9421
MacOS X) and Windows. It is known to work with Evolution, Lightning, iPhone
16b9421
and Android clients. It is free and open-source software, released under GPL
16b9421
version 3.
16b9421
16b9421
For further information, please visit the Radicale Website
16b9421
http://www.radicale.org
16b9421
16b9421
%package httpd
16b9421
Summary:        httpd config for Radicale
16b9421
Requires:       %{name} = %{version}-%{release}
16b9421
Requires:       httpd
16b9421
Requires:       mod_wsgi
16b9421
16b9421
%description httpd
16b9421
httpd config for Radicale
16b9421
88f7379
%package selinux
88f7379
Summary:        Selinux policy for Radicale
88f7379
Requires:       %{name} = %{version}-%{release}
1ddee5c
# Hardcode _selinux_policy_version in F20 because of #999584
1ddee5c
%if 0%{?fedora} == 20
1ddee5c
%global _selinux_policy_version 3.12.1-90
1ddee5c
%else
88f7379
%{!?_selinux_policy_version: %global _selinux_policy_version %(sed -e 's,.*selinux-policy-\\([^/]*\\)/.*,\\1,' /usr/share/selinux/devel/policyhelp 2>/dev/null)}
1ddee5c
%endif
88f7379
%if "%{_selinux_policy_version}" != ""
88f7379
Requires:      selinux-policy >= %{_selinux_policy_version}
88f7379
%endif
fee2ec8
Requires(post):   /usr/sbin/semodule, /sbin/fixfiles, policycoreutils-python
fee2ec8
Requires(postun): /usr/sbin/semodule, /sbin/fixfiles, policycoreutils-python
88f7379
BuildRequires: checkpolicy, selinux-policy-devel, /usr/share/selinux/devel/policyhelp
88f7379
88f7379
%description selinux
88f7379
Selinux policy for Radicale
88f7379
88f7379
%global selinux_types %(%{__awk} '/^#[[:space:]]*SELINUXTYPE=/,/^[^#]/ { if ($3 == "-") printf "%s ", $2 }' /etc/selinux/config 2>/dev/null)
88f7379
%global selinux_variants %([ -z "%{selinux_types}" ] && echo mls targeted || echo %{selinux_types})
88f7379
16b9421
%prep
16b9421
%setup -q -n Radicale-%{version}
16b9421
%patch0 -p1
88f7379
mkdir SELinux
88f7379
cp -p %{SOURCE4} %{SOURCE5} %{SOURCE6} SELinux
16b9421
16b9421
%build
16b9421
%{__python} setup.py build
88f7379
cd SELinux
88f7379
for selinuxvariant in %{selinux_variants}
88f7379
do
88f7379
    make NAME=${selinuxvariant} -f /usr/share/selinux/devel/Makefile
88f7379
    mv %{name}.pp %{name}.pp.${selinuxvariant}
88f7379
    make NAME=${selinuxvariant} -f /usr/share/selinux/devel/Makefile clean
88f7379
done
88f7379
cd -
16b9421
16b9421
%install
16b9421
%{__python} setup.py install --skip-build --root %{buildroot}
16b9421
16b9421
# Install configuration files
16b9421
mkdir -p %{buildroot}%{_sysconfdir}/%{name}/
16b9421
install -p -m 640 config %{buildroot}%{_sysconfdir}/%{name}/
16b9421
install -p -m 644 logging %{buildroot}%{_sysconfdir}/%{name}/
16b9421
16b9421
# Install wsgi file
16b9421
mkdir -p %{buildroot}%{_datadir}/%{name}
16b9421
install -p -m 755 radicale.wsgi %{buildroot}%{_datadir}/%{name}/
16b9421
install -p -m 755 radicale.fcgi %{buildroot}%{_datadir}/%{name}/
16b9421
16b9421
# Install apache's configuration file
16b9421
mkdir -p %{buildroot}%{_sysconfdir}/httpd/conf.d/
16b9421
install -p -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/httpd/conf.d/%{name}.conf
16b9421
16b9421
# Create folder where the calendar will be stored
16b9421
mkdir -p  %{buildroot}%{_sharedstatedir}/%{name}/
16b9421
16b9421
install -D -p -m 644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service
16b9421
install -D -p -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
0b326c3
install -D -p -m 644 %{SOURCE7} %{buildroot}%{_tmpfilesdir}/%{name}.conf
0b326c3
mkdir -p %{buildroot}%{_localstatedir}/run
0b326c3
install -d -m 0755 %{buildroot}%{_localstatedir}/run/%{name}/
16b9421
16b9421
mkdir -p %{buildroot}%{_localstatedir}/log/%{name}
16b9421
touch %{buildroot}%{_localstatedir}/log/%{name}/%{name}.log
16b9421
88f7379
for selinuxvariant in %{selinux_variants}
88f7379
do
88f7379
    install -d %{buildroot}%{_datadir}/selinux/${selinuxvariant}
88f7379
    install -p -m 644 SELinux/%{name}.pp.${selinuxvariant} \
88f7379
        %{buildroot}%{_datadir}/selinux/${selinuxvariant}/%{name}.pp
88f7379
done
88f7379
16b9421
%pre
16b9421
getent group %{name} >/dev/null || groupadd -r %{name}
16b9421
getent passwd %{name} >/dev/null || \
16b9421
    useradd -r -g %{name} -d %{_sharedstatedir}/%{name} -s /sbin/nologin \
16b9421
    -c "Radicale service account" %{name}
16b9421
exit 0
16b9421
16b9421
%post
16b9421
%systemd_post %{name}.service
16b9421
16b9421
%preun
16b9421
%systemd_preun %{name}.service
16b9421
16b9421
%postun
16b9421
%systemd_postun_with_restart %{name}.service 
16b9421
88f7379
%post selinux
88f7379
for selinuxvariant in %{selinux_variants}
88f7379
do
88f7379
  /usr/sbin/semodule -s ${selinuxvariant} -i \
88f7379
    %{_datadir}/selinux/${selinuxvariant}/%{name}.pp &> /dev/null || :
88f7379
done
fee2ec8
# http://danwalsh.livejournal.com/10607.html
e2fc547
semanage port -a -t radicale_port_t -p tcp 5232 > /dev/null 2>&1 || :
f75af5e
/sbin/fixfiles -R %{name} restore > /dev/null 2>&1 || :
f75af5e
/sbin/fixfiles -R %{name}-httpd restore > /dev/null 2>&1 || :
88f7379
88f7379
%postun selinux
88f7379
if [ $1 -eq 0 ] ; then
e2fc547
  semanage port -d -p tcp 5232 > /dev/null 2>&1 || :
88f7379
  for selinuxvariant in %{selinux_variants}
88f7379
  do
88f7379
    /usr/sbin/semodule -s ${selinuxvariant} -r %{name} &> /dev/null || :
88f7379
  done
f75af5e
  /sbin/fixfiles -R %{name} restore > /dev/null 2>&1 || :
f75af5e
  /sbin/fixfiles -R %{name}-httpd restore > /dev/null 2>&1 || :
88f7379
fi
88f7379
88f7379
16b9421
%files
16b9421
%doc COPYING README NEWS.rst TODO.rst
16b9421
%dir %attr(0755, %{name}, %{name}) %{_sysconfdir}/%{name}/
16b9421
%config(noreplace) %attr(0640, %{name}, %{name}) %{_sysconfdir}/%{name}/config
16b9421
%config(noreplace) %attr(0644, %{name}, %{name}) %{_sysconfdir}/%{name}/logging
16b9421
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
16b9421
%{python_sitelib}/%{name}
16b9421
%{python_sitelib}/Radicale-*.egg-info
16b9421
%{_bindir}/%{name}
16b9421
%{_unitdir}/%{name}.service
0b326c3
%{_tmpfilesdir}/%{name}.conf
0b326c3
%dir %attr(755, %{name}, %{name}) %{_localstatedir}/run/%{name}
16b9421
%dir %attr(750, %{name}, %{name}) %{_localstatedir}/log/%{name}
16b9421
%ghost %attr(640, %{name}, %{name}) %{_localstatedir}/log/%{name}/%{name}.log
16b9421
%dir %attr(750, %{name}, %{name}) %{_sharedstatedir}/%{name}/
16b9421
%dir %{_datadir}/%{name}
16b9421
%{_datadir}/%{name}/%{name}.wsgi
16b9421
%{_datadir}/%{name}/%{name}.fcgi
16b9421
16b9421
%files httpd
16b9421
%config(noreplace) %{_sysconfdir}/httpd/conf.d/%{name}.conf
16b9421
88f7379
%files selinux
88f7379
%defattr(-,root,root,0755)
88f7379
%doc SELinux/*
88f7379
%{_datadir}/selinux/*/%{name}.pp
88f7379
16b9421
%changelog
d9d0148
* Fri Jan 08 2016 Juan Orti Alcaine <jorti@fedoraproject.org> - 1.1.1-1
d9d0148
- Update to 1.1.1 (#1296746)
d9d0148
b4241ee
* Fri Jan 01 2016 Juan Orti Alcaine <jorti@fedoraproject.org> - 1.1-1
b4241ee
- Version 1.1
b4241ee
0f63bce
* Mon Apr 06 2015 Juan Orti Alcaine <jorti@fedoraproject.org> - 0.10-3
0f63bce
- Add patch1 to fix rhbz#1206813
0f63bce
883620c
* Tue Feb 24 2015 Juan Orti Alcaine <jorti@fedoraproject.org> - 0.10-2
883620c
- Add radicale_var_run_t to SELinux policy 1.0.3
883620c
36994a6
* Tue Jan 13 2015 Juan Orti Alcaine <jorti@fedoraproject.org> - 0.10-1
36994a6
- Version 0.10
36994a6
e2fc547
* Mon Aug 18 2014 Juan Orti Alcaine <jorti@fedoraproject.org> - 0.9-2
e2fc547
- Hide error when re-adding SELinux port label.
e2fc547
7f477fe
* Thu Aug 14 2014 Juan Orti Alcaine <jorti@fedoraproject.org> - 0.9-1
7f477fe
- Version 0.9
7f477fe
- Automatically restart service if it dies.
7f477fe
- Update systemwide patch
7f477fe
0b326c3
* Mon Aug 04 2014 Juan Orti Alcaine <jorti@fedoraproject.org> - 0.8-11
0b326c3
- Handle PID file.
0b326c3
599aeb7
* Thu Jul 17 2014 Juan Orti Alcaine <jorti@fedoraproject.org> - 0.8-10
599aeb7
- Add network-online.target dependency. Bug #1119818
599aeb7
61fa7dc
* Sun Jun 08 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.8-9
61fa7dc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
61fa7dc
9a62e50
* Tue Apr 29 2014 Juan Orti Alcaine <jorti@fedoraproject.org> - 0.8-8
9a62e50
- Add PrivateDevices to unit file
9a62e50
fee2ec8
* Wed Dec 25 2013 Juan Orti Alcaine <jorti@fedoraproject.org> - 0.8-7
fee2ec8
- SELinux policy 1.0.2
fee2ec8
f75af5e
* Fri Nov 29 2013 Juan Orti Alcaine <jorti@fedoraproject.org> - 0.8-6
f75af5e
- SELinux policy 1.0.1 fix bug #1035925
f75af5e
1ddee5c
* Fri Nov 08 2013 Juan Orti Alcaine <jorti@fedoraproject.org> - 0.8-5
1ddee5c
- Hardcode _selinux_policy_version in F20 because of #999584
1ddee5c
597f8a4
* Thu Oct 03 2013 Juan Orti Alcaine <jorti@fedoraproject.org> - 0.8-4
88f7379
- Update httpd config file and add SELinux policy. Bug #1014408
597f8a4
16b9421
* Tue Aug 27 2013 Juan Orti Alcaine <jorti@fedoraproject.org> - 0.8-3
16b9421
- Move .wsgi and .fcgi to main package
16b9421
16b9421
* Sun Jul 21 2013 Juan Orti Alcaine <jorti@fedoraproject.org> - 0.8-2
16b9421
- BuildRequire python2-devel
16b9421
16b9421
* Thu Jul 18 2013 Juan Orti Alcaine <jorti@fedoraproject.org> - 0.8-1
16b9421
- Update to version 0.8
16b9421
- Merge Till Maas's spec file. Bug #922276
16b9421
16b9421
* Mon Jul 08 2013 Juan Orti Alcaine <jorti@fedoraproject.org> - 0.7.1-1
16b9421
- Initial packaging