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

%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-networking-l2gw
Version:        13.0.1~dev1
Release:        0
Epoch:          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-rocky.tar.gz
Source1:        %{agname}.service
BuildRequires:  fdupes
BuildRequires:  openstack-macros
BuildRequires:  python-pbr
Requires:       openstack-neutron
Requires:       python-networking-l2gw = %{version}-%{release}
Requires:       python-pbr
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:  openstack-neutron
BuildRequires:  python-mock
BuildRequires:  python-oslotest
BuildRequires:  python-python-subunit
BuildRequires:  python-requests-mock
BuildRequires:  python-testrepository
BuildRequires:  python-testscenarios
BuildRequires:  python-testtools
%endif

%description
%{common_desc}

%package -n python-networking-l2gw
Summary:        L2 Gateway service for Neutron - python libraries
Requires:       python-Babel
Requires:       python-neutron-lib
Requires:       python-neutronclient
Requires:       python-ovsdbapp
Requires:       python-pbr

%description -n python-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:  python-Sphinx
BuildRequires:  python-openstackdocstheme
BuildRequires:  python-oslosphinx

%description doc
%{common_desc}

This package contains the documentation.
%endif

%package -n %{agname}
Summary:    Neutron L2 Gateway Agent
Requires:   %{name} = %{epoch}:%{version}-%{release}

%description -n %{agname}
%{common_desc}

This package constains the L2 Gateway agent.

%if %{with test}
%package -n python-networking-l2gw-tests
Summary:    L2 Gateway service for neutron - Tests
Requires:   python-mock
Requires:   python-oslotest
Requires:   python-python-subunit
Requires:   python-requests-mock
Requires:   python-testrepository
Requires:   python-testresources
Requires:   python-testscenarios
Requires:   python-testtools

%description -n python-networking-l2gw-tests
%{common_desc}

This package contains the set of tests for L2 Gateway Neutron service.
%endif

%prep
%autosetup -p1 -n networking-l2gw-13.0.1.dev1
%py_req_cleanup

# Remove bundled egg-info
rm -rf %{pypi_name}.egg-info

%build
%py2_build

%if %{with docs}
PBR_VERSION=13.0.1.dev1 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
%py2_install

# remove duplicates
%python_expand %fdupes %{buildroot}%{$python_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
%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 python-networking-l2gw
%license LICENSE
%{python_sitelib}/%{sname}
%{python_sitelib}/%{sname}-*.egg-info
%if %{with test}
%exclude %{python_sitelib}/%{sname}/tests
%endif

%if %{with docs}
%files doc
%license LICENSE
%doc doc/build/html
%endif

%if %{with test}
%files -n python-networking-l2gw-tests
%license LICENSE
%{python_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
openSUSE Build Service is sponsored by