Create packaging for neutron-dynamic-routing

This change introduces the initial spec file for neutron-dynamic-routing
and the systemd unit for the BGP dynamic routing agent.

Depends-On: https://review.opendev.org/#/c/683435

Change-Id: I9c517f8b081e8b538813e9f03d76919292ed72ba
This commit is contained in:
Ryan Tidwell
2019-09-18 15:52:56 -05:00
parent 61e6089942
commit 08f25f2798
2 changed files with 141 additions and 0 deletions

View File

@@ -0,0 +1,125 @@
{% set pypi_name = 'neutron-dynamic-routing' %}
{% set source = fetch_source('https://tarballs.openstack.org/neutron-dynamic-routing/neutron-dynamic-routing-master.tar.gz') %}
{% set upstream_version = upstream_version() %}
{% set rpm_release = '1' %}
Name: {{ py2name() }}
Version: {{ py2rpmversion() }}
Release: {{ py2rpmrelease() }}
Epoch: {{ epoch('{{ pypi_name }}') }}
Summary: OpenStack Neutron Dynamic Routing Service
License: {{ license('Apache-2.0') }}
Group: Development/Languages/Python
URL: https://launchpad.net/neutron
Source0: {{ source|basename }}
Source1: openstack-neutron-bgp-dragent.service
BuildRequires: openstack-macros
BuildRequires: {{ py2pkg('neutron') }}
BuildRequires: {{ py3('pbr') }}
Requires: python3-{{ pypi_name }} = %{epoch}:%{version}-%{release}
BuildArch: noarch
%description
Neutron is a virtual network service for Openstack.
This is a dynamic routing service plugin for Openstack Neutron (Networking) service.
%package -n python3-{{ pypi_name }}
Summary: OpenStack Neutron Dynamic Routing Service - Python module
Group: Development/Languages/Python
Requires: {{ py2pkg('neutron') }}
Requires: {{ py3('SQLAlchemy') }}
Requires: {{ py3('alembic') }}
Requires: {{ py3('eventlet') }}
Requires: {{ py3('httplib2') }}
Requires: {{ py3('netaddr') }}
Requires: {{ py3('neutron-lib') }}
Requires: {{ py3('os-ken') }}
Requires: {{ py3('oslo.config') }}
Requires: {{ py3('oslo.db') }}
Requires: {{ py3('oslo.log') }}
Requires: {{ py3('oslo.messaging') }}
Requires: {{ py3('oslo.serialization') }}
Requires: {{ py3('oslo.service') }}
Requires: {{ py3('oslo.utils') }}
Requires: {{ py3('pbr') }}
Requires: {{ py3('six') }}
%description -n python3-{{ pypi_name }}
Neutron is a virtual network service for Openstack.
This is a dynamic routing service plugin for Openstack Neutron (Networking) service.
This package contains the Neutron Dynamic Routing Python library.
%package bgp-dragent
Summary: Neutron Dynamic Routing Agent
Requires: {{ py2name() }} = %{epoch}:%{version}-%{release}
Provides: {{ py2name('neutron') }}-bgp-dragent = %{epoch}:%{version}-%{release}
%description bgp-dragent
Provides BGP dynamic routing services for Neutron.
%package doc
Summary: OpenStack Neutron Dynamic Routing Service - Documentation
Group: Documentation/HTML
BuildRequires: {{ py3('Sphinx') }}
BuildRequires: {{ py3('mock') }}
BuildRequires: {{ py3('openstackdocstheme') }}
BuildRequires: {{ py3('sphinxcontrib-svg2pdfconverter') }}
%description doc
Neutron is a virtual network service for Openstack.
This is a dynamic routing service plugin for Openstack Neutron (Networking) service.
This package contains the documentation.
%prep
%autosetup -p1 -n {{ pypi_name }}-{{upstream_version}}
%py_req_cleanup
%build
%py3_build
# generate html docs
PYTHONPATH=$PWD PBR_VERSION={{ upstream_version }} %sphinx_build --keep-going -b html doc/source doc/build/html
# remove the Sphinx-build leftovers
rm -rf doc/build/html/.{doctrees,buildinfo}
%install
%py3_install
### configuration files
PYTHONPATH=. oslo-config-generator --config-file etc/oslo-config-generator/bgp_dragent.ini
install -p -D -m 644 etc/bgp_dragent.ini.sample %{buildroot}%{_sysconfdir}/neutron/bgp_dragent.ini
### systemd
install -p -D -m 644 %{SOURCE1} %{buildroot}%{_unitdir}/openstack-neutron-bgp-dragent.service
%post
%systemd_post openstack-neutron-bgp-dragent.service
%preun
%systemd_preun openstack-neutron-bgp-dragent.service
%postun
%systemd_postun_with_restart openstack-neutron-bgp-dragent.service
%files
%license LICENSE
%doc README.rst
%config(noreplace) %{_sysconfdir}/neutron/bgp_dragent.ini
%files -n python3-{{ pypi_name }}
%license LICENSE
%{python3_sitelib}/neutron_dynamic_routing
%{python3_sitelib}/neutron_dynamic_routing-*.egg-info
%files bgp-dragent
%license LICENSE
%{_bindir}/neutron-bgp-dragent
%{_unitdir}/openstack-neutron-bgp-dragent.service
%files doc
%license LICENSE
%doc doc/build/html
%changelog

View File

@@ -0,0 +1,16 @@
[Unit]
Description=OpenStack Neutron BGP Dynamic Routing Agent
After=syslog.target network.target mariadb.service postgresql.service rabbitmq-server.service
[Service]
Type=simple
User=neutron
Group=neutron
WorkingDirectory=/var/lib/neutron
ExecStart=/usr/bin/neutron-bgp-dragent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/bgp_dragent.ini
PrivateTmp=false
KillMode=process
Restart=on-failure
[Install]
WantedBy=multi-user.target