File openstack-neutron-l2gw.spec of Package openstack-neutron-l2gw
#
# spec file for package openstack-neutron-l2gw
#
# 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/
#
%global sname networking_l2gw
%global agname openstack-neutron-l2gw-agent
%global common_desc \
This project proposes a Neutron API extension that can be used to express and \
manage L2 Gateway components. In the simplest terms L2 Gateways are meant to \
bridge two or more networks together to make them look as a single L2 broadcast \
domain.
%bcond_without docs
%bcond_without test
Name: openstack-neutron-l2gw
Version: 15.0.1~dev3
Release: 0
Summary: L2 Gateway service for Neutron
License: Apache-2.0
Group: Development/Languages/Python
URL: https://launchpad.net/networking-l2gw
Source0: networking-l2gw-stable-train.tar.gz
Source1: %{agname}.service
BuildRequires: fdupes
BuildRequires: openstack-macros
BuildRequires: python3-pbr
BuildRequires: python3-setuptools
Requires: python3-networking-l2gw = %{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
%if %{with test}
BuildRequires: python3-mock
BuildRequires: python3-neutron
BuildRequires: python3-oslotest
BuildRequires: python3-python-subunit
BuildRequires: python3-requests-mock
BuildRequires: python3-testrepository
BuildRequires: python3-testscenarios
BuildRequires: python3-testtools
%endif
%description
%{common_desc}
%package -n python3-networking-l2gw
Summary: L2 Gateway service for Neutron - python libraries
Group: Development/Languages/Python
Requires: python3-Babel
Requires: python3-neutron
Requires: python3-neutron-lib
Requires: python3-neutronclient
Requires: python3-ovsdbapp
Requires: python3-pbr
%description -n python3-networking-l2gw
%{common_desc}
This package contains the python libraries.
%if %{with docs}
%package doc
Summary: L2 Gateway service for Neutron - Documentation
Group: Documentation/HTML
BuildRequires: python3-Sphinx
BuildRequires: python3-openstackdocstheme
%description doc
%{common_desc}
This package contains the documentation.
%endif
%package -n %{agname}
Summary: Neutron L2 Gateway Agent
Group: Development/Languages/Python
Requires: %{name} = %{version}-%{release}
%description -n %{agname}
%{common_desc}
This package constains the L2 Gateway agent.
%if %{with test}
%package -n python3-networking-l2gw-tests
Summary: L2 Gateway service for neutron - Tests
Group: Development/Languages/Python
Requires: python3-mock
Requires: python3-networking-l2gw = %{version}-%{release}
Requires: python3-oslotest
Requires: python3-python-subunit
Requires: python3-requests-mock
Requires: python3-testrepository
Requires: python3-testresources
Requires: python3-testscenarios
Requires: python3-testtools
%description -n python3-networking-l2gw-tests
%{common_desc}
This package contains the set of tests for L2 Gateway Neutron service.
%endif
%prep
%autosetup -p1 -n networking-l2gw-15.0.1.dev3
%py_req_cleanup
# Remove bundled egg-info
rm -rf %{pypi_name}.egg-info
%build
%py3_build
%if %{with docs}
PBR_VERSION=15.0.1.dev3 %sphinx_build -b html doc/source doc/build/html
# remove the sphinx-build leftovers
rm -rf doc/build/html/.{doctrees,buildinfo}
%fdupes doc/build/html/
%endif
%install
%py3_install
# remove duplicates
%python_expand %fdupes %{buildroot}%{$python3_sitelib}
install -p -D -m 640 etc/l2gateway_agent.ini %{buildroot}%{_sysconfdir}/neutron/l2gateway_agent.ini
install -p -D -m 640 etc/l2gw_plugin.ini %{buildroot}%{_sysconfdir}/neutron/l2gw_plugin.ini
# Install systemd units
install -p -D -m 755 %{SOURCE1} %{buildroot}%{_unitdir}/%{agname}.service
# Remove duplicate config files under /usr/etc/
rm -rf %{buildroot}%{_prefix}/%{_sysconfdir}
%if %{with test}
%check
rm -rf .testrepository
PYTHON=python3 python3 setup.py test
%endif
%post -n %{agname}
%systemd_post %{agname}.service
%preun -n %{agname}
%systemd_preun %{agname}.service
%postun -n %{agname}
%systemd_postun_with_restart %{agname}.service
%files
%doc README.rst
%license LICENSE
%dir %{_sysconfdir}/neutron
%config(noreplace) %attr(-, root, neutron) %{_sysconfdir}/neutron/l2gw_plugin.ini
%files -n python3-networking-l2gw
%license LICENSE
%{python3_sitelib}/%{sname}
%{python3_sitelib}/%{sname}-*.egg-info
%if %{with test}
%exclude %{python3_sitelib}/%{sname}/tests
%endif
%if %{with docs}
%files doc
%license LICENSE
%doc doc/build/html
%endif
%if %{with test}
%files -n python3-networking-l2gw-tests
%license LICENSE
%{python3_sitelib}/%{sname}/tests
%endif
%files -n %{agname}
%license LICENSE
%config(noreplace) %attr(-, root, neutron) %{_sysconfdir}/neutron/l2gateway_agent.ini
%{_bindir}/neutron-l2gateway-agent
%{_unitdir}/%{agname}.service
%changelog