LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File openstack-manila.spec of Package openstack-manila (Project home:mmnelemane:branches:Cloud:OpenStack:Mitaka)

#
# spec file for package openstack-manila
#
# Copyright (c) 2016 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 http://bugs.opensuse.org/
#


%define component manila
%define groupname %{component}
%define username %{component}

%define version_unconverted 2.0.1.dev9

Name:           openstack-%{component}
Version:        2.0.1~a0~dev9
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-mitaka.tar.gz
Source1:        %{name}.init
Source2:        %{name}.logrotate
Source3:        manila-sudoers
%if 0%{?suse_version} > 1230
Source10:       %name.conf
BuildRequires:  systemd
%endif
BuildRequires:  fdupes
BuildRequires:  openstack-suse-macros
BuildRequires:  openstack-suse-sudo
BuildRequires:  python-base
BuildRequires:  python-oslo.concurrency
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.log
BuildRequires:  python-oslo.messaging
BuildRequires:  python-oslo.policy
BuildRequires:  python-oslo.utils
BuildRequires:  python-oslosphinx
BuildRequires:  python-paramiko
BuildRequires:  python-pbr
BuildRequires:  python-posix_ipc
BuildRequires:  python-sqlalchemy
BuildRequires:  python-stevedore
BuildRequires:  python-testtools
Requires:       logrotate
Requires:       openstack-suse-sudo
Requires:       python >= 2.6.8
Requires:       python-manila = %{version}
Requires:       python-oslo.config >= 3.7.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-Babel >= 1.3
Requires:       python-Paste
Requires:       python-PasteDeploy >= 1.5.0
Requires:       python-Routes >= 1.12.3
Requires:       python-SQLAlchemy >= 1.0.10
Requires:       python-WebOb >= 1.2.3
Requires:       python-alembic >= 0.8.0
Requires:       python-cinderclient >= 1.3.1
Requires:       python-eventlet >= 0.18.2
Requires:       python-greenlet >= 0.3.2
Requires:       python-iso8601 >= 0.1.9
Requires:       python-keystonemiddleware >= 4.0.0
Requires:       python-lxml >= 2.3
Requires:       python-neutronclient >= 2.6.0
Requires:       python-novaclient >= 2.29.0
Requires:       python-oslo.concurrency >= 3.5.0
Requires:       python-oslo.context >= 0.2.0
Requires:       python-oslo.db >= 4.1.0
Requires:       python-oslo.i18n >= 2.1.0
Requires:       python-oslo.log >= 1.14.0
Requires:       python-oslo.messaging >= 4.0.0
Requires:       python-oslo.middleware >= 3.0.0
Requires:       python-oslo.policy >= 0.5.0
Requires:       python-oslo.rootwrap >= 2.0.0
Requires:       python-oslo.serialization >= 1.10.0
Requires:       python-oslo.service >= 1.0.0
Requires:       python-oslo.utils >= 3.5.0
Requires:       python-paramiko >= 1.16.0
Requires:       python-requests >= 2.8.1
Requires:       python-retrying >= 1.2.3
Requires:       python-six >= 1.9.0
Requires:       python-stevedore >= 1.5.0

%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 data
Summary:        OpenStack shared file system service (Manila) - Data
Group:          Development/Languages/Python
Requires:       %{name} = %{version}

%description data
OpenStack shared file system service.

This package contains the OpenStack Manila Data service.

%package test
Summary:        OpenStack shared file system service (Manila) - Testsuite
Group:          Development/Languages/Python
Requires:       %{name} = %{version}
Requires:       git-core
Requires:       python-oslotest >= 1.10.0
#Requires:       python-cinderclient
Requires:       python-ddt >= 1.0.1
Requires:       python-fixtures >= 1.3.1
Requires:       python-mock >= 1.2
Requires:       python-os-testr >= 0.4.1
Requires:       python-pbr >= 1.6
Requires:       python-psycopg2 >= 2.5
Requires:       python-python-subunit >= 0.0.18
Requires:       python-requests-mock >= 0.7.0
Requires:       python-testrepository >= 0.0.18
Requires:       python-testresources >= 0.2.4
Requires:       python-testtools >= 1.4.0

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

%prep
%setup -q -n %{component}-%{version_unconverted}
%openstack_cleanup_prep

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

### configuration files
oslo-config-generator --config-file etc/oslo-config-generator/manila.conf --output-file etc/manila.conf.sample

%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
install -p -D -m 644 etc/%{component}.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 data; 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

### tempest tests
cp -a manila_tempest_tests %{buildroot}%{python_sitelib}/

### 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 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
crudini --set %{manila_conf} database connection sqlite:////var/lib/manila/manila.db
crudini --set %{manila_conf} keystone_authtoken signing_dir /var/cache/%component/keystone-signing
crudini --set %{manila_conf} keystone_authtoken auth_type password
crudini --set %{manila_conf} keystone_authtoken username manila
crudini --set %{manila_conf} keystone_authtoken password '%%SERVICE_PASSWORD%%'
crudini --set %{manila_conf} keystone_authtoken user_domain_id default
crudini --set %{manila_conf} keystone_authtoken project_name '%%SERVICE_TENANT_NAME%%'
crudini --set %{manila_conf} keystone_authtoken project_domain_id default
crudini --set %{manila_conf} oslo_concurrency lock_path /var/run/manila
crudini --set %{manila_conf} DEFAULT wsgi_keep_alive false

%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

%post data
%{fillup_and_insserv -f %{name}-data}

%preun data
%stop_on_removal %{name}-data

%postun data
%restart_on_update %{name}-data
%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/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 data
%defattr(-,root,root,-)
%doc LICENSE
%{_initddir}/%{name}-data
%{_sbindir}/rc%{name}-data
%{_bindir}/%{component}-data

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

%changelog