File openstack-quantum.spec of Package openstack-quantum.1429

#
# spec file for package openstack-quantum
#
# Copyright (c) 2013 SUSE LINUX Products 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 http://bugs.opensuse.org/
#


%define component quantum
%define groupname openstack-%{component}
%define username openstack-%{component}

Name:           openstack-%{component}
Version:        2012.2.4+git.1362583635.f94b149
Release:        0
Summary:        OpenStack Virtual Network Service (Quantum)
License:        Apache-2.0
Group:          System/Management
Url:            https://launchpad.net/quantum
Source:         quantum-stable-folsom.tar.gz
Source1:        openstack-quantum.init
Source2:        %{name}.logrotate
BuildRequires:  fdupes
BuildRequires:  openstack-macros
BuildRequires:  python-Sphinx
BuildRequires:  python-base
BuildRequires:  python-distribute
Requires:       logrotate
Requires:       python >= 2.6.8
Requires:       python-quantum = %{version}
%if 0%{?suse_version} > 1110
Requires(pre):  pwdutils
%else
Requires(pre):  shadow-utils
%endif
%if 0%{?fedora}
Requires(pre):  shadow-utils
%endif
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

%description
Quantum is a virtual network service for Openstack.

Just like OpenStack Nova provides an API to dynamically request and
configure virtual servers, Quantum provides an API to dynamically
request and configure virtual networks. These networks connect
"interfaces" from other OpenStack services (e.g., vNICs from Nova VMs).
The Quantum API supports extensions to provide advanced network
capabilities (e.g., QoS, ACLs, network monitoring, etc)

%package -n python-quantum
Summary:        OpenStack Virtual Network Service (Quantum) - Python module
Group:          Development/Languages/Python
Requires:       python >= 2.6.8
Requires:       python-Paste
Requires:       python-PasteDeploy
Requires:       python-Routes
Requires:       python-SQLAlchemy
Requires:       python-WebOb
Requires:       python-amqplib
Requires:       python-anyjson
Requires:       python-eventlet
Requires:       python-greenlet
Requires:       python-httplib2
Requires:       python-iso8601
Requires:       python-kombu
Requires:       python-lxml
Requires:       python-netaddr
Requires:       python-pyudev
Requires:       python-quantumclient

%description -n python-quantum
This package contains the core Python module of OpenStack Quantum.

%package doc
Summary:        OpenStack Virtual Network Service (Quantum) - Documentation
Group:          Documentation/HTML

%description doc
Quantum is a virtual network service for Openstack.

This package contains documentation files for openstack-quantum.

%package test
Summary:        OpenStack Virtual Network Service (Quantum) - Testsuite
Group:          Development/Languages/Python
Requires:       %{name} = %{version}
Requires:       python-WebTest
Requires:       python-cliff
Requires:       python-configobj
Requires:       python-coverage
Requires:       python-mock
Requires:       python-mox
Requires:       python-nose
Requires:       python-nosehtmloutput
Requires:       python-nosexcover
Requires:       python-openstack.nose_plugin
Requires:       python-pep8
Requires:       python-unittest2

%description test
The OpenStack Quantum testsuite. It is used to verify the functionality
of OpenStack Quantum.

%prep
%setup -q -n quantum-2012.2.4
%openstack_cleanup_prep
# FIX-UPSTREAM saschpe@suse.de -- Backport of https://review.openstack.org/17337
rm {bin,tools}/__init__.py

%build
python setup.py build
python setup.py build_sphinx
python setup.py build_sphinx -b man

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

# Fix python-bytecode-inconsistent-mtime:
pushd %{buildroot}%{python_sitelib}
%py_compile .
popd

### directories
install -d -m 755 %{buildroot}%{_localstatedir}/run/quantum
install -d -m 755 %{buildroot}%{_localstatedir}/log/quantum

### configuration files
# all needed files are installed automatically
install -p -D -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}

### init scripts
rm %{buildroot}%{_initddir}/quantum-server
install -p -D -m 755 %{SOURCE1} %{buildroot}%{_initddir}/%{name}
mkdir -p %{buildroot}%{_sbindir}
ln -s ../..%{_initddir}/%{name} %{buildroot}%{_sbindir}/rc%{name}

