File openstack-neutron-vpnaas.spec of Package openstack-neutron-vpnaas

#
# spec file for package openstack-neutron-vpnaas
#
# Copyright (c) 2020 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#


Name:           openstack-neutron-vpnaas
Version:        17.1.0~dev7
Release:        0
Summary:        OpenStack Neutron VPN Service
License:        Apache-2.0
Group:          Development/Languages/Python
URL:            https://docs.openstack.org/neutron
Source0:        neutron-vpnaas-master.tar.gz
# systemd service files
Source10:       openstack-neutron-vyatta-agent.service
BuildRequires:  openstack-macros
BuildRequires:  openstack-neutron
BuildRequires:  python3-pbr
Requires:       python3-neutron-vpnaas = %{version}-%{release}
BuildArch:      noarch
%if 0%{?suse_version}
BuildRequires:  systemd-rpm-macros
%{?systemd_requires}
%else
BuildRequires:  systemd
Requires(post): systemd
Requires(postun): systemd
Requires(preun): systemd
%endif

%description
Neutron is a virtual network service for Openstack.
This is a VPN service plugin for Openstack Neutron (Networking) service.

%package -n python3-neutron-vpnaas
Summary:        Neutron VPN Python libraries
Group:          Development/Languages/Python
Requires:       openstack-neutron
Requires:       python3-Jinja2
Requires:       python3-SQLAlchemy
Requires:       python3-alembic
Requires:       python3-netaddr
Requires:       python3-neutron-lib
Requires:       python3-oslo.concurrency
Requires:       python3-oslo.config
Requires:       python3-oslo.db
Requires:       python3-oslo.log
Requires:       python3-oslo.messaging
Requires:       python3-oslo.reports
Requires:       python3-oslo.serialization
Requires:       python3-oslo.service
Requires:       python3-oslo.utils
Requires:       python3-pbr
Requires:       python3-requests
Requires:       python3-six

%description -n   python3-neutron-vpnaas
Neutron is a virtual network service for Openstack.
This is a VPN service plugin for Openstack Neutron (Networking) service.

This package contains the Neutron VPN Python library.

%package doc
Summary:        Neutron VPN as a Service - Documentation
Group:          Documentation/HTML
BuildRequires:  python3-Sphinx
BuildRequires:  python3-openstackdocstheme

%description doc
Neutron is a virtual network service for Openstack.
This is a VPN service plugin for Openstack Neutron (Networking) service.

This package contains the Neutron VPN documentation.

%package -n openstack-neutron-vyatta-agent
Summary:        Neutron VPN as a Service - Load Balancing Agent for Brocade Vyatta
Group:          Development/Languages/Python
Requires:       %{name} = %{version}-%{release}

%description -n openstack-neutron-vyatta-agent
Neutron is a virtual network service for Openstack.
This is a VPN service plugin for Openstack Neutron (Networking) service.

This package contains the Brocade Vyatta agent

%prep
%autosetup -p1 -n neutron-vpnaas-17.1.0.dev7
%py_req_cleanup

%build
%py3_build

# generate html docs
PYTHONPATH=$PWD PBR_VERSION=17.1.0.dev7 %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
for x in `ls etc/oslo-config-generator/*`; do
    PYTHONPATH=. oslo-config-generator --config-file $x
done

install -p -D -m 644 etc/neutron_vpnaas.conf.sample %{buildroot}%{_sysconfdir}/neutron/neutron_vpnaas.conf
install -p -D -m 644 etc/vpn_agent.ini.sample %{buildroot}%{_sysconfdir}/neutron/vpn_agent.ini

# move wrongly installed files from /usr/etc to /etc
install -d -m 755 %{buildroot}%{_datarootdir}/neutron/rootwrap
mv %{buildroot}/%{_prefix}/%{_sysconfdir}/neutron/rootwrap.d/* %{buildroot}%{_datarootdir}/neutron/rootwrap

### systemd
mkdir -p %{buildroot}%{_sbindir} %{buildroot}%{_unitdir}
install -p -D -m 444 %{SOURCE10} %{buildroot}%{_unitdir}/openstack-neutron-vyatta-agent.service
%if 0%{?suse_version}
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcopenstack-neutron-vyatta-agent
%endif

%post -n openstack-neutron-vyatta-agent
%systemd_post openstack-neutron-vyatta-agent.service

%preun -n openstack-neutron-vyatta-agent
%systemd_preun openstack-neutron-vyatta-agent.service

%postun -n openstack-neutron-vyatta-agent
%systemd_postun_with_restart openstack-neutron-vyatta-agent.service

%files
%license LICENSE
%doc README.rst
%config(noreplace) %{_sysconfdir}/neutron/neutron_vpnaas.conf
%config(noreplace) %{_sysconfdir}/neutron/vpn_agent.ini
%dir %{_datarootdir}/neutron/rootwrap
%{_datarootdir}/neutron/rootwrap/vpnaas.filters
%{_bindir}/neutron-vpn-netns-wrapper

%files -n python3-neutron-vpnaas
%license LICENSE
%{python3_sitelib}/neutron_vpnaas
%{python3_sitelib}/neutron_vpnaas-*.egg-info

%files doc
%license LICENSE
%doc doc/build/html

%files -n openstack-neutron-vyatta-agent
%license LICENSE
%{_unitdir}/openstack-neutron-vyatta-agent.service
%if 0%{?suse_version}
%{_sbindir}/rcopenstack-neutron-vyatta-agent
%endif

%changelog