Blob Blame History Raw
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}


Name:		openxcap
Version:	2.0.1
Release:	10%{?dist}
Summary:	Fully featured XCAP server
Group:		System Environment/Daemons
License:	GPLv2
URL:		http://openxcap.org/
%if 0%{?el7}%{?fedora}
VCS:		scm:darcs:http://devel.ag-projects.com/repositories/openxcap
%endif
Source0:	http://download.ag-projects.com/XCAP/%{name}-%{version}.tar.gz
Source1:	%{name}.init
Source2:	%{name}.service
Source3:	%{name}.tmpfiles.conf
# Make openxcap compatible with python-pillow
# https://bugzilla.redhat.com/show_bug.cgi?id=895773
Patch0:		openxcap-pillow.patch

BuildArch:      noarch
BuildRoot:	%(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
BuildRequires:	python-setuptools
%if 0%{?el7}%{?fedora}
BuildRequires:	systemd
%endif
Requires:	python >= 2.5
Requires:	MySQL-python >= 1.2.2
Requires:	python-application >= 1.2.8
Requires:	python-gnutls >= 1.1.9
Requires:	python-imaging >= 1.1.7
Requires:	python-lxml >= 2.0.7
Requires:	python-sqlobject
Requires:	python-twisted-core >= 8.1.0
Requires:	python-twisted-web >= 8.1.0
Requires:	python-twisted-web2 >= 8.1.0
Requires:	python-zope-interface

%if 0%{?el5}%{?el6}
Requires(post): chkconfig
Requires(preun): chkconfig
# This is for /sbin/service
Requires(preun): initscripts
%else
# Users and groups
Requires(pre): shadow-utils
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
%endif


%description
Fully featured XCAP server. An XCAP server is used by SIP SIMPLE clients and
servers to manage buddy lists and policy for subscriptions to presence or
other type of events published using SIP protocol.

XCAP protocol allows a client to read, write and modify application
configuration data stored in XML format on a server. XCAP maps XML document
sub-trees and element attributes to HTTP URIs, so that these components can
be directly accessed by HTTP. An XCAP server is used by the XCAP clients to
store data like Presence policy in combination with a SIP Presence server
that supports PUBLISH/SUBSCRIBE/NOTIFY methods to provide a complete SIP
SIMPLE server solution.


%prep
%setup -q
%patch0 -p1


%build
%{__python} -c 'import setuptools; execfile("setup.py")' build


%install
rm -rf %{buildroot}
%{__python} -c 'import setuptools; execfile("setup.py")' install --skip-build --root %{buildroot}
install -D -p -m 0644 config.ini.sample %{buildroot}%{_sysconfdir}/%{name}/config.ini
install -d %{buildroot}%{_sysconfdir}/%{name}/tls
install -D -p -m 0644 scripts/mysql-create-tables.sql %{buildroot}%{_datadir}/%{name}/mysql-create-tables.sql
install -D -p -m 0644 scripts/mysql-create-user.sql %{buildroot}%{_datadir}/%{name}/mysql-create-user.sql
install -d %{buildroot}%{_localstatedir}/run/%{name}
install -d %{buildroot}%{_localstatedir}/log/%{name}
%if 0%{?el5}%{?el6}
# install init-script
install -D -p -m 0755 %{SOURCE1} %{buildroot}%{_initrddir}/%{name}
%else
# install systemd files
install -D -m 0644 -p %{SOURCE2} %{buildroot}%{_unitdir}/%{name}.service
install -D -m 0644 -p %{SOURCE3} %{buildroot}%{_tmpfilesdir}/%{name}.conf
%endif


%clean
rm -rf %{buildroot}


%pre
%if 0%{?el7}%{?fedora}
getent group %{name} >/dev/null || groupadd -r %{name}
getent passwd %{name} >/dev/null || \
useradd -r -g %{name} -d %{_localstatedir}/run/%{name} -s /sbin/nologin \
-c "OpenXCAP Server" %{name} 2>/dev/null || :
%endif


%post
%if 0%{?el5}%{?el6}
if [ $1 -eq 1 ]; then
	/sbin/chkconfig --add %{name} || :
fi
%else
%systemd_post %{name}.service
%endif


%preun
%if 0%{?el5}%{?el6}
if [ $1 -eq 0 ]; then
	/sbin/service %{name} stop >/dev/null 2>&1 || :
	/sbin/chkconfig --del %{name} || :
fi
%else
%systemd_preun %{name}.service
%endif


%if 0%{?fedora} > 17
%triggerun -- %{name} < 2.0.1-1
# Save the current service runlevel info
# User must manually run systemd-sysv-convert --apply opensips
# to migrate them to systemd targets
/usr/bin/systemd-sysv-convert --save %{name} >/dev/null 2>&1 ||:

# Run these because the SysV package being removed won't do them
/sbin/chkconfig --del %{name} >/dev/null 2>&1 || :
/bin/systemctl try-restart %{name}.service >/dev/null 2>&1 || :

chown -R %{name}:%{name} %{_sysconfdir}/%{name}
chown -R %{name}:%{name} %{_localstatedir}/run/%{name}
%endif


%files
%doc LICENSE PKG-INFO README TODO opensips/opensips.cfg
%dir %{_datadir}/%{name}
%{_bindir}/%{name}
%{_datadir}/%{name}/mysql-create-tables.sql
%{_datadir}/%{name}/mysql-create-user.sql
%{python_sitelib}/xcap
%{python_sitelib}/%{name}-%{version}-*.egg-info

%if 0%{?el7}%{?fedora}
%dir %attr(0755, %{name}, %{name}) %{_localstatedir}/log/%{name}
%ghost %dir %attr(0755, %{name}, %{name}) %{_localstatedir}/run/%{name}
%dir %attr(0755, %{name}, %{name}) %{_sysconfdir}/%{name}
%dir %attr(0644, %{name}, %{name}) %{_sysconfdir}/%{name}/tls
%config(noreplace) %attr(0644, %{name}, %{name}) %{_sysconfdir}/%{name}/config.ini
%{_unitdir}/%{name}.service
%{_tmpfilesdir}/%{name}.conf
%else
%dir %{_sysconfdir}/%{name}
%dir %{_sysconfdir}/%{name}/tls
%dir %{_localstatedir}/run/%{name}
%config(noreplace) %{_sysconfdir}/%{name}/config.ini
%{_initrddir}/%{name}
%endif


%changelog
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.1-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.1-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.1-8
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.1-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.1-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Sat Aug 31 2013 Peter Lemenkov <lemenkov@gmail.com> - 2.0.1-4
- Fixed FTBFS (rhbz #992412)
- Marked directory /var/run/openxcap as ghost (rhbz #656651)
- Switched to systemd-macros (rhbz #850259)

* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Mon Feb  4 2013 Toshio Kuratomi <toshio@fedoraproject.org> - 2.0.1-2
- Patch to add compatibility with python-pillow (see rhbz #895773)

* Sat Aug 18 2012 Peter Lemenkov <lemenkov@gmail.com> - 2.0.1-1
- Ver. 2.0.1
- Switch to systemd
- Drop dependency on PyXML (see rhbz #844538)

* Fri Jul 20 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.2-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Wed Jul 21 2010 David Malcolm <dmalcolm@redhat.com> - 1.1.2-2
- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild

* Thu Sep 24 2009 Peter Lemenkov <lemenkov@gmail.com> - 1.1.2-1
- Initial package