b51cd26
%if 0%{?fedora} > 12 || 0%{?rhel} > 7
Massimo fafe581
%global with_python3 1
Massimo fafe581
%endif
Massimo fafe581
%if 0%{?rhel} == 5
Massimo fafe581
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")}
Massimo fafe581
%endif
Massimo fafe581
Massimo fafe581
%global srcname simplevisor
Massimo fafe581
Massimo fafe581
Name:		python-simplevisor
b51cd26
Version:	1.2
9f55cff
Release:	5%{?dist}
Massimo fafe581
Summary:	Python simple daemons supervisor
Massimo fafe581
Group:		Development/Libraries
Massimo fafe581
License:	ASL 2.0
Massimo 75d1694
URL:		https://github.com/cern-mig/%{name}
b51cd26
Source0:	https://pypi.python.org/packages/ef/a1/d3fef46a01312d8cb470503a476f813bd31abbc2136be37eb9fd1f537b73/%{srcname}-%{version}.tar.gz
Massimo fafe581
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Massimo fafe581
BuildArch:	noarch
Massimo fafe581
BuildRequires:	python2-devel
Massimo fafe581
%if 0%{?with_python3}
Massimo fafe581
BuildRequires:	python3-devel
Massimo fafe581
%endif # if with_python3
b51cd26
Provides:	python2-simplevisor
d4af563
%if 0%{?fedora} >= 24
b51cd26
BuildRequires:	perl-generators
d4af563
%endif
b51cd26
BuildRequires:	perl-No-Worries
b51cd26
Requires:	perl-Config-General
b51cd26
Requires:	perl-No-Worries
Massimo fafe581
%if ! 0%{?with_python3}
Massimo fafe581
BuildRequires:	python-argparse
Massimo fafe581
Requires:	python-argparse
Massimo fafe581
%endif
Massimo fafe581
# For python < 2.6 python-siplejson is required
Massimo fafe581
%if 0%{?fedora} < 11 || 0%{?rhel} <= 6
Massimo fafe581
BuildRequires:	python-simplejson
Massimo fafe581
Requires:	python-simplejson
Massimo fafe581
%endif
Massimo fafe581
Massimo fafe581
%description
Massimo fafe581
Simplevisor is a simple daemons supervisor, it is inspired by
Massimo fafe581
Erlang OTP and it can supervise hierarchies of services.
Massimo fafe581
Massimo fafe581
%if 0%{?with_python3}
Massimo fafe581
%package -n python3-simplevisor
Massimo fafe581
Summary:	Python simple daemons supervisor
Massimo fafe581
Group:		Development/Libraries
Massimo fafe581
Massimo fafe581
%description -n python3-simplevisor
Massimo fafe581
Simplevisor is a simple daemons supervisor, it is inspired by
Massimo fafe581
Erlang OTP and it can supervise hierarchies of services.
Massimo fafe581
%endif # with_python3
Massimo fafe581
Massimo fafe581
%prep
Massimo fafe581
%setup -q -n %{srcname}-%{version}
Massimo fafe581
%if 0%{?with_python3}
b51cd26
rm -fr %{py3dir}
Massimo fafe581
cp -a . %{py3dir}
Massimo fafe581
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
Massimo fafe581
%endif # with_python3
Massimo fafe581
Massimo fafe581
%build 
Massimo fafe581
%{__python} setup.py build
Massimo fafe581
%if 0%{?with_python3}
Massimo fafe581
pushd %{py3dir}
Massimo fafe581
%{__python3} setup.py build
Massimo fafe581
popd
Massimo fafe581
%endif # with_python3
Massimo fafe581
Massimo fafe581
%install
b51cd26
rm -fr $RPM_BUILD_ROOT
b51cd26
%{__python} setup.py install --with-data-files --skip-build --root $RPM_BUILD_ROOT
b51cd26
install -D -m 644 man/%{srcname}.1 $RPM_BUILD_ROOT%{_mandir}/man1/%{srcname}.1;
b51cd26
install -D -m 644 man/%{srcname}-control.1 $RPM_BUILD_ROOT%{_mandir}/man1/%{srcname}-control.1;
b51cd26
install -D -m 644 man/%{srcname}-loop.1 $RPM_BUILD_ROOT%{_mandir}/man1/%{srcname}-loop.1;
Massimo fafe581
%if 0%{?with_python3}
cb9364e
mv $RPM_BUILD_ROOT/usr/bin/simplevisor $RPM_BUILD_ROOT/usr/bin/simplevisor2
Massimo fafe581
pushd %{py3dir}
Massimo b11edb7
%{__python3} setup.py install --with-data-files --skip-build --root $RPM_BUILD_ROOT
cb9364e
mv $RPM_BUILD_ROOT/usr/bin/simplevisor $RPM_BUILD_ROOT/usr/bin/simplevisor3
405959f
cp $RPM_BUILD_ROOT/usr/bin/simplevisor-control $RPM_BUILD_ROOT/usr/bin/simplevisor3-control
cb9364e
cp $RPM_BUILD_ROOT/usr/bin/simplevisor-loop $RPM_BUILD_ROOT/usr/bin/simplevisor3-loop
Massimo fafe581
install -D -m 644 man/%{srcname}.1 $RPM_BUILD_ROOT%{_mandir}/man1/%{srcname}3.1;
Massimo fafe581
install -D -m 644 man/%{srcname}-control.1 $RPM_BUILD_ROOT%{_mandir}/man1/%{srcname}3-control.1;
cb9364e
install -D -m 644 man/%{srcname}-loop.1 $RPM_BUILD_ROOT%{_mandir}/man1/%{srcname}3-loop.1;
Massimo fafe581
popd
cb9364e
mv $RPM_BUILD_ROOT/usr/bin/simplevisor2 $RPM_BUILD_ROOT/usr/bin/simplevisor
Massimo fafe581
%endif # with_python3
Massimo fafe581
Massimo fafe581
%check
Massimo b11edb7
%if 0%{?rhel} == 5
Massimo b11edb7
# syslog in el5 is not configured, workaround for simplevisor-loop
Massimo b11edb7
# in order to pass the tests, does not affect functionality during test
Massimo b11edb7
mkdir Sys
Massimo b11edb7
cp `find %{_libdir}/perl5/5*/ -name "Syslog.pm"` Sys/Syslog.pm
Massimo b11edb7
sed -i "s/^.*grep { \$_ ne 'udp' }.*$/# noop/" Sys/Syslog.pm
Massimo b11edb7
sed -i "s/^.*udp connect: nobody listening.*$/return 1;/g" Sys/Syslog.pm
Massimo b11edb7
export PERL5LIB=.:${PERL5LIB}
Massimo b11edb7
%endif
Massimo fafe581
%{__python} setup.py test
Massimo fafe581
# And remove compiled documentation.
Massimo fafe581
rm -f test/*.pyc
Massimo fafe581
%if 0%{?with_python3}
Massimo fafe581
pushd %{py3dir}
Massimo fafe581
%{__python3} setup.py test
Massimo fafe581
rm -f test/*.pyc
Massimo fafe581
popd
Massimo fafe581
%endif # with_python3
Massimo fafe581
Massimo fafe581
%clean
b51cd26
rm -fr $RPM_BUILD_ROOT
Massimo fafe581
Massimo fafe581
%files
Massimo fafe581
%defattr(-,root,root)
Massimo fafe581
%doc LICENSE README.rst CHANGES examples
Massimo fafe581
%{_mandir}/man?/%{srcname}.1*
Massimo fafe581
%{_mandir}/man?/%{srcname}-control.1*
Massimo fafe581
%{_mandir}/man?/%{srcname}-loop.1*
Massimo fafe581
%attr(755, root, root) /usr/bin/simplevisor
Massimo fafe581
%attr(755, root, root) /usr/bin/simplevisor-control
Massimo fafe581
%attr(755, root, root) /usr/bin/simplevisor-loop
Massimo fafe581
%{python_sitelib}/%{srcname}/
Massimo fafe581
%if 0%{?rhel} != 5
Massimo fafe581
%{python_sitelib}/%{srcname}-%{version}-py?.?.egg-info
Massimo fafe581
%endif
Massimo fafe581
Massimo fafe581
%if 0%{?with_python3}
Massimo fafe581
%files -n python3-simplevisor
Massimo fafe581
%doc LICENSE README.rst CHANGES
Massimo fafe581
%{_mandir}/man?/%{srcname}3.1*
Massimo fafe581
%{_mandir}/man?/%{srcname}3-control.1*
cb9364e
%{_mandir}/man?/%{srcname}3-loop.1*
Massimo fafe581
%attr(755, root, root) /usr/bin/simplevisor3
Massimo fafe581
%attr(755, root, root) /usr/bin/simplevisor3-control
cb9364e
%attr(755, root, root) /usr/bin/simplevisor3-loop
Massimo fafe581
%{python3_sitelib}/%{srcname}-%{version}-py?.?.egg-info
Massimo fafe581
%{python3_sitelib}/%{srcname}/
Massimo fafe581
%endif # with_python3
Massimo fafe581
Massimo fafe581
%changelog
9f55cff
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.2-5
9f55cff
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
9f55cff
53fbced
* Mon Dec 19 2016 Miro HronĨok <mhroncok@redhat.com> - 1.2-4
53fbced
- Rebuild for Python 3.6
53fbced
7155037
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2-3
7155037
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
7155037
cb9364e
* Mon Jul  4 2016 Lionel Cons <lionel.cons@cern.ch> - 1.2-2
cb9364e
- Corrected /usr/bin/simplevisor shebang in Rawhide
cb9364e
b51cd26
* Wed Jun 29 2016 Lionel Cons <lionel.cons@cern.ch> - 1.2-1
b51cd26
- Updated to upstream version (#1351066)
b51cd26
e58eac1
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.1-5
e58eac1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
e58eac1
8dec003
* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1-4
8dec003
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5
8dec003
890cfe7
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1-3
890cfe7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
890cfe7
Adrien Devresse 124674f
* Wed Apr 08 2015 Adrien Devresse <adevress at cern.ch> - 1.1-2
Adrien Devresse 124674f
 - Disable python3 for EPEL7
Adrien Devresse 124674f
Adrien Devresse 5bc435d
* Tue Mar 31 2015 Adrien Devresse <adevress at cern.ch> - 1.1-1
Adrien Devresse 5bc435d
 - Update to upstream 1.1 version
Adrien Devresse 5bc435d
Adrien Devresse c8730a1
* Thu Aug 14 2014 Adrien Devresse <adevress at cern.ch> - 1.0-1
Adrien Devresse c8730a1
 - Update to upstream 1.0 version
Adrien Devresse c8730a1
bcff997
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9-3
bcff997
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
bcff997
1153d45
* Wed May 28 2014 Kalev Lember <kalevlember@gmail.com> - 0.9-2
1153d45
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4
1153d45
Massimo bcd146a
* Sun Mar 09 2014 Massimo Paladin <Massimo.Paladin@gmail.com> - 0.9-1
Massimo bcd146a
- Updating to upstream version, rhbz #1071124.
Massimo bcd146a
0b79fc7
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.8-3
0b79fc7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
0b79fc7
d915369
* Wed Jul 17 2013 Petr Pisar <ppisar@redhat.com> - 0.8-2
d915369
- Perl 5.18 rebuild
d915369
Massimo b11edb7
* Fri Apr 26 2013 Massimo Paladin <Massimo.Paladin@gmail.com> - 0.8-1
Massimo b11edb7
- Updating to upstream 0.8.
Massimo b11edb7
Massimo ba283c9
* Mon Jan 28 2013 Massimo Paladin <Massimo.Paladin@gmail.com> - 0.7-1
Massimo ba283c9
- Updating to upstream 0.7.
Massimo ba283c9
Massimo fafe581
* Thu Jan 17 2013 Massimo Paladin <Massimo.Paladin@gmail.com> - 0.6-1
Massimo fafe581
- Updating to upstream 0.6.
Massimo fafe581
Massimo fafe581
* Fri Nov 30 2012 Massimo Paladin <Massimo.Paladin@gmail.com> - 0.5-2
Massimo fafe581
- Use macros consistently.
Massimo fafe581
Massimo fafe581
* Fri Sep 14 2012 Massimo Paladin <Massimo.Paladin@gmail.com> - 0.5-1
Massimo fafe581
- Updating to version 0.5.
Massimo fafe581
Massimo fafe581
* Thu Jul 05 2012 Massimo Paladin <Massimo.Paladin@gmail.com> - 0.4-1
Massimo fafe581
- Updating to version 0.4.
Massimo fafe581
Massimo fafe581
* Mon Jun 25 2012 Massimo Paladin <Massimo.Paladin@gmail.com> - 0.3-1
Massimo fafe581
- Updating to version 0.3.
Massimo fafe581
Massimo bcd146a
* Wed Mar 14 2012 Massimo Paladin <Massimo.Paladin@gmail.com> - 0.2-1
Massimo fafe581
- Improvements.
Massimo fafe581
Massimo bcd146a
* Sun Mar 11 2012 Massimo Paladin <Massimo.Paladin@gmail.com> - 0.1-1
Massimo fafe581
- Initial packaging.