18d1e53
%global selinux_types %(%{__awk} '/^#[[:space:]]*SELINUXTYPE=/,/^[^#]/ { if ($3 == "-") printf "%s ", $2 }' /etc/selinux/config 2>/dev/null)
18d1e53
%global selinux_variants %([ -z "%{selinux_types}" ] && echo mls targeted || echo %{selinux_types})
18d1e53
16b9421
Name:             radicale
5587217
Version:          1.1.6
972573c
Release:          2%{?dist}
16b9421
Summary:          A simple CalDAV (calendar) and CardDAV (contact) server
16b9421
License:          GPLv3+
16b9421
URL:              http://radicale.org
6df3aad
Source0:          https://github.com/Kozea/Radicale/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
c432147
Source1:          %{name}.service
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
c432147
Source8:          %{name}-httpd-python2
0f63bce
# Patch0: config adjustments for systemwide installation
36994a6
Patch0:           %{name}-0.10-systemwide.patch
16b9421
16b9421
BuildArch:        noarch
71eb10f
BuildRequires:    python3-devel
8c1b00b
BuildRequires:    python3-setuptools
8c1b00b
BuildRequires:    python2-devel
c432147
BuildRequires:    python2-setuptools
16b9421
BuildRequires:    systemd
18d1e53
BuildRequires:    checkpolicy
18d1e53
BuildRequires:    selinux-policy-devel
8c1b00b
BuildRequires:    hardlink
c432147
c432147
Requires:         python3-%{name} = %{version}-%{release}
c432147
Requires(pre):    shadow-utils
c432147
%{?systemd_requires}
c432147
Requires:         %{name} = %{version}-%{release}
18d1e53
%if "%{_selinux_policy_version}" != ""
18d1e53
Requires:         selinux-policy >= %{_selinux_policy_version}
18d1e53
%endif
8c1b00b
Requires(post):   /usr/sbin/semodule
c432147
Requires(post):   /usr/sbin/fixfiles
5328bb0
Requires(post):   /usr/sbin/restorecon
8c1b00b
%if 0%{?rhel} || 0%{?fedora} < 23
8c1b00b
Requires(post):   policycoreutils-python
8c1b00b
%else
8c1b00b
Requires(post):   policycoreutils-python-utils
8c1b00b
%endif
8c1b00b
Requires(postun): /usr/sbin/semodule
c432147
Requires(postun): /usr/sbin/fixfiles
5328bb0
Requires(postun): /usr/sbin/restorecon
8c1b00b
%if 0%{?rhel} || 0%{?fedora} < 23
8c1b00b
Requires(postun): policycoreutils-python
8c1b00b
%else
8c1b00b
Requires(postun): policycoreutils-python-utils
8c1b00b
%endif
18d1e53
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
c432147
%package -n python3-%{name}
c432147
Summary:          A simple CalDAV (calendar) and CardDAV (contact) server
c432147
Recommends:       python3-pam
c432147
%{?python_provide:%python_provide python3-%{name}}
c432147
c432147
%description -n python3-%{name}
c432147
The Radicale Project is a CalDAV (calendar) and CardDAV (contact) server. It
c432147
aims to be a light solution, easy to use, easy to install, easy to configure.
c432147
As a consequence, it requires few software dependencies and is pre-configured
c432147
to work out-of-the-box.
c432147
c432147
The Radicale Project runs on most of the UNIX-like platforms (Linux, BSD,
c432147
MacOS X) and Windows. It is known to work with Evolution, Lightning, iPhone
c432147
and Android clients. It is free and open-source software, released under GPL
c432147
version 3.
c432147
c432147
%package -n python2-%{name}
c432147
Summary:          A simple CalDAV (calendar) and CardDAV (contact) server
c432147
Recommends:       python-pam
c432147
Recommends:       python-ldap
c432147
%{?python_provide:%python_provide python2-%{name}}
c432147
c432147
%description -n python2-%{name}
c432147
The Radicale Project is a CalDAV (calendar) and CardDAV (contact) server. It
c432147
aims to be a light solution, easy to use, easy to install, easy to configure.
c432147
As a consequence, it requires few software dependencies and is pre-configured
c432147
to work out-of-the-box.
c432147
c432147
The Radicale Project runs on most of the UNIX-like platforms (Linux, BSD,
c432147
MacOS X) and Windows. It is known to work with Evolution, Lightning, iPhone
c432147
and Android clients. It is free and open-source software, released under GPL
c432147
version 3.
16b9421
16b9421
%package httpd
16b9421
Summary:        httpd config for Radicale
16b9421
Requires:       %{name} = %{version}-%{release}
16b9421
Requires:       httpd
a072a02
Requires:       python3-mod_wsgi
16b9421
16b9421
%description httpd
c432147
httpd example config for Radicale (Python3).
c432147
c432147
%package httpd-python2
c432147
Summary:        httpd config for Radicale
c432147
Requires:       %{name} = %{version}-%{release}
c432147
Requires:       python2-%{name} = %{version}-%{release}
c432147
Requires:       httpd
c432147
Requires:       mod_wsgi
16b9421
c432147
%description httpd-python2
c432147
httpd example config for Radicale (Python2).
88f7379
16b9421
%prep
18d1e53
%autosetup -n Radicale-%{version}
88f7379
mkdir SELinux
88f7379
cp -p %{SOURCE4} %{SOURCE5} %{SOURCE6} SELinux
c432147
cp -p radicale.wsgi radicale-python2.wsgi
c432147
cp -p radicale.fcgi radicale-python2.fcgi
a072a02
sed -i 's|^#!/usr/bin/env python$|#!/usr/bin/env python3|' radicale.wsgi
a072a02
sed -i 's|^#!/usr/bin/env python$|#!/usr/bin/env python3|' radicale.fcgi
18d1e53
16b9421
%build
c432147
%py2_build
18d1e53
%py3_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
c432147
# %%py3_install first to get python3 version of /usr/bin/radicale
18d1e53
%py3_install
c432147
%py2_install
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}
c432147
install -p -m 755 radicale-python2.wsgi %{buildroot}%{_datadir}/%{name}/
c432147
install -p -m 755 radicale-python2.fcgi %{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
c432147
install -p -m 644 %{SOURCE8} %{buildroot}%{_sysconfdir}/httpd/conf.d/%{name}-python2.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}/
c432147
touch %{buildroot}%{_localstatedir}/run/%{name}/radicale.pid
16b9421
16b9421
mkdir -p %{buildroot}%{_localstatedir}/log/%{name}
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
8c1b00b
/usr/sbin/hardlink -cv %{buildroot}%{_datadir}/selinux
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
c432147
for selinuxvariant in %{selinux_variants}
c432147
do
c432147
  /usr/sbin/semodule -s ${selinuxvariant} -i \
