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

#
# spec file for package openstack-neutron-gbp
#
# 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 gbpservice

%if ! %{defined _rundir}
%define _rundir %{_localstatedir}/run
%endif

%define version_unconverted 5.0.1.dev470

Name:           openstack-neutron-gbp
Version:        5.0.1~dev470
Release:        0
Summary:        Openstack Group Based Policy
License:        Apache-2.0
Group:          System/Management
Url:            https://launchpad.net/group-based-policy
Source:         http://tarballs.openstack.org/group-based-policy/group-based-policy-master.tar.gz
BuildRequires:  crudini
BuildRequires:  fdupes
BuildRequires:  openstack-suse-macros
BuildRequires:  python-Sphinx
BuildRequires:  python-devel
BuildRequires:  python-oslosphinx
BuildRequires:  python-pbr
Requires:       python >= 2.6.8
Requires:       python-neutron-gbp = %{version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%py_requires
%else
BuildArch:      noarch
%endif
PreReq:         %fillup_prereq

%description
Group Based Policy (GBP) provides declarative abstractions for achieving
scalable intent-based infrastructure automation.
        
GBP complements the OpenStack networking model with the notion of policies
that can be applied between groups of network endpoints. As users look beyond
basic connectivity, richer network services with diverse implementations and
network properties are naturally expressed as policies. Examples include
service chaining, QoS, path properties, access control, etc.

%package -n     python-neutron-gbp
Summary:        OpenStack Group Based Policy - Python module
Group:          Development/Languages/Python
Requires:       python >= 2.6.8
Requires:       python-httplib2 >= 0.9.1
Requires:       python-pbr >= 2.0.0

%description -n python-neutron-gbp
This package contains the core Python module of Group Based Policy (GBP)

%package test
Summary:        OpenStack Group Based Policy - Testsuite
Group:          Development/Languages/Python
Requires:       %{name} = %{version}
Requires:       openstack-tempest
Requires:       python-WebTest >= 2.0.27
Requires:       python-cliff >= 2.8.0
Requires:       python-ddt >= 1.0.1
Requires:       python-fixtures >= 3.0.0
Requires:       python-mock >= 2.0
Requires:       python-os-testr >= 1.0.0
Requires:       python-oslotest >= 3.2.0
Requires:       python-python-subunit >= 1.0.0
Requires:       python-reno >= 2.5.0
Requires:       python-requests-mock >= 1.1
Requires:       python-testrepository >= 0.0.18
Requires:       python-testresources >= 2.0.0
Requires:       python-testscenarios >= 0.4
Requires:       python-testtools >= 2.2.0

%description test
OpenStack Group Based Policy - Testsuite

%prep
%setup -q -n group-based-policy-%{version_unconverted}
%openstack_cleanup_prep

%build
python setup.py build
python setup.py build_sphinx -b man
#tools/config/generate_sample.sh -p gbpservice

%install
python setup.py install --skip-build --prefix=%{_prefix} --root=%{buildroot} --install-data=/

# move configfiles into the probper location
install -d -m 755 %{buildroot}%{_sysconfdir}/neutron
mv %{buildroot}%{_sysconfdir}/group-based-policy %{buildroot}%{_sysconfdir}/neutron/

### test subpackage
%openstack_test_package_install
%fdupes %{buildroot}%{_localstatedir}/lib/%{name}-test

### misc
%fdupes %{buildroot}%{python_sitelib}/%{component}
%fdupes %{buildroot}%{_bindir}

%files
%defattr(-,root,root,-)
%doc LICENSE README.rst
%dir %{_sysconfdir}/neutron
%dir %{_sysconfdir}/neutron/group-based-policy
%dir %{_sysconfdir}/neutron/group-based-policy/policy.d/
%config(noreplace) %attr(0640, root, neutron) %{_sysconfdir}/neutron/group-based-policy/*.ini
%config(noreplace) %attr(0640, root, neutron) %{_sysconfdir}/neutron/group-based-policy/policy.d/policy.json
%dir %{_sysconfdir}/neutron/group-based-policy/drivers
%config(noreplace) %attr(0640, root, neutron) %{_sysconfdir}/neutron/group-based-policy/drivers/*.ini
%config(noreplace) %attr(0640, root, neutron) %{_sysconfdir}/*.ini
%{_bindir}/gbp-db-manage
%{_bindir}/gbp-validate
%{_bindir}/nfp
%{_bindir}/nfp_proxy

%files -n python-neutron-gbp
%defattr(-,root,root,-)
%doc LICENSE
%{python_sitelib}/%{component}/
%{python_sitelib}/group_based_policy-*.egg-info
# Part of test subpackage
%exclude %{python_sitelib}/%{component}/tests/

%files test
%defattr(-,root,root)
%{python_sitelib}/%{component}/tests/
%{_localstatedir}/lib/%{name}-test/

%changelog