%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
# The package contains python code in /usr/share that is not executed on
# the machine where it is installed. Instead, it is distributed to its
# slaves to be executed there. To exclude these modules from the automatic
# byte compilation, we turn off the global byte-compile script here and
# compile the rest of the code manually.
%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g')
# Macros for manual byte-compilation of python modules
%include %{_rpmconfigdir}/macros.python
%global commit 269de0ac27880df06d25fb59b3450e92be50437d
%global checkout 20130717git
Name: lnst
Version: 0.1
Release: 0.6.%{checkout}%{?dist}
Summary: Common code for lnst-ctl and lnst-slave
Requires: python2
License: GPLv2+
URL: https://fedorahosted.org/%{name}
Source0: http://git.fedorahosted.org/cgit/%{name}.git/snapshot/%{name}-%{commit}.tar.gz
BuildRequires: python2-devel, systemd-units
BuildArch: noarch
%package ctl
Summary: Linux Network Stack Test Controller
Requires: %{name} = %{version}-%{release}
%package slave
Summary: Linux Network Stack Test Slave Daemon
Requires: %{name} = %{version}-%{release}
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
%description
Linux Network Stack Test is a tool useful for developing and performing
automated network tests. LNST focuses on maximum portability of the
so-called recipes (descriptions of test cases and scenarios).
This package contains the code that is common for both LNST controller
and LNST slave.
%description ctl
LNST controller is able to communicate with networks of LNST slave
daemons and execute tests on them.
%description slave
LNST slave is a daemon that waits for instructions from LNST controller.
It is able to react to a variety of commands from the controller and act
as a test node for executing network tests.
%prep
%setup -q -n %{name}-%{commit}
%build
%{__python} setup.py build
%install
%{__python} setup.py install --root=%{buildroot}
install -D -m 0644 dist/%{name}-slave.service %{buildroot}/%{_unitdir}/%{name}-slave.service
# Manually compile files in python sitelib that need bytecompilation
%py_comp %{buildroot}%{python_sitelib}
%py_ocomp %{buildroot}%{python_sitelib}
%post slave
%systemd_post lnst-slave.service
%preun slave
%systemd_preun lnst-slave.service
%postun slave
%systemd_postun_with_restart lnst-slave.service
%files
%doc README COPYING
%dir %{python_sitelib}/%{name}/
%{python_sitelib}/%{name}/__init__.*
%{python_sitelib}/%{name}/Common/
%{python_sitelib}/%{name}-git-py2.7.egg-info
%files ctl
%{python_sitelib}/%{name}/Controller/
%{_bindir}/%{name}-ctl
%{_mandir}/man1/%{name}-ctl.1.*
%config(noreplace) %{_sysconfdir}/%{name}-ctl.conf
%{_datadir}/%{name}/
%files slave
%{python_sitelib}/%{name}/Slave/
%{_bindir}/%{name}-slave
%{_mandir}/man1/%{name}-slave.1.*
%config(noreplace) %{_sysconfdir}/%{name}-slave.conf
%{_unitdir}/%{name}-slave.service
%changelog
* Wed Jul 17 2013 Radek Pazdera <rpazdera@redhat.com> - 0.1-0.6.20130717git
- Update to commit 269de0a
* Wed Feb 06 2013 Radek Pazdera <rpazdera@redhat.com> - 0.1-0.5.20130206git
- Update to commit f901a34
* Thu Jan 15 2013 Radek Pazdera <rpazdera@redhat.com> - 0.1-0.4.20121204git
- removed -common subpackage, its content was moved to the base package
- fixed release number to meet the conventions for pre-release packages
- fixed inaccurate license
* Thu Jan 10 2013 Radek Pazdera <rpazdera@redhat.com> - 0.1-0.3.20121204git
- removed dependency on python3-devel for python bytecompile macros
- use py_copmp and py_ocomp macros from macros.python instead
* Thu Jan 03 2013 Radek Pazdera <rpazdera@redhat.com> - 0.1-0.2.20121204git
- Added a comment explaining disabling global byte-compile
- Removed superfluous dependency on python runtime
- Fixed a problem with unowned directories
- Man pages are now included by a wild-card
- Added proper systemd service handling
* Mon Dec 04 2012 Radek Pazdera <rpazdera@redhat.com> - 0.1-0.1.20121204git
- Initial package