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

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


%define component neutron-infoblox

%define version_unconverted 2.0.3.dev102

Name:           openstack-%{component}
Version:        2.0.3.dev102
Release:        0
Summary:        Infoblox IPAM/DNS drivers for OpenStack Networking (Neutron)
License:        Apache-2.0
Group:          System/Management
Url:            https://launchpad.net/networking-infoblox/
Source0:        https://tarballs.openstack.org/networking-infoblox/networking-infoblox-stable-rocky.tar.gz
Source1:        %{name}-ipam-agent.service
BuildRequires:  openstack-suse-macros
BuildRequires:  python-Babel >= 1.3
BuildRequires:  python-devel
BuildRequires:  python-infoblox-client >= 0.4.7
BuildRequires:  python-oslo.i18n >= 2.1.0
BuildRequires:  python-setuptools
# test requirements
BuildRequires:  openstack-neutron-test
BuildRequires:  python-coverage >= 3.6
BuildRequires:  python-kombu
BuildRequires:  python-oslosphinx >= 2.2.0
BuildRequires:  python-oslotest >= 1.2.0
BuildRequires:  python-python-subunit >= 0.0.18
BuildRequires:  python-sphinx >= 1.1.2
BuildRequires:  python-testrepository >= 0.0.18
BuildRequires:  python-testresources >= 0.2.4
BuildRequires:  python-testscenarios >= 0.4
BuildRequires:  python-testtools >= 0.9.36
Requires:       openstack-neutron
Requires:       python-Babel >= 1.3
Requires:       python-infoblox-client >= 0.4.19
Requires:       python-oslo.i18n >= 2.1.0
%{?systemd_requires}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

%package doc
Summary:        Extra documentation for %{name}
Group:          Documentation/HTML
Requires:       %{name} = %{version}

%package ipam-agent
Summary:        IPAM agent for %{name} plugin
Group:          System/Management
Requires:       %{name} = %{version}

%description
Contains Neutron drivers for integration with Infoblox grids for IPAM and DNS.

%description ipam-agent
Contains the IPAM agent service for %{name}

%description doc
This package contains extra documentation for %{name}.

%prep
%setup -q -n networking-infoblox-%{version_unconverted}

%build
python setup.py build
python setup.py build_sphinx
rm doc/build/html/.buildinfo

%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
### init script (systemd)
%__install -p -D -m 444 %{SOURCE1} %{buildroot}/%{_unitdir}/%{name}-ipam-agent.service
mkdir -p %{buildroot}%{_sbindir}
ln -s ../../%{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-ipam-agent
# We don't need this since we supply a systemd unit of our own
rm %{buildroot}/%{_prefix}/etc/init.d/infoblox-ipam-agent

%pre ipam-agent
%service_add_pre %{name}-ipam-agent.service

%post ipam-agent
%service_add_post %{name}-ipam-agent.service

%preun ipam-agent
%service_del_preun %{name}-ipam-agent.service

%postun ipam-agent
%service_del_postun %{name}-ipam-agent.service

%files
%defattr(-,root,root,-)
%doc ChangeLog README.rst AUTHORS
%license LICENSE 
%{python_sitelib}/*
%{_bindir}/create_ea_defs
%{_bindir}/infoblox_grid_sync

%files ipam-agent
%defattr(-,root,root,-)
%{_unitdir}/%{name}-ipam-agent.service
%{_sbindir}/rc%{name}-ipam-agent
%{_bindir}/infoblox-ipam-agent

%files doc
%defattr(-,root,root,-)
%license LICENSE 
%doc doc/build/html

%changelog