From 45ce797acb9274c2323948cb0b441bc1f8c0c7c2 Mon Sep 17 00:00:00 2001 From: Stanislav Ochotnicky Date: May 02 2014 12:21:12 +0000 Subject: Initial commit into Fedora git --- diff --git a/.gitignore b/.gitignore index e69de29..b21b601 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/fedwatch-0.4.tar.gz diff --git a/fedwatch.spec b/fedwatch.spec new file mode 100644 index 0000000..66b60ef --- /dev/null +++ b/fedwatch.spec @@ -0,0 +1,135 @@ +%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} + + +Name: fedwatch +Version: 0.4 +Release: 2%{?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: python-setuptools +BuildRequires: python-dpath +BuildRequires: fedmsg + +Requires: python-%{name} = %{version}-%{release} +Requires: python-dpath +Requires: fedmsg +Requires: python-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 python-%{name} +Summary: Python 2 module for watching fedmsg messages and running arbitrary scripts + +%description -n python-%{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 python-%{name} +%{python_sitelib}/fedwatch* + + +%changelog +* Tue Apr 29 2014 Stanislav Ochotnicky - 0.4-2 +- Fix changelog +- Make sure documentation is not executable + +* Tue Apr 29 2014 Stanislav Ochotnicky - 0.4-1 +- Update to latest upstream + +* Thu Mar 20 2014 Stanislav Ochotnicky - 0.3-1 +- Update to new upstream version +- Handle errors a bit better + +* Thu Mar 20 2014 Stanislav Ochotnicky - 0.2-1 +- Update to new upstream version +- Add support for systemd and init + +* Wed Mar 19 2014 Stanislav Ochotnicky - 0.1-1 +- Initial packaging + diff --git a/sources b/sources index e69de29..bc9e641 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +35522d0a446dd8451efb82f5145803e1 fedwatch-0.4.tar.gz