c432147
    %{_datadir}/selinux/${selinuxvariant}/%{name}.pp &> /dev/null || :
c432147
done
c432147
# http://danwalsh.livejournal.com/10607.html
5328bb0
semanage port -a -t radicale_port_t -p tcp 5232 &> /dev/null || :
5328bb0
/usr/sbin/fixfiles -R %{name} restore &> /dev/null || :
5328bb0
/usr/sbin/fixfiles -R %{name}-httpd restore &> /dev/null || :
5328bb0
/usr/sbin/fixfiles -R %{name}-httpd-python2 restore &> /dev/null || :
5328bb0
/usr/sbin/restorecon -R %{_localstatedir}/log/%{name} &> /dev/null || :
88f7379
18d1e53
%preun
18d1e53
%systemd_preun %{name}.service
18d1e53
18d1e53
%postun
18d1e53
%systemd_postun_with_restart %{name}.service 
88f7379
if [ $1 -eq 0 ] ; then
5328bb0
  semanage port -d -p tcp 5232 &> /dev/null || :
88f7379
  for selinuxvariant in %{selinux_variants}
88f7379
  do
88f7379
    /usr/sbin/semodule -s ${selinuxvariant} -r %{name} &> /dev/null || :
88f7379
  done
5328bb0
  /usr/sbin/restorecon -R %{_localstatedir}/log/%{name} &> /dev/null || :
