LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File exabgp.spec of Package exabgp (Project home:darix:routing)

#
# spec file for package exabgp
#
# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

%if 0%{?suse_version} > 1210 || 0%{?rhel_version} > 6 || 0%{?centos_version} > 6 || 0%{?fedora_version} >= 20 || 0%{?el7}%{?fc20}%{?fc21}%{?fc22}
%bcond_without systemd
%else
%bcond_with    systemd
%endif

Name:           exabgp
Version:        4.0.6
Release:        0
License:        BSD-3-Clause
Summary:        The BGP swiss army knife of networking
Url:            https://github.com/Exa-Networks/exabgp
Group:          Productivity/Networking/Routing
Source:         https://pypi.python.org/packages/source/e/exabgp/exabgp-%{version}.tar.gz
BuildRequires:  python3-devel
BuildRequires:  python3-ipaddr
BuildRequires:  python3-setuptools
Requires:       python3-ipaddr
Requires:       python3-setuptools
Requires:       python3
Obsoletes:      python-%{name}
Provides:       python3-%{name} = %{version}-%{release}
%if %{with systemd}
BuildRequires:  pkgconfig(systemd)
%{?systemd_requires}
%else
%if 0%{?suse_version}
Requires(pre):  %insserv_prereq
%endif
%endif
%if 0%{?suse_version}
Requires(pre):  %fillup_prereq
%endif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

%description
ExaBGP allows engineers to control their network from commodity servers. Think
of it as Software Defined Networking using BGP by transforming BGP messages
into friendly plain text or JSON.

It comes with an healthcheck application to help you monitor your daemons and
withdraw dead ones from the network during failures/maintenances. A full lab
explaining how to use it is available here.

Find what other users have done with it. Current documented use cases include
DDOS mitigation, network visualisation, anycast, service high availability.

%prep
%setup -q

%build
perl -p -i -e 's,#!/usr/bin/(env python|python),#!/usr/bin/python3,g' $(grep -E -l '#!/usr/bin/(env python|python)' -r .)
python3 setup.py build

%install
python3 setup.py install --prefix=%{_prefix} --root=%{buildroot}

mv %{buildroot}%{_bindir} %{buildroot}%{_sbindir}

install -d %{buildroot}%{_sysconfdir}/%{name}/
#mv %{buildroot}%{_prefix}/etc/%{name}/ %{buildroot}%{_sysconfdir}/
cp -a etc/exabgp examples
chmod -R go= %{buildroot}%{_sysconfdir}/%{name}

install -D -m 0644 doc/man/exabgp.1      %{buildroot}%{_mandir}/man1/exabgp.1
install -D -m 0644 doc/man/exabgp.conf.5 %{buildroot}%{_mandir}/man5/exabgp.conf.5

%if %{with systemd}
install -D -m 0644 etc/systemd/exabgp.service %{buildroot}%{_unitdir}/exabgp.service
install -D -m 0644 etc/systemd/exabgp@.service %{buildroot}%{_unitdir}/exabgp@.service
ln -s service %{buildroot}%{_sbindir}/rc%{name}
%endif

%if %{with systemd}
%pre
%service_add_pre %{name}.service

%preun
%service_del_preun %{name}.service

%post
%service_add_post %{name}.service

%postun
%service_del_postun %{name}.service
%endif

%files
%defattr(-,root,root)
%config(noreplace) %{_sysconfdir}/%{name}
%if %{with systemd}
%{_sbindir}/rc%{name}
%{_unitdir}/exabgp.service
%{_unitdir}/exabgp@.service
%endif
%{_mandir}/man1/exabgp.1*
%{_mandir}/man5/exabgp.conf.5*
%doc CHANGELOG COPYRIGHT PEP8 PYPI.rst README.md
%{_sbindir}/exabgpcli
%{_sbindir}/%{name}
%{python3_sitelib}/%{name}-%{version}*/
%{python3_sitelib}/%{name}/
%{_datadir}/%{name}/