Stanislav Ochotnicky 45ce797
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
Stanislav Ochotnicky 45ce797
Stanislav Ochotnicky 45ce797
Stanislav Ochotnicky 45ce797
Name:           fedwatch
Stanislav Ochotnicky 836d0a4
Version:        0.5
fa09de1
Release:        11%{?dist}
Stanislav Ochotnicky 45ce797
Summary:        Tool for watching fedmsg messages and running arbitrary scripts
Stanislav Ochotnicky 45ce797
Stanislav Ochotnicky 45ce797
License:        LGPLv2+
Stanislav Ochotnicky 45ce797
URL:            https://github.com/sochotnicky/fedwatch
Stanislav Ochotnicky 45ce797
Source0:        https://pypi.python.org/packages/source/f/fedwatch/fedwatch-%{version}.tar.gz
Stanislav Ochotnicky 45ce797
Stanislav Ochotnicky 45ce797
BuildArch:      noarch
Stanislav Ochotnicky 45ce797
BuildRequires:  python2-devel
5ae51fb
BuildRequires:  python2-setuptools
5ae51fb
BuildRequires:  python2-dpath
Stanislav Ochotnicky 45ce797
BuildRequires:  fedmsg
Stanislav Ochotnicky 45ce797
5ae51fb
Requires:       python2-%{name} = %{version}-%{release}
5ae51fb
Requires:       python2-dpath
Stanislav Ochotnicky 45ce797
Requires:       fedmsg
5ae51fb
Requires:       python2-fedmsg-meta-fedora-infrastructure
Stanislav Ochotnicky 45ce797
%if 0%{?rhel} && 0%{?rhel} < 7
Stanislav Ochotnicky 45ce797
Requires(post): chkconfig
Stanislav Ochotnicky 45ce797
Requires(preun): chkconfig
Stanislav Ochotnicky 45ce797
# This is for /sbin/service
Stanislav Ochotnicky 45ce797
Requires(preun): initscripts
Stanislav Ochotnicky 45ce797
%else
Stanislav Ochotnicky 45ce797
Requires(post): systemd
Stanislav Ochotnicky 45ce797
Requires(preun): systemd
Stanislav Ochotnicky 45ce797
Requires(postun): systemd
Stanislav Ochotnicky 45ce797
BuildRequires: systemd
Stanislav Ochotnicky 45ce797
%endif
Stanislav Ochotnicky 45ce797
Stanislav Ochotnicky 45ce797
%description
Stanislav Ochotnicky 45ce797
Tool and library for watching fedmsg messages and running arbitrary scripts in a
Stanislav Ochotnicky 45ce797
nice way. 
Stanislav Ochotnicky 45ce797
Stanislav Ochotnicky 45ce797
Think of fedwatch as simple converter from fedmsg json messages into shell
Stanislav Ochotnicky 45ce797
arguments for scripts.
Stanislav Ochotnicky 45ce797
e356c81
%package -n python2-%{name}
e356c81
%{?python_provide:%python_provide python2-%{name}}
Stanislav Ochotnicky 45ce797
Summary:        Python 2 module for watching fedmsg messages and running arbitrary scripts
Stanislav Ochotnicky 45ce797
e356c81
%description -n python2-%{name}
Stanislav Ochotnicky 45ce797
%{summary}.
Stanislav Ochotnicky 45ce797
Stanislav Ochotnicky 45ce797
%prep
Stanislav Ochotnicky 45ce797
%setup -q -n fedwatch-%{version}
Stanislav Ochotnicky 45ce797
chmod -x examples/fedwatch.d/*
Stanislav Ochotnicky 45ce797
# get rid of hashbang
Stanislav Ochotnicky 45ce797
sed -i '1{d}' fedwatch.py
Stanislav Ochotnicky 45ce797
Stanislav Ochotnicky 45ce797
%build
b37807c
%py2_build
Stanislav Ochotnicky 45ce797
Stanislav Ochotnicky 45ce797
%install
fc470d6
%py2_install
Stanislav Ochotnicky 45ce797
Stanislav Ochotnicky 45ce797
# create initial config
Stanislav Ochotnicky 45ce797
mkdir %{buildroot}%{_sysconfdir}
Stanislav Ochotnicky 45ce797
cat > %{buildroot}%{_sysconfdir}/%{name}.conf << EOF
Stanislav Ochotnicky 45ce797
# Empty configuration file. See /usr/share/doc/%{name}*/examples
Stanislav Ochotnicky 45ce797
# for working examples
Stanislav Ochotnicky 45ce797
EOF
Stanislav Ochotnicky 45ce797
Stanislav Ochotnicky 45ce797
mkdir %{buildroot}%{_sysconfdir}/%{name}.d/
Stanislav Ochotnicky 45ce797
Stanislav Ochotnicky 45ce797
# install init/systemd integration
Stanislav Ochotnicky 45ce797
%if 0%{?rhel} && 0%{?rhel} < 7
Stanislav Ochotnicky 45ce797
mkdir -p %{buildroot}/%{_initddir}
Stanislav Ochotnicky 45ce797
cp fedwatch.init %{buildroot}/%{_initddir}/fedwatch
Stanislav Ochotnicky 45ce797
%else
Stanislav Ochotnicky 45ce797
mkdir -p %{buildroot}/%{_unitdir}
Stanislav Ochotnicky 45ce797
cp fedwatch.service %{buildroot}/%{_unitdir}/
Stanislav Ochotnicky 45ce797
%endif
Stanislav Ochotnicky 45ce797
Stanislav Ochotnicky 45ce797
Stanislav Ochotnicky 45ce797
%if 0%{?rhel} && 0%{?rhel} < 7
Stanislav Ochotnicky 45ce797
%post
Stanislav Ochotnicky 45ce797
# This adds the proper /etc/rc*.d links for the script
Stanislav Ochotnicky 45ce797
/sbin/chkconfig --add fedwatch
Stanislav Ochotnicky 45ce797
Stanislav Ochotnicky 45ce797
%preun
Stanislav Ochotnicky 45ce797
if [ $1 -eq 0 ] ; then
Stanislav Ochotnicky 45ce797
    /sbin/service fedwatch stop >/dev/null 2>&1
