File openstack-quantum.spec of Package openstack-quantum

# 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

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

Name:           openstack-%{component}
Version:        2012.1+git.1342368520.753730a
Release:        0
Summary:        OpenStack Virtual Network Service (Quantum)
License:        Apache-2.0
Group:          System/Management
Source:         %{component}-%{version}.tar.gz
Source1:        openstack-quantum.init
Source2:        %{name}.logrotate
BuildRequires:  fdupes
BuildRequires:  python-devel
BuildRequires:  python-setuptools
Requires:       logrotate
Requires:       python >= 2.6.8
Requires:       python-eventlet
Requires:       python-lxml
Requires:       python-quantumclient
Requires:       python-routes
Requires:       python-webob

Requires(pre):  pwdutils
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()")}
BuildArch:      noarch

Quantum is a virtual network service for Openstack, and a part of

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)

Quantum is an officially incubated OpenStack project.

%package test
Summary:        OpenStack Virtual Network Service (Quantum) - Testsuite
Group:          Development/Languages/Python
Requires:       %{name} = %{version}
Requires:       python-nose

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

%setup -q -n %{component}-%{version}

python build

python install --skip-build --root=%{buildroot} \
    --install-purelib=%{python_sitelib} --install-scripts=%{_bindir} --prefix=''

# remove un-needed, mostly empty directories
# TODO: fix this upstream
rm -r %{buildroot}%{python_sitelib}/bin
rm -r %{buildroot}%{python_sitelib}/doc
rm -r %{buildroot}%{python_sitelib}/tools

# PID and log dirs
install -d -m 755 %{buildroot}%{_localstatedir}/run/quantum
install -d -m 755 %{buildroot}%{_localstatedir}/log/quantum

install -p -D -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}

# we provide our own initfile
rm %{buildroot}%{_initddir}/quantum-server
install -p -D -m 755 %{SOURCE1} %{buildroot}%{_initddir}/openstack-quantum

# SUSE-policy symlink
mkdir -p %{buildroot}%{_sbindir}
pushd %{buildroot}
  ln -s %{_initddir}/openstack-quantum ./%{_sbindir}/rcopenstack-quantum

# for test sub-package
install -d -m 755 %{buildroot}%{_localstatedir}/lib/openstack-quantum-test
mv run_tests* %{buildroot}%{_localstatedir}/lib/openstack-quantum-test/

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

%{fillup_and_insserv -f openstack-quantum}
%restart_on_update openstack-quantum

%stop_on_removal openstack-quantum


%dir %{_sysconfdir}/quantum
%config(noreplace) %{_sysconfdir}/quantum/plugins.ini
%config(noreplace) %{_sysconfdir}/quantum/quantum.conf
%dir %{_sysconfdir}/quantum/plugins
%dir %{_sysconfdir}/quantum/plugins/cisco/
%dir %{_sysconfdir}/quantum/plugins/linuxbridge/
%dir %{_sysconfdir}/quantum/plugins/nicira/
%dir %{_sysconfdir}/quantum/plugins/openvswitch/
%dir %{_sysconfdir}/quantum/plugins/ryu/
%config(noreplace) %{_sysconfdir}/quantum/plugins/*/*.ini
%dir %attr(0755, %{username}, %{groupname}) %{_localstatedir}/run/quantum
%dir %attr(0755, %{username}, %{groupname}) %{_localstatedir}/log/quantum
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%dir %{python_sitelib}/%{component}

%files test

openSUSE Build Service is sponsored by