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


Name:           fedwatch
Version:        0.5
Release:        10%{?dist}
Summary:        Tool for watching fedmsg messages and running arbitrary scripts

Group:          Development/Languages
License:        LGPLv2+
URL:            https://github.com/sochotnicky/fedwatch
Source0:        https://pypi.python.org/packages/source/f/fedwatch/fedwatch-%{version}.tar.gz

BuildArch:      noarch
BuildRequires:  python2-devel
BuildRequires:  python2-setuptools
BuildRequires:  python2-dpath
BuildRequires:  fedmsg

Requires:       python2-%{name} = %{version}-%{release}
Requires:       python2-dpath
Requires:       fedmsg
Requires:       python2-fedmsg-meta-fedora-infrastructure
%if 0%{?rhel} && 0%{?rhel} < 7
Requires(post): chkconfig
Requires(preun): chkconfig
# This is for /sbin/service
Requires(preun): initscripts
%else
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
BuildRequires: systemd
%endif

%description
Tool and library for watching fedmsg messages and running arbitrary scripts in a
nice way. 

Think of fedwatch as simple converter from fedmsg json messages into shell
arguments for scripts.

%package -n python2-%{name}
%{?python_provide:%python_provide python2-%{name}}
Summary:        Python 2 module for watching fedmsg messages and running arbitrary scripts

%description -n python2-%{name}
%{summary}.

%prep
%setup -q -n fedwatch-%{version}
chmod -x examples/fedwatch.d/*
# get rid of hashbang
sed -i '1{d}' fedwatch.py

%build
CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build

%install
%{__python} setup.py install --skip-build --root %{buildroot}

# create initial config
mkdir %{buildroot}%{_sysconfdir}
cat > %{buildroot}%{_sysconfdir}/%{name}.conf << EOF
# Empty configuration file. See /usr/share/doc/%{name}*/examples
# for working examples
EOF

mkdir %{buildroot}%{_sysconfdir}/%{name}.d/

# install init/systemd integration
%if 0%{?rhel} && 0%{?rhel} < 7
mkdir -p %{buildroot}/%{_initddir}
cp fedwatch.init %{buildroot}/%{_initddir}/fedwatch
%else
mkdir -p %{buildroot}/%{_unitdir}
cp fedwatch.service %{buildroot}/%{_unitdir}/
%endif


%if 0%{?rhel} && 0%{?rhel} < 7
%post
# This adds the proper /etc/rc*.d links for the script
/sbin/chkconfig --add fedwatch

%preun
if [ $1 -eq 0 ] ; then
    /sbin/service fedwatch stop >/dev/null 2>&1
    /sbin/chkconfig --del fedwatch
fi
%else
%post
%systemd_post fedwatch.service

%preun
%systemd_preun fedwatch.service

%postun
%systemd_postun_with_restart fedwatch.service
%endif

%files
%doc README.md LICENSE
%doc examples
%{_bindir}/fedwatch
%config(noreplace) %{_sysconfdir}/fedwatch.conf
%dir %{_sysconfdir}/fedwatch.d
%if 0%{?rhel} && 0%{?rhel} < 7
%attr(755, root, root) %{_initddir}/fedwatch
%else
%{_unitdir}/fedwatch.service
%endif

%files -n python2-%{name}
%{python2_sitelib}/fedwatch*


%changelog
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.5-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

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

* Tue Feb 06 2018 Iryna Shcherbina <ishcherb@redhat.com> - 0.5-8
- Update Python 2 dependency declarations to new packaging standards
  (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)

* Sat Aug 19 2017 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 0.5-7
- Python 2 binary package renamed to python2-fedwatch
  See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3

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

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

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

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

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

* Tue Jun 10 2014 Stanislav Ochotnicky <sochotnicky@redhat.com> - 0.5-1
- Update to latest upstream
- Fix handling of non-string arguments for scripts

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

* Tue Apr 29 2014 Stanislav Ochotnicky <sochotnicky@redhat.com> - 0.4-2
- Fix changelog
- Make sure documentation is not executable

* Tue Apr 29 2014 Stanislav Ochotnicky <sochotnicky@redhat.com> - 0.4-1
- Update to latest upstream

* Thu Mar 20 2014 Stanislav Ochotnicky <sochotnicky@redhat.com> - 0.3-1
- Update to new upstream version
- Handle errors a bit better

* Thu Mar 20 2014 Stanislav Ochotnicky <sochotnicky@redhat.com> - 0.2-1
- Update to new upstream version
- Add support for systemd and init

* Wed Mar 19 2014 Stanislav Ochotnicky <sochotnicky@redhat.com> - 0.1-1
- Initial packaging