59a5180
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
59a5180
59a5180
59a5180
Name:		openxcap
3f1d2f4
Version:	2.0.1
34d0e9e
Release:	2%{?dist}
59a5180
Summary:	Fully featured XCAP server
59a5180
Group:		System Environment/Daemons
59a5180
License:	GPLv2
59a5180
URL:		http://openxcap.org/
59a5180
Source0:	http://download.ag-projects.com/XCAP/%{name}-%{version}.tar.gz
59a5180
Source1:	%{name}.init
3f1d2f4
Source2:	%{name}.service
3f1d2f4
Source3:	%{name}.tmpfiles.conf
34d0e9e
# Make openxcap compatible with python-pillow
34d0e9e
# https://bugzilla.redhat.com/show_bug.cgi?id=895773
34d0e9e
Patch0:		openxcap-pillow.patch
59a5180
59a5180
BuildArch:      noarch
59a5180
BuildRoot:	%(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
59a5180
BuildRequires:	python-setuptools
59a5180
Requires:	python >= 2.5
3f1d2f4
Requires:	MySQL-python >= 1.2.2
3f1d2f4
Requires:	python-application >= 1.2.8
3f1d2f4
Requires:	python-gnutls >= 1.1.9
3f1d2f4
Requires:	python-imaging >= 1.1.7
3f1d2f4
Requires:	python-lxml >= 2.0.7
59a5180
Requires:	python-sqlobject
3f1d2f4
Requires:	python-twisted-core >= 8.1.0
3f1d2f4
Requires:	python-twisted-web >= 8.1.0
3f1d2f4
Requires:	python-twisted-web2 >= 8.1.0
59a5180
Requires:	python-zope-interface
59a5180
f11c678
%if 0%{?fedora} > 17
3f1d2f4
# Users and groups
3f1d2f4
Requires(pre): shadow-utils
3f1d2f4
Requires(post): systemd-units
3f1d2f4
Requires(preun): systemd-units
3f1d2f4
Requires(postun): systemd-units
3f1d2f4
%else
59a5180
Requires(post): chkconfig
59a5180
Requires(preun): chkconfig
59a5180
# This is for /sbin/service
59a5180
Requires(preun): initscripts
3f1d2f4
%endif
59a5180
59a5180
59a5180
%description
59a5180
Fully featured XCAP server. An XCAP server is used by SIP SIMPLE clients and
59a5180
servers to manage buddy lists and policy for subscriptions to presence or
59a5180
other type of events published using SIP protocol.
59a5180
59a5180
XCAP protocol allows a client to read, write and modify application
59a5180
configuration data stored in XML format on a server. XCAP maps XML document
59a5180
sub-trees and element attributes to HTTP URIs, so that these components can
59a5180
be directly accessed by HTTP. An XCAP server is used by the XCAP clients to
59a5180
store data like Presence policy in combination with a SIP Presence server
59a5180
that supports PUBLISH/SUBSCRIBE/NOTIFY methods to provide a complete SIP
59a5180
SIMPLE server solution.
59a5180
59a5180
59a5180
%prep
59a5180
%setup -q
34d0e9e
%patch0 -p1
59a5180
59a5180
%build
59a5180
%{__python} -c 'import setuptools; execfile("setup.py")' build
59a5180
59a5180
59a5180
%install
3f1d2f4
rm -rf %{buildroot}
3f1d2f4
%{__python} -c 'import setuptools; execfile("setup.py")' install --skip-build --root %{buildroot}
3f1d2f4
install -D -p -m 0644 config.ini.sample %{buildroot}%{_sysconfdir}/%{name}/config.ini
3f1d2f4
install -d %{buildroot}%{_sysconfdir}/%{name}/tls
3f1d2f4
install -D -p -m 0644 scripts/mysql-create-tables.sql %{buildroot}%{_datadir}/%{name}/mysql-create-tables.sql
3f1d2f4
install -D -p -m 0644 scripts/mysql-create-user.sql %{buildroot}%{_datadir}/%{name}/mysql-create-user.sql
3f1d2f4
install -d %{buildroot}%{_localstatedir}/run/%{name}
3f1d2f4
install -d %{buildroot}%{_localstatedir}/log/%{name}
f11c678
%if 0%{?fedora} > 17
3f1d2f4
# install systemd files
3f1d2f4
install -D -m 0644 -p %{SOURCE2} %{buildroot}%{_unitdir}/%{name}.service
3f1d2f4
install -D -m 0644 -p %{SOURCE3} %{buildroot}/usr/lib/tmpfiles.d/%{name}.conf
3f1d2f4
%else
3f1d2f4
install -D -p -m 0755 %{SOURCE1} %{buildroot}%{_initrddir}/%{name}
3f1d2f4
%endif
59a5180
59a5180
59a5180
%clean
3f1d2f4
rm -rf %{buildroot}
59a5180
59a5180
3f1d2f4
%pre
f11c678
%if 0%{?fedora} > 17
3f1d2f4
getent group %{name} >/dev/null || groupadd -r %{name}
3f1d2f4
getent passwd %{name} >/dev/null || \
3f1d2f4
useradd -r -g %{name} -d %{_localstatedir}/run/%{name} -s /sbin/nologin \
3f1d2f4
-c "OpenXCAP Server" %{name} 2>/dev/null || :
3f1d2f4
%endif
3f1d2f4
59a5180
%post
f11c678
%if 0%{?fedora} > 17
3f1d2f4
if [ $1 -eq 1 ] ; then
3f1d2f4
    # Initial installation
3f1d2f4
    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
3f1d2f4
fi
3f1d2f4
%else
3f1d2f4
/sbin/chkconfig --add %{name}
3f1d2f4
%endif
59a5180
59a5180
59a5180
%preun
f11c678
%if 0%{?fedora} > 17
3f1d2f4
if [ $1 -eq 0 ] ; then
3f1d2f4
    # Package removal, not upgrade
3f1d2f4
    /bin/systemctl --no-reload disable %{name}.service > /dev/null 2>&1 || :
3f1d2f4
    /bin/systemctl stop %{name}.service > /dev/null 2>&1 || :
59a5180
fi
3f1d2f4
%else
3f1d2f4
if [ $1 = 0 ]; then
3f1d2f4
 /sbin/service %{name} stop > /dev/null 2>&1
3f1d2f4
 /sbin/chkconfig --del %{name}
3f1d2f4
fi
3f1d2f4
%endif
3f1d2f4
f11c678
%if 0%{?fedora} > 17
3f1d2f4
%triggerun -- %{name} < 2.0.1-1
3f1d2f4
# Save the current service runlevel info
3f1d2f4
# User must manually run systemd-sysv-convert --apply opensips
3f1d2f4
# to migrate them to systemd targets
3f1d2f4
/usr/bin/systemd-sysv-convert --save %{name} >/dev/null 2>&1 ||:
3f1d2f4
3f1d2f4
# Run these because the SysV package being removed won't do them
3f1d2f4
/sbin/chkconfig --del %{name} >/dev/null 2>&1 || :
3f1d2f4
/bin/systemctl try-restart %{name}.service >/dev/null 2>&1 || :
3f1d2f4
3f1d2f4
chown -R %{name}:%{name} %{_sysconfdir}/%{name}
3f1d2f4
chown -R %{name}:%{name} %{_localstatedir}/run/%{name}
3f1d2f4
%endif
59a5180
59a5180
%files
59a5180
%doc LICENSE PKG-INFO README TODO opensips/opensips.cfg
3f1d2f4
%dir %{_datadir}/%{name}
3f1d2f4
%{_bindir}/%{name}
3f1d2f4
%{_datadir}/%{name}/mysql-create-tables.sql
3f1d2f4
%{_datadir}/%{name}/mysql-create-user.sql
3f1d2f4
%{python_sitelib}/xcap
3f1d2f4
%{python_sitelib}/%{name}-%{version}-*.egg-info
3f1d2f4
f11c678
%if 0%{?fedora} > 17
3f1d2f4
%dir %attr(0755, %{name}, %{name}) %{_localstatedir}/log/%{name}
3f1d2f4
%dir %attr(0755, %{name}, %{name}) %{_localstatedir}/run/%{name}
3f1d2f4
%dir %attr(0755, %{name}, %{name}) %{_sysconfdir}/%{name}
3f1d2f4
%dir %attr(0644, %{name}, %{name}) %{_sysconfdir}/%{name}/tls
3f1d2f4
%config(noreplace) %attr(0644, %{name}, %{name}) %{_sysconfdir}/%{name}/config.ini
3f1d2f4
%{_unitdir}/%{name}.service
3f1d2f4
/usr/lib/tmpfiles.d/%{name}.conf
3f1d2f4
%else
59a5180
%dir %{_sysconfdir}/%{name}
59a5180
%dir %{_sysconfdir}/%{name}/tls
59a5180
%dir %{_localstatedir}/run/%{name}
59a5180
%config(noreplace) %{_sysconfdir}/%{name}/config.ini
59a5180
%{_initrddir}/%{name}
3f1d2f4
%endif
59a5180
59a5180
59a5180
%changelog
34d0e9e
* Mon Feb  4 2013 Toshio Kuratomi <toshio@fedoraproject.org> - 2.0.1-2
34d0e9e
- Patch to add compatibility with python-pillow (see rhbz #895773)
34d0e9e
3f1d2f4
* Sat Aug 18 2012 Peter Lemenkov <lemenkov@gmail.com> - 2.0.1-1
3f1d2f4
- Ver. 2.0.1
3f1d2f4
- Switch to systemd
3f1d2f4
- Drop dependency on PyXML (see rhbz #844538)
3f1d2f4
2011bfa
* Fri Jul 20 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.2-5
2011bfa
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
2011bfa
e1c8780
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.2-4
e1c8780
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
e1c8780
9707405
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.2-3
9707405
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
9707405
f738ccf
* Wed Jul 21 2010 David Malcolm <dmalcolm@redhat.com> - 1.1.2-2
f738ccf
- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild
f738ccf
3f1d2f4
* Thu Sep 24 2009 Peter Lemenkov <lemenkov@gmail.com> - 1.1.2-1
59a5180
- Initial package
59a5180