File openstack-manila.spec of Package openstack-manila
#
# spec file for package openstack-manila
#
# Copyright (c) 2014 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 manila
%define groupname %{component}
%define username %{component}
%define version_unconverted 2014.2.1.dev5
Name: openstack-%{component}
Version: 2014.2.1~a0~dev5
Release: 0
Summary: OpenStack shared file system service (Manila)
License: Apache-2.0
Group: System/Management
Url: https://launchpad.net/manila
Source0: http://tarballs.openstack.org/manila/manila-stable-juno.tar.gz
Source1: %{name}.init
Source2: %{name}.logrotate
Source3: manila-sudoers
%if 0%{?suse_version} > 1230
Source10: %name.conf
BuildRequires: systemd
%endif
# NOTE(toabctl): See lp#1431335 and bnc#922001
Patch0: 0001-Reflect-real-database-field-type-in-model.patch
Patch1: 0001-Fix-fields-deleted-in-various-DB-models-for-PostgreS.patch
BuildRequires: fdupes
BuildRequires: openstack-suse-macros
BuildRequires: openstack-suse-sudo
BuildRequires: python-base
BuildRequires: python-oslo.config
BuildRequires: python-setuptools
BuildRequires: python-six
# Documentation build requirements:
BuildRequires: crudini
BuildRequires: python-Babel
BuildRequires: python-Paste
BuildRequires: python-PasteDeploy
BuildRequires: python-Routes
BuildRequires: python-Sphinx
BuildRequires: python-WebOb
BuildRequires: python-argparse
BuildRequires: python-cinderclient
BuildRequires: python-eventlet
BuildRequires: python-fixtures
BuildRequires: python-iso8601
BuildRequires: python-lxml
BuildRequires: python-mock
BuildRequires: python-netaddr
BuildRequires: python-neutronclient
BuildRequires: python-novaclient
BuildRequires: python-oslo.db
BuildRequires: python-oslo.i18n
BuildRequires: python-oslo.messaging
BuildRequires: python-oslo.utils
BuildRequires: python-oslosphinx
BuildRequires: python-paramiko
BuildRequires: python-pbr
BuildRequires: python-posix_ipc
BuildRequires: python-sqlalchemy
BuildRequires: python-stevedore >= 0.8
BuildRequires: python-testtools
Requires: logrotate
Requires: openstack-suse-sudo
Requires: python >= 2.6.8
Requires: python-kombu >= 2.5.0
Requires: python-manila = %{version}
Requires: python-oslo.config >= 1.4.0
%if 0%{?suse_version} > 1110
Requires(pre): pwdutils
%else
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()")}
%else
BuildArch: noarch
%endif
%description
OpenStack shared file system service. The File Share Service provides coordinated access to shared or distributed file systems.
%package -n python-manila
Summary: OpenStack shared file system service (Manila) - Python module
Group: Development/Languages/Python
Requires: python >= 2.6.8
Requires: python-alembic >= 0.6.4
Requires: python-Babel >= 1.3
Requires: python-Paste
Requires: python-PasteDeploy >= 1.5.0
Requires: python-Routes >= 1.12.3
Requires: python-SQLAlchemy >= 0.8.4
Requires: python-WebOb >= 1.2.3
Requires: python-anyjson >= 0.3.3
Requires: python-cinderclient >= 1.1.0
Requires: python-eventlet >= 0.15.1
Requires: python-greenlet >= 0.3.2
Requires: python-iso8601 >= 0.1.9
Requires: python-keystoneclient >= 0.10.0
Requires: python-lockfile >= 0.8
Requires: python-lxml >= 2.3
Requires: python-neutronclient >= 2.3.6
Requires: python-novaclient >= 2.18.0
Requires: python-oslo.db >= 1.0.0
Requires: python-oslo.i18n >= 1.0.0
Requires: python-oslo.messaging >= 1.4.0
Requires: python-oslo.rootwrap >= 1.3.0
Requires: python-oslo.utils >= 1.4.0
Requires: python-paramiko >= 1.13.0
Requires: python-posix_ipc
Requires: python-six >= 1.7.0
Requires: python-sqlalchemy-migrate >= 0.9.1
Requires: python-stevedore >= 1.0.0
Requires: python-suds >= 0.4
Requires: python-wsgiref >= 0.1.2
%description -n python-manila
OpenStack shared file system service.
This package contains the core Python module of OpenStack Manila.
%package api
Summary: OpenStack shared file system service (Manila) - API
Group: Development/Languages/Python
Requires: %{name} = %{version}
%description api
OpenStack shared file system service.
This package contains the OpenStack Manila API.
%package scheduler
Summary: OpenStack shared file system service (Manila) - Scheduler
Group: Development/Languages/Python
Requires: %{name} = %{version}
%description scheduler
OpenStack shared file system service.
This package contains the OpenStack Manila scheduler.
%package share
Summary: OpenStack shared file system service (Manila) - API
Group: Development/Languages/Python
Requires: %{name} = %{version}
%description share
OpenStack shared file system service.
This package contains the OpenStack Manila Share.
%package test
Summary: OpenStack shared file system service (Manila) - Testsuite
Group: Development/Languages/Python
Requires: %{name} = %{version}
Requires: git-core
Requires: python-oslotest >= 1.1.0
#Requires: python-cinderclient
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
Requires: python-discover
%endif
Requires: python-MySQL-python
Requires: python-fixtures >= 0.3.14
Requires: python-mock >= 1.0
Requires: python-pbr >= 0.6
Requires: python-psycopg2
Requires: python-python-subunit >= 0.0.18
Requires: python-testrepository >= 0.0.18
Requires: python-testtools >= 0.9.34
%description test
The OpenStack Manila testsuite. It is used to verify the
functionality of OpenStack Manila.
%prep
%setup -q -n manila-%{version_unconverted}
%patch0 -p1
%patch1 -p1
%openstack_cleanup_prep
%build
python setup.py build
python setup.py build_sphinx -b man
%install
python setup.py install --skip-build --prefix=%{_prefix} --root=%{buildroot}
### directories
install -d -m 755 %{buildroot}%{_localstatedir}/{lib,log}/%{component}
install -d -m 750 %{buildroot}%{_localstatedir}/cache/%{component}
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}/%{component}
### configuration files
bash %{_builddir}/%{component}-%{version_unconverted}/tools/config/generate_sample.sh -o %{_tmppath}
install -p -D -m 644 %{_tmppath}/manila.conf.sample %{buildroot}%{_sysconfdir}/%{component}/%{component}.conf
install -p -D -m 644 etc/manila/{api-paste.ini,policy.json,rootwrap.conf} %{buildroot}%{_sysconfdir}/%{component}/
cp -a etc/manila/rootwrap.d/ %{buildroot}%{_sysconfdir}/%{component}/
# bash-completion/logrotate/etc.
install -p -D -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
### init scripts
mkdir -p %{buildroot}%{_sbindir} %{buildroot}%{_initddir}
for i in api scheduler share; do
install -m 755 %{SOURCE1} %{buildroot}%{_initddir}/%{name}-$i
sed -i -e "s/__NAME__/$i/g" %{buildroot}%{_initddir}/%{name}-$i
ln -s ../..%{_initddir}/%{name}-$i %{buildroot}%{_sbindir}/rc%{name}-$i
done
### sudoers configuration for manila-rootwrap:
install -D -m 440 %{SOURCE3} %{buildroot}%{_sysconfdir}/sudoers.d/openstack-manila
### documentation
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
### misc
%fdupes %{buildroot}%{python_sitelib}/%{component}
### set default configuration (mostly applies to package-only setups and quickstart, i.e. not generally crowbar)
%define manila_conf %{buildroot}%{_sysconfdir}/manila/manila.conf
crudini --set %{manila_conf} DEFAULT verbose True
crudini --set %{manila_conf} DEFAULT log_dir /var/log/manila
crudini --set %{manila_conf} DEFAULT auth_strategy keystone
crudini --set %{manila_conf} DEFAULT rootwrap_config /etc/manila/rootwrap.conf
crudini --set %{manila_conf} DEFAULT state_path /var/lib/manila
#NOTE(saschpe): Do we want to use sqlite per default or demand PostgreSQL right away?
crudini --set %{manila_conf} DEFAULT sql_connection sqlite:////var/lib/manila/manila.db
%pre
%openstack_pre_user_group_create %{username} %{groupname}
%post api
%{fillup_and_insserv -f %{name}-api}
%preun api
%stop_on_removal %{name}-api
%postun api
%restart_on_update %{name}-api
%insserv_cleanup
%post scheduler
%{fillup_and_insserv -f %{name}-scheduler}
%preun scheduler
%stop_on_removal %{name}-scheduler
%postun scheduler
%restart_on_update %{name}-scheduler
%insserv_cleanup
%post share
%{fillup_and_insserv -f %{name}-share}
%preun share
%stop_on_removal %{name}-share
%postun share
%restart_on_update %{name}-share
%insserv_cleanup
%files
%defattr(-,root,root)
%doc LICENSE README.rst
%dir %attr(0755, %{username}, %{groupname}) %{_localstatedir}/lib/%{component}
%dir %attr(0750, %{username}, %{groupname}) %{_localstatedir}/cache/%{component}
%dir %attr(0750, %{username}, %{groupname}) %{_localstatedir}/log/%{component}
%if 0%{?suse_version} > 1230
%_tmpfilesdir/%name.conf
%else
%dir %attr(0700, %{username}, %{groupname}) %{_localstatedir}/run/%{component}
%endif
%dir %{_sysconfdir}/%{component}
%dir %{_sysconfdir}/%{component}/rootwrap.d
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%config %{_sysconfdir}/sudoers.d/openstack-manila
%config %attr(0640, root, %{groupname}) %{_sysconfdir}/%{component}/api-paste.ini
%config(noreplace) %attr(0640, root, %{groupname}) %{_sysconfdir}/%{component}/%{component}.conf
%config %{_sysconfdir}/%{component}/policy.json
%config %{_sysconfdir}/%{component}/rootwrap.conf
%config %{_sysconfdir}/%{component}/rootwrap.d/volume.filters
%config %{_sysconfdir}/%{component}/rootwrap.d/share.filters
%{_bindir}/%{component}-all
%{_bindir}/%{component}-manage
%{_bindir}/%{component}-rootwrap
%{_mandir}/man1/%{component}-manage.1%{?ext_man}
%files -n python-%{component}
%defattr(-,root,root,-)
%doc LICENSE
%{python_sitelib}/%{component}/
%{python_sitelib}/%{component}-*.egg-info
%exclude %{python_sitelib}/%{component}/test*
%files api
%defattr(-,root,root,-)
%doc LICENSE
%{_initddir}/%{name}-api
%{_sbindir}/rc%{name}-api
%{_bindir}/%{component}-api
%files scheduler
%defattr(-,root,root,-)
%doc LICENSE
%{_initddir}/%{name}-scheduler
%{_sbindir}/rc%{name}-scheduler
%{_bindir}/%{component}-scheduler
%files share
%defattr(-,root,root,-)
%doc LICENSE
%{_initddir}/%{name}-share
%{_sbindir}/rc%{name}-share
%{_bindir}/%{component}-share
%files test
%defattr(-,root,root)
%{_localstatedir}/lib/%{name}-test/
%{python_sitelib}/%{component}/test*
%changelog