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

Name:           gadget
Version:        0.0.3
Release:        23%{?dist}
Summary:        XMPP server component for tracking people and activities

License:        GPLv2
URL:            http://wiki.laptop.org/go/Gadget
Source0:        http://dev.laptop.org/pub/gadget/gadget-%{version}.tar.gz
Source1:        gadget.service

BuildArch:      noarch

BuildRequires: systemd
BuildRequires: python2-devel

Requires: python2-twisted
Requires: ejabberd

#Requires(post): /sbin/chkconfig
#Requires(preun): /sbin/chkconfig
#Requires(preun): /sbin/service
#Requires(postun): /sbin/service
Requires(post): systemd-units
Requires(preun): systemd-units
Requires(postun): systemd-units

%description
Gadget is an XMPP server component written to scale Jabber
server based collaborative activities via Telepathy Gabble.

%prep
%setup -q

%build
%py2_build

%install
%py2_install

%{__mkdir_p} $RPM_BUILD_ROOT/var/lib/gadget

%{__install} -p -D -m 644 gadget.config $RPM_BUILD_ROOT/%{_sysconfdir}/gadget/gadget.config
%{__install} -p -D -m 644 gadget.tac $RPM_BUILD_ROOT/%{_datadir}/gadget/gadget.tac
%{__install} -p -D -m 755 %{SOURCE1} $RPM_BUILD_ROOT/%{_unitdir}/gadget.service


%post
#/sbin/chkconfig --add gadget
if [ $1 -eq 1 ] ; then 
    # Initial installation 
    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi


%preun
#if [ $1 = 0 ]; then
#        /sbin/service gadget stop >/dev/null 2>&1
#        /sbin/chkconfig --del gadget
#fi
if [ $1 -eq 0 ] ; then
    # Package removal, not upgrade
    /bin/systemctl --no-reload disable gadget.service > /dev/null 2>&1 || :
    /bin/systemctl stop gadget.service > /dev/null 2>&1 || :
fi


%postun
#if [ "$1" -ge "1" ]; then
#        /sbin/service gadget condrestart >/dev/null 2>&1
#fi
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ] ; then
    # Package upgrade, not uninstall
    /bin/systemctl try-restart gadget.service >/dev/null 2>&1 || :
fi


%triggerun -- httpd < 0.0.3-8
# Save the current service runlevel info
# User must manually run systemd-sysv-convert --apply gadget
# to migrate them to systemd targets
/usr/bin/systemd-sysv-convert --save gadget >/dev/null 2>&1 ||:

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



%files
%doc NEWS README COPYING
%config(noreplace) %{_sysconfdir}/gadget/gadget.config
%{_unitdir}/gadget.service
%{_datadir}/gadget/gadget.tac
%{python2_sitelib}/gadget
%{python2_sitelib}/*.egg-info
%dir /var/lib/gadget

%changelog
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.0.3-23
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.0.3-22
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.0.3-21
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Fri Jan 05 2018 Iryna Shcherbina <ishcherb@redhat.com> - 0.0.3-20
- Update Python 2 dependency declarations to new packaging standards
  (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)

* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.0.3-19
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.0.3-18
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

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

* Fri Mar 11 2016 Peter Robinson <pbrobinson@fedoraproject.org> 0.0.3-16
- PPC64 has ejabberd now

* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.0.3-15
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Thu Jul 02 2015 Ralf Cors├ępius <corsepiu@fedoraproject.org> - 0.0.3-14
- BR: systemd-units (Fix FTBFS; RHBZ #850125; RHBZ #1106316 ).
- Modernize spec.

* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.0.3-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

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

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

* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.0.3-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.0.3-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Thu Feb 16 2012 Jon Ciesla <limburgher@gmail.com> - 0.0.3-8
- Migrated to systemd, BZ 661648.

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

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

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

* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.0.3-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Tue Mar 31 2009 Simon Schampijer <simon@schampijer.de> - 0.0.3-3
- exclude ppc64 as ejabberd is not build there #250253

* Tue Mar 10 2009 Simon Schampijer <simon@schampijer.de> - 0.0.3-2
- added COPYING 
- correct licence information
- added gadget init file for Fedora
- added ejabberd and python-twisted dependency

* Wed Dec 10 2008 Marco Pesenti Gritti <mpg@redhat.com> - 0.0.3-1
- Update to 0.10.4 to fix 2.6 issues