[openxcap] Clean up spec-file

Peter Lemenkov peter at fedoraproject.org
Sat Aug 31 18:02:45 UTC 2013


commit b5aaec49570cfbeb6f5ce3a8b3efb1ba9a643452
Author: Peter Lemenkov <lemenkov at gmail.com>
Date:   Sat Aug 31 22:01:44 2013 +0400

    Clean up spec-file
    
    Signed-off-by: Peter Lemenkov <lemenkov at gmail.com>

 openxcap.spec |   71 +++++++++++++++++++++++++++++++++------------------------
 1 files changed, 41 insertions(+), 30 deletions(-)
---
diff --git a/openxcap.spec b/openxcap.spec
index 435ce3f..8eb796b 100644
--- a/openxcap.spec
+++ b/openxcap.spec
@@ -3,11 +3,14 @@
 
 Name:		openxcap
 Version:	2.0.1
-Release:	3%{?dist}
+Release:	4%{?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
@@ -19,6 +22,9 @@ 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
@@ -31,17 +37,17 @@ Requires:	python-twisted-web >= 8.1.0
 Requires:	python-twisted-web2 >= 8.1.0
 Requires:	python-zope-interface
 
-%if 0%{?fedora} > 17
-# Users and groups
-Requires(pre): shadow-utils
-Requires(post): systemd-units
-Requires(preun): systemd-units
-Requires(postun): systemd-units
-%else
+%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
 
 
@@ -63,6 +69,7 @@ SIMPLE server solution.
 %setup -q
 %patch0 -p1
 
+
 %build
 %{__python} -c 'import setuptools; execfile("setup.py")' build
 
@@ -76,12 +83,13 @@ install -D -p -m 0644 scripts/mysql-create-tables.sql %{buildroot}%{_datadir}/%{
 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%{?fedora} > 17
+%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}/usr/lib/tmpfiles.d/%{name}.conf
-%else
-install -D -p -m 0755 %{SOURCE1} %{buildroot}%{_initrddir}/%{name}
+install -D -m 0644 -p %{SOURCE3} %{buildroot}%{_tmpfilesdir}/%{name}.conf
 %endif
 
 
@@ -90,38 +98,35 @@ rm -rf %{buildroot}
 
 
 %pre
-%if 0%{?fedora} > 17
+%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%{?fedora} > 17
-if [ $1 -eq 1 ] ; then
-    # Initial installation
-    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+%if 0%{?el5}%{?el6}
+if [ $1 -eq 1 ]; then
+	/sbin/chkconfig --add %{name} || :
 fi
 %else
-/sbin/chkconfig --add %{name}
+%systemd_post %{name}.service
 %endif
 
 
 %preun
-%if 0%{?fedora} > 17
-if [ $1 -eq 0 ] ; then
-    # Package removal, not upgrade
-    /bin/systemctl --no-reload disable %{name}.service > /dev/null 2>&1 || :
-    /bin/systemctl stop %{name}.service > /dev/null 2>&1 || :
+%if 0%{?el5}%{?el6}
+if [ $1 -eq 0 ]; then
+	/sbin/service %{name} stop >/dev/null 2>&1 || :
+	/sbin/chkconfig --del %{name} || :
 fi
 %else
-if [ $1 = 0 ]; then
- /sbin/service %{name} stop > /dev/null 2>&1
- /sbin/chkconfig --del %{name}
-fi
+%systemd_preun %{name}.service
 %endif
 
+
 %if 0%{?fedora} > 17
 %triggerun -- %{name} < 2.0.1-1
 # Save the current service runlevel info
@@ -137,6 +142,7 @@ 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}
@@ -146,14 +152,14 @@ chown -R %{name}:%{name} %{_localstatedir}/run/%{name}
 %{python_sitelib}/xcap
 %{python_sitelib}/%{name}-%{version}-*.egg-info
 
-%if 0%{?fedora} > 17
+%if 0%{?el7}%{?fedora}
 %dir %attr(0755, %{name}, %{name}) %{_localstatedir}/log/%{name}
-%dir %attr(0755, %{name}, %{name}) %{_localstatedir}/run/%{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
-/usr/lib/tmpfiles.d/%{name}.conf
+%{_tmpfilesdir}/%{name}.conf
 %else
 %dir %{_sysconfdir}/%{name}
 %dir %{_sysconfdir}/%{name}/tls
@@ -164,6 +170,11 @@ chown -R %{name}:%{name} %{_localstatedir}/run/%{name}
 
 
 %changelog
+* Sat Aug 31 2013 Peter Lemenkov <lemenkov at 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 at lists.fedoraproject.org> - 2.0.1-3
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
 


More information about the scm-commits mailing list