Stanislav Ochotnicky 45ce797
    /sbin/chkconfig --del fedwatch
Stanislav Ochotnicky 45ce797
fi
Stanislav Ochotnicky 45ce797
%else
Stanislav Ochotnicky 45ce797
%post
Stanislav Ochotnicky 45ce797
%systemd_post fedwatch.service
Stanislav Ochotnicky 45ce797
Stanislav Ochotnicky 45ce797
%preun
Stanislav Ochotnicky 45ce797
%systemd_preun fedwatch.service
Stanislav Ochotnicky 45ce797
Stanislav Ochotnicky 45ce797
%postun
Stanislav Ochotnicky 45ce797
%systemd_postun_with_restart fedwatch.service
Stanislav Ochotnicky 45ce797
%endif
Stanislav Ochotnicky 45ce797
Stanislav Ochotnicky 45ce797
%files
Stanislav Ochotnicky 45ce797
%doc README.md LICENSE
Stanislav Ochotnicky 45ce797
%doc examples
Stanislav Ochotnicky 45ce797
%{_bindir}/fedwatch
Stanislav Ochotnicky 45ce797
%config(noreplace) %{_sysconfdir}/fedwatch.conf
Stanislav Ochotnicky 45ce797
%dir %{_sysconfdir}/fedwatch.d
Stanislav Ochotnicky 45ce797
%if 0%{?rhel} && 0%{?rhel} < 7
Stanislav Ochotnicky 45ce797
%attr(755, root, root) %{_initddir}/fedwatch
Stanislav Ochotnicky 45ce797
%else
Stanislav Ochotnicky 45ce797
%{_unitdir}/fedwatch.service
Stanislav Ochotnicky 45ce797
%endif
Stanislav Ochotnicky 45ce797
e356c81
%files -n python2-%{name}
f0cd655
%{python2_sitelib}/fedwatch*
Stanislav Ochotnicky 45ce797
Stanislav Ochotnicky 45ce797
Stanislav Ochotnicky 45ce797
%changelog
fa09de1
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.5-11
fa09de1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
fa09de1
d2b3823
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.5-10
d2b3823
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
d2b3823
b6066c5
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.5-9
b6066c5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
b6066c5
5ae51fb
* Tue Feb 06 2018 Iryna Shcherbina <ishcherb@redhat.com> - 0.5-8
5ae51fb
- Update Python 2 dependency declarations to new packaging standards
5ae51fb
  (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)
5ae51fb
e356c81
* Sat Aug 19 2017 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 0.5-7
e356c81
- Python 2 binary package renamed to python2-fedwatch
e356c81
  See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3
e356c81
5f23d9d
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.5-6
5f23d9d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
5f23d9d
4469970
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.5-5
4469970
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
4469970
54cd79a
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5-4
54cd79a
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
54cd79a
f919592
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.5-3
f919592
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
f919592
73c8447
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5-2
73c8447
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
73c8447
Stanislav Ochotnicky 836d0a4
* Tue Jun 10 2014 Stanislav Ochotnicky <sochotnicky@redhat.com> - 0.5-1
Stanislav Ochotnicky 836d0a4
- Update to latest upstream
Stanislav Ochotnicky 836d0a4
- Fix handling of non-string arguments for scripts
Stanislav Ochotnicky 836d0a4
e443563
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4-3
e443563
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
e443563
Stanislav Ochotnicky 45ce797
* Tue Apr 29 2014 Stanislav Ochotnicky <sochotnicky@redhat.com> - 0.4-2
Stanislav Ochotnicky 45ce797
- Fix changelog
Stanislav Ochotnicky 45ce797
- Make sure documentation is not executable
Stanislav Ochotnicky 45ce797
Stanislav Ochotnicky 45ce797
* Tue Apr 29 2014 Stanislav Ochotnicky <sochotnicky@redhat.com> - 0.4-1
Stanislav Ochotnicky 45ce797
- Update to latest upstream
Stanislav Ochotnicky 45ce797
Stanislav Ochotnicky 45ce797
* Thu Mar 20 2014 Stanislav Ochotnicky <sochotnicky@redhat.com> - 0.3-1
Stanislav Ochotnicky 45ce797
- Update to new upstream version
Stanislav Ochotnicky 45ce797
- Handle errors a bit better
Stanislav Ochotnicky 45ce797
Stanislav Ochotnicky 45ce797
* Thu Mar 20 2014 Stanislav Ochotnicky <sochotnicky@redhat.com> - 0.2-1
Stanislav Ochotnicky 45ce797
- Update to new upstream version
Stanislav Ochotnicky 45ce797
- Add support for systemd and init
Stanislav Ochotnicky 45ce797
Stanislav Ochotnicky 45ce797
* Wed Mar 19 2014 Stanislav Ochotnicky <sochotnicky@redhat.com> - 0.1-1
Stanislav Ochotnicky 45ce797
- Initial packaging
Stanislav Ochotnicky 45ce797