File openstack-tempest.spec of Package openstack-tempest

#
# spec file for package openstack-tempest
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2013 B1 Systems GmbH, Vohburg, 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 tempest
%define groupname openstack-%{component}
%define username openstack-%{component}

Name:           openstack-%{component}
Version:        2013.2.dev2040.ge0e8ed3
Release:        0
Summary:        OpenStack Integration Test Suite (Tempest)
License:        Apache-2.0
Group:          System/Management
Url:            https://launchpad.net/tempest
Source0:        http://tarballs.openstack.org/tempest/tempest-stable-havana.tar.gz
%if 0%{?suse_version} > 1230
Source10:       %name.conf
BuildRequires:  systemd
%endif
Patch1:         0001-Avoid-using-assertGreater.patch
BuildRequires:  crudini
BuildRequires:  fdupes
BuildRequires:  openstack-suse-macros
BuildRequires:  python-Sphinx
BuildRequires:  python-base
BuildRequires:  python-oslo.sphinx
BuildRequires:  python-pbr
BuildRequires:  python-setuptools
%if 0%{?suse_version} > 1110
Requires(pre):  pwdutils
%else
Requires(pre):  shadow-utils
%endif
Requires:       %name-test = %{version}
Requires:       git-core
Requires:       python >= 2.6.8
Requires:       python-tempest = %{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()")}
%else
BuildArch:      noarch
%endif

%description
This is a set of integration tests to be run against a live OpenStack cluster.
Tempest has batteries of tests for OpenStack API validation, Scenarios, and
other specific tests useful in validating an OpenStack deployment.

%package test
Summary:        OpenStack Integration Test Suite (Tempest) - Test Package
Group:          Development/Languages/Python
Requires:       %{name} = %{version}
%if 0%{?suse_version} < 1110
Requires:       python-openstack.nose_plugin
%endif

%description test
This is a set of integration tests to be run against a live OpenStack cluster.
Tempest has batteries of tests for OpenStack API validation, Scenarios, and
other specific tests useful in validating an OpenStack deployment.

%package -n python-tempest
Summary:        OpenStack Integration Test Suite (Tempest) - Python module
Group:          Development/Languages/Python
Requires:       python >= 2.6.8
Requires:       python-anyjson >= 0.3.3
Requires:       python-boto >= 2.4.0
Requires:       python-cinderclient >= 1.0.6
Requires:       python-eventlet >= 0.13.0
Requires:       python-fixtures >= 0.3.14
Requires:       python-glanceclient >= 0.9.0
Requires:       python-hacking >= 0.5.6
Requires:       python-heatclient >= 0.2.3
Requires:       python-httplib2
Requires:       python-iso8601 >= 0.1.8
Requires:       python-jsonschema >= 1.3.0
Requires:       python-keyring >= 1.6.1
Requires:       python-keystoneclient >= 0.3.2
Requires:       python-lxml >= 2.3
Requires:       python-netaddr
Requires:       python-neutronclient >= 2.3.0
Requires:       python-nose
Requires:       python-novaclient >= 2.15.0
Requires:       python-oslo.config >= 1.2.0
Requires:       python-paramiko >= 1.8.0
Requires:       python-pbr >= 0.5.21
Requires:       python-python-subunit
Requires:       python-six >= 1.4.1
Requires:       python-testrepository >= 0.0.17
Requires:       python-testresources >= 0.2.4
Requires:       python-testtools >= 0.9.32

%description -n python-tempest
This package contains the core Python module of OpenStack Tempest.

%prep
%setup -q -n %{component}-%{version}
%patch1 -p1
%openstack_cleanup_prep

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

%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
install -d -m 755 %{buildroot}%{_localstatedir}/lib/tempest
install -d -m 700 %{buildroot}%{_localstatedir}/run/%{component}
%if 0%{?suse_version} > 1230
install -D -m 644 %{SOURCE10} %{buildroot}/%_tmpfilesdir/%name.conf
%endif
install -d -m 755 %{buildroot}%{_sysconfdir}/tempest
install -m 644 etc/logging.conf.sample %{buildroot}%{_sysconfdir}/tempest/logging.conf
install -m 644 etc/tempest.conf.sample %{buildroot}%{_sysconfdir}/tempest/tempest.conf
install -d %{buildroot}%{_mandir}/man1
install -m 644 doc/build/man/*.1 %{buildroot}%{_mandir}/man1
%fdupes %{buildroot}%{python_sitelib}/%{component}

# configuration fixes
crudini --set %{buildroot}/etc/tempest/tempest.conf DEFAULT lock_path /var/run/tempest
crudini --set %{buildroot}/etc/tempest/tempest.conf cli cli_dir /usr/bin
crudini --set %{buildroot}/etc/tempest/tempest.conf boto s3_materials_path ""
crudini --set %{buildroot}/etc/tempest/tempest.conf scenario img_dir ""
crudini --set %{buildroot}/etc/tempest/tempest.conf compute change_password_available false
crudini --set %{buildroot}/etc/tempest/tempest.conf compute use_block_migration_for_live_migration true
crudini --set %{buildroot}/etc/tempest/tempest.conf service_available neutron true
crudini --set %{buildroot}/etc/tempest/tempest.conf service_available swift false
crudini --set %{buildroot}/etc/tempest/tempest.conf service_available heat false

### test subpackage
%openstack_test_package_install
install -m 0755 run_tests.sh %openstack_test_package_buildroot_dir/run_tempest.sh

%pre
getent group %{groupname} >/dev/null || groupadd -r %{groupname}
getent passwd %{username} >/dev/null || useradd -r -g %{groupname} -d %{_localstatedir}/lib/tempest -s /sbin/nologin -c "OpenStack Tempest" %{username}
exit 0

%files
%defattr(-,root,root)
%doc LICENSE
%dir %{_sysconfdir}/tempest
%if 0%{?suse_version} > 1230
%ghost %dir %attr(700,root,root) %{_localstatedir}/run/%{component}
%_tmpfilesdir/%name.conf
%else
%dir %attr(0700, root, root) %{_localstatedir}/run/%{component}
%endif
%config(noreplace) %{_sysconfdir}/tempest/logging.conf
%config(noreplace) %{_sysconfdir}/tempest/tempest.conf

%files test
%defattr(-,root,root)
%doc LICENSE README.rst
%{_localstatedir}/lib/openstack-%{component}-test
/var/lib/openstack-tempest-test/
%{_mandir}/man1/tempest.1%{?ext_man}
%dir %attr(0755, %{username}, %{groupname}) %{_localstatedir}/lib/tempest

%files -n python-tempest
%defattr(-,root,root,-)
%doc LICENSE
%{python_sitelib}/%{component}/
%{python_sitelib}/%{component}-*.egg-info

%changelog
openSUSE Build Service is sponsored by