### documentation
rm -rf doc/build/html/{.buildinfo,.doctrees}
%fdupes -s doc/build/html/
install -d %{buildroot}%{_mandir}/man1
install -m 644 doc/build/man/*.1 %{buildroot}%{_mandir}/man1

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

#TODO/FIXME: there's an upstream discussion on how to install these,
# it's related to setuptools_git / MANIFEST.in issues.
for i in quantum/tests/unit/nicira/etc/* \
         quantum/tests/etc/rootwrap.d/quantum.test.filters \
         quantum/tests/etc/api-paste.ini.test \
         quantum/plugins/cisco/tests/unit/v2/ucs/fake_ucs_inventory.ini \
         quantum/plugins/cisco/tests/unit/v2/api-paste.ini.cisco.test \
         quantum/plugins/cisco/tests/unit/v2/quantumv2.conf.cisco.test \
         quantum/plugins/cisco/tests/unit/quantum.conf.cisco.test \
         quantum/plugins/cisco/tests/unit/api-paste.ini.cisco.test \
         quantum/plugins/openvswitch/agent/ovs-quantum-agent-xs_xcp.spec \
         quantum/plugins/openvswitch/agent/xenserver_install.sh \
         quantum/tests/etc/quantum.conf.test ; do
    install -D $i %{buildroot}%{python_sitelib}/$i
done

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

%pre
getent group %{groupname} > /dev/null || groupadd -r %{groupname}
getent passwd %{username} > /dev/null || \
    useradd -r -g %{groupname} -d %{_localstatedir}/lib/nova -s /sbin/nologin \
    -c "Openstack Quantum Daemons" %{username}
exit 0

%post
%{fillup_and_insserv -f openstack-quantum}

%preun
%stop_on_removal openstack-quantum

%postun
%restart_on_update openstack-quantum
%insserv_cleanup

%files
%defattr(-,root,root,-)
%doc LICENSE README
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%dir %{_sysconfdir}/quantum
%config(noreplace) %{_sysconfdir}/quantum/api-paste.ini
%config(noreplace) %{_sysconfdir}/quantum/dhcp_agent.ini
%config(noreplace) %{_sysconfdir}/quantum/l3_agent.ini
%dir %{_sysconfdir}/quantum/plugins
%dir %{_sysconfdir}/quantum/plugins/cisco/
%dir %{_sysconfdir}/quantum/plugins/linuxbridge/
%dir %{_sysconfdir}/quantum/plugins/metaplugin/
%dir %{_sysconfdir}/quantum/plugins/nec/
%dir %{_sysconfdir}/quantum/plugins/nicira/
%dir %{_sysconfdir}/quantum/plugins/openvswitch/
%dir %{_sysconfdir}/quantum/plugins/ryu/
%config(noreplace) %{_sysconfdir}/quantum/policy.json
%config(noreplace) %{_sysconfdir}/quantum/quantum.conf
%config(noreplace) %{_sysconfdir}/quantum/plugins/*/*.ini
%config(noreplace) %{_sysconfdir}/quantum/rootwrap.conf
%dir %{_sysconfdir}/quantum/rootwrap.d/
%config(noreplace) %{_sysconfdir}/quantum/rootwrap.d/dhcp.filters
%config(noreplace) %{_sysconfdir}/quantum/rootwrap.d/iptables-firewall.filters
%config(noreplace) %{_sysconfdir}/quantum/rootwrap.d/l3.filters
%config(noreplace) %{_sysconfdir}/quantum/rootwrap.d/linuxbridge-plugin.filters
%config(noreplace) %{_sysconfdir}/quantum/rootwrap.d/nec-plugin.filters
%config(noreplace) %{_sysconfdir}/quantum/rootwrap.d/openvswitch-plugin.filters
%config(noreplace) %{_sysconfdir}/quantum/rootwrap.d/ryu-plugin.filters
%ghost %dir %attr(0755, %{username}, root) %{_localstatedir}/run/quantum
%dir %attr(0755, %{username}, %{groupname}) %{_localstatedir}/log/quantum
%{_initddir}/openstack-quantum
%{_sbindir}/rcopenstack-quantum
%{_bindir}/quantum-debug
%{_bindir}/quantum-dhcp-agent
%{_bindir}/quantum-dhcp-agent-dnsmasq-lease-update
%{_bindir}/quantum-l3-agent
%{_bindir}/quantum-linuxbridge-agent
%{_bindir}/quantum-nec-agent
%{_bindir}/quantum-netns-cleanup
%{_bindir}/quantum-openvswitch-agent
%{_bindir}/quantum-ovs-cleanup
%{_bindir}/quantum-rootwrap
%{_bindir}/quantum-ryu-agent
%{_bindir}/quantum-server
%{_mandir}/man1/quantum-server.1%{?ext_man}

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

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

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

%changelog
openSUSE Build Service is sponsored by