88f7379
fi
88f7379
16b9421
%files
eb3f223
%doc README README.rst NEWS.rst TODO.rst
c432147
%doc SELinux/*
16b9421
%{_bindir}/%{name}
c432147
%dir %{_sysconfdir}/%{name}/
c432147
%config(noreplace) %attr(0640, root, %{name}) %{_sysconfdir}/%{name}/config
c432147
%config(noreplace) %{_sysconfdir}/%{name}/logging
c432147
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
16b9421
%{_unitdir}/%{name}.service
0b326c3
%{_tmpfilesdir}/%{name}.conf
16b9421
%dir %attr(750, %{name}, %{name}) %{_localstatedir}/log/%{name}
16b9421
%dir %attr(750, %{name}, %{name}) %{_sharedstatedir}/%{name}/
16b9421
%dir %{_datadir}/%{name}
c432147
%dir %attr(755, %{name}, %{name}) %{_localstatedir}/run/%{name}
c432147
%ghost %{_localstatedir}/run/%{name}/radicale.pid
18d1e53
%{_datadir}/selinux/*/%{name}.pp
16b9421
c432147
%files -n python3-%{name}
c432147
%license COPYING
c432147
%{python3_sitelib}/%{name}
c432147
%{python3_sitelib}/Radicale-*.egg-info
c432147
c432147
%files -n python2-%{name}
c432147
%license COPYING
c432147
%{python2_sitelib}/%{name}
c432147
%{python2_sitelib}/Radicale-*.egg-info
c432147
16b9421
%files httpd
c432147
%{_datadir}/%{name}/%{name}.wsgi
c432147
%{_datadir}/%{name}/%{name}.fcgi
16b9421
%config(noreplace) %{_sysconfdir}/httpd/conf.d/%{name}.conf
16b9421
c432147
%files httpd-python2
c432147
%{_datadir}/%{name}/%{name}-python2.wsgi
c432147
%{_datadir}/%{name}/%{name}-python2.fcgi
c432147
%config(noreplace) %{_sysconfdir}/httpd/conf.d/%{name}-python2.conf
c432147
16b9421
%changelog
972573c
* Tue Nov 21 2017 Juan Orti Alcaine <jorti@fedoraproject.org> - 1.1.6-2
972573c
- SELinux rule to allow connection to POP port
972573c
5587217
* Mon Jul 24 2017 Juan Orti Alcaine <jorti@fedoraproject.org> - 1.1.6-1
5587217
- Version 1.1.6
5587217
a134b2b
* Fri Jun 30 2017 Juan Orti Alcaine <jorti@fedoraproject.org> - 1.1.2-2
a134b2b
- Remove PrivateDevices=true (RHBZ#1452328)
a134b2b
- Update SELinux policy
a134b2b
6df3aad
* Fri May 05 2017 Juan Orti Alcaine <jorti@fedoraproject.org> - 1.1.2-1
6df3aad
- Version 1.1.2
6df3aad
- Security fix for CVE-2017-8342
6df3aad
a998054
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.1-11
a998054
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
a998054
b314235
* Mon Dec 19 2016 Miro HronĨok <mhroncok@redhat.com> - 1.1.1-10
b314235
- Rebuild for Python 3.6
b314235
089cc0d
* Fri Dec 09 2016 Juan Orti Alcaine <jorti@fedoraproject.org> - 1.1.1-9
089cc0d
- Allow radicale_t to execute bin_t in SELinux policy RHBZ#1393569
089cc0d
b5c28e9
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.1-8
b5c28e9
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
b5c28e9
4629192
* Fri Jul 01 2016 Juan Orti Alcaine <jorti@fedoraproject.org> - 1.1.1-7
4629192
- Additional systemd hardening
4629192
5328bb0
* Fri Jun 24 2016 Juan Orti Alcaine <jorti@fedoraproject.org> - 1.1.1-6
5328bb0
- Correctly label the files
5328bb0
c432147
* Wed Jun 22 2016 Juan Orti Alcaine <jorti@fedoraproject.org> - 1.1.1-5
c432147
- Add /var/run/radicale directory
c432147
c432147
* Tue Jun 21 2016 Juan Orti Alcaine <jorti@fedoraproject.org> - 1.1.1-4
c432147
- Update dependencies
c432147
c432147
* Tue Jun 21 2016 Juan Orti Alcaine <jorti@fedoraproject.org> - 1.1.1-3
c432147
- Create python2 subpackage
c432147
473a845
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.1-2
473a845
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
473a845
37d4bc8
* Fri Jan 08 2016 Juan Orti Alcaine <jorti@fedoraproject.org> - 1.1.1-1
37d4bc8
- Update to 1.1.1 (#1296746)
37d4bc8
e3df4ab
* Fri Jan 01 2016 Juan Orti Alcaine <jorti@fedoraproject.org> - 1.1-1
e3df4ab
- Version 1.1
e3df4ab
2fa1499
* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.1-4
2fa1499
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5
2fa1499
a072a02
* Thu Nov 05 2015 Juan Orti Alcaine <jorti@fedoraproject.org> - 1.0.1-3
a072a02
- Fix radicale-httpd for python3
a072a02
8c1b00b
* Thu Sep 24 2015 Juan Orti Alcaine <jorti@fedoraproject.org> - 1.0.1-2
8c1b00b
- Unify spec for Fedora and epel7
8c1b00b
eb3f223
* Tue Sep 22 2015 Juan Orti Alcaine <jorti@fedoraproject.org> - 1.0.1-1
eb3f223
- Version 1.0.1
eb3f223
18d1e53
* Tue Sep 15 2015 Juan Orti Alcaine <jorti@fedoraproject.org> - 1.0-1
18d1e53
- Version 1.0
18d1e53
- Merge SELinux subpackage into the main package
18d1e53
b7a3686
* Mon Sep 07 2015 Juan Orti Alcaine <jorti@fedoraproject.org> - 0.10-7
b7a3686
- Drop old _selinux_policy_version hack
b7a3686
- Require radicale-selinux
b7a3686
687149b
* Fri Jul 24 2015 Tomas Radej <tradej@redhat.com> - 0.10-6
687149b
- Updated dep on policycoreutils-python-utils
687149b
71eb10f
* Wed Jun 17 2015 Juan Orti Alcaine <jorti@fedoraproject.org> - 0.10-5
71eb10f
- Switch to python3
71eb10f
e17c2dd
* Thu Apr 09 2015 Juan Orti Alcaine <jorti@fedoraproject.org> - 0.10-4
e17c2dd
- Use license macro
e17c2dd
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