File openstack-manila.spec of Package openstack-manila
#
# spec file for package openstack-manila
#
# Copyright (c) 2022 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#
%define component manila
%define groupname %{component}
%define username %{component}
%define version_unconverted 7.4.2.dev60
Name: openstack-%{component}
Version: 7.4.2~dev60
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-rocky.tar.gz
Source1: %{name}.logrotate
Source2: manila-sudoers
Source3: %name.conf
# systemd service files
Source10: %{name}-api.service
Source11: %{name}-scheduler.service
Source12: %{name}-share.service
Source13: %{name}-data.service
Source50: README.config
Patch0: 0001-Rename-nfs-kernel-server-to-nfs-server.patch
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-cinderclient
BuildRequires: python-ddt
BuildRequires: python-eventlet
BuildRequires: python-fixtures
BuildRequires: python-iso8601
BuildRequires: python-keystonemiddleware
BuildRequires: python-lxml
BuildRequires: python-mock
BuildRequires: python-netaddr
BuildRequires: python-neutronclient
BuildRequires: python-novaclient
BuildRequires: python-openstackdocstheme
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-oslotest
BuildRequires: python-paramiko
BuildRequires: python-pbr
BuildRequires: python-sqlalchemy
BuildRequires: python-stevedore
BuildRequires: python-testtools
BuildRequires: python-tooz
BuildRequires: systemd-rpm-macros
%{?systemd_requires}
Requires: logrotate
Requires: openstack-suse-sudo
Requires: python >= 2.7
Requires: python-manila = %{version}
Requires: python-oslo.config >= 5.2.0
Requires(pre): pwdutils
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
%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.7
Requires: python-Babel >= 2.3.4
Requires: python-Paste >= 2.0.2
Requires: python-PasteDeploy >= 1.5.0
Requires: python-Routes >= 2.3.1
Requires: python-SQLAlchemy >= 1.0.10
Requires: python-WebOb >= 1.7.1
Requires: python-alembic >= 0.8.10
Requires: python-cinderclient >= 3.3.0
Requires: python-eventlet >= 0.18.2
Requires: python-greenlet >= 0.4.10
Requires: python-ipaddress >= 1.0.17
Requires: python-iso8601 >= 0.1.11
Requires: python-keystoneauth1 >= 3.4.0
Requires: python-keystonemiddleware >= 4.17.0
Requires: python-lxml >= 3.4.1
Requires: python-neutronclient >= 6.7.0
Requires: python-novaclient >= 9.1.0
Requires: python-oslo.concurrency >= 3.26.0
Requires: python-oslo.context >= 2.19.2
Requires: python-oslo.db >= 4.27.0
Requires: python-oslo.i18n >= 3.15.3
Requires: python-oslo.log >= 3.36.0
Requires: python-oslo.messaging >= 5.29.0
Requires: python-oslo.middleware >= 3.31.0
Requires: python-oslo.policy >= 1.30.0
Requires: python-oslo.reports >= 1.18.0
Requires: python-oslo.rootwrap >= 5.8.0
Requires: python-oslo.serialization >= 2.18.0
Requires: python-oslo.service >= 1.24.0
Requires: python-oslo.utils >= 3.33.0
Requires: python-paramiko >= 2.0.0
Requires: python-pyparsing >= 2.1.0
Requires: python-requests >= 2.14.2
Requires: python-retrying >= 1.2.3
Requires: python-six >= 1.10.0
Requires: python-stevedore >= 1.20.0
Requires: python-tooz >= 1.58.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) - Share
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 >= 3.2.0
#Requires: python-cinderclient
Requires: python-ddt >= 1.0.1
Requires: python-fixtures >= 3.0.0
Requires: python-mock >= 2.0.0
Requires: python-os-testr >= 1.0.0
Requires: python-pbr >= 2.0.0
Requires: python-psycopg2 >= 2.6.2
Requires: python-python-subunit >= 0.0.18
Requires: python-requests-mock >= 1.2.0
Requires: python-testrepository >= 0.0.18
Requires: python-testresources >= 2.0.0
Requires: python-testtools >= 2.2.0
%description test
The OpenStack Manila testsuite. It is used to verify the
functionality of OpenStack Manila.
%prep
%setup -q -n %{component}-%{version_unconverted}
sed -i 's/^warning-is-error.*/warning-is-error = 0/g' setup.cfg
%autopatch -p1
%openstack_cleanup_prep
%build
python setup.py build
PBR_VERSION=%{version_unconverted} sphinx-build -b man doc/source doc/build/man
### configuration files
PYTHONPATH=. oslo-config-generator --config-file etc/oslo-config-generator/manila.conf --output-file etc/manila.conf.sample
sed -i -e 's/#neutron_host_id = .*/#neutron_host_id = HOSTNAME/' etc/manila.conf.sample
PYTHONPATH=. oslopolicy-sample-generator --config-file=etc/manila/manila-policy-generator.conf --output etc/policy.json.sample
%install
python setup.py install --skip-build --prefix=%{_prefix} --root=%{buildroot}
### directories
install -d -m 750 %{buildroot}%{_localstatedir}/{lib,log}/%{component}
install -d -m 750 %{buildroot}%{_localstatedir}/cache/%{component}
install -d -m 700 %{buildroot}%{_localstatedir}/run/%{component}
install -D -m 644 %{SOURCE3} %{buildroot}/%_tmpfilesdir/%name.conf
install -d -m 755 %{buildroot}%{_sysconfdir}/%{component}
install -d -m 755 %{buildroot}%{_sysconfdir}/%{component}/%{component}.conf.d/
install -d -m 755 %{buildroot}%{_sysconfdir}/%{component}/%{component}-share.conf.d/
install -p -D -m 640 %{SOURCE50} %{buildroot}%{_sysconfdir}/%{component}/README.config
### configuration files
mv %{buildroot}/usr/etc/manila/* %{buildroot}%{_sysconfdir}/%{component}/
install -p -D -m 644 etc/%{component}.conf.sample %{buildroot}%{_sysconfdir}/%{component}/%{component}.conf
install -p -D -m 644 etc/policy.json.sample %{buildroot}%{_sysconfdir}/%{component}/policy.json
cp -a etc/manila/rootwrap.d/ %{buildroot}%{_sysconfdir}/%{component}/
# bash-completion/logrotate/etc.
install -p -D -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
# Install systemd unit services
mkdir -p %{buildroot}%{_sbindir} %{buildroot}%{_unitdir}
install -p -D -m 444 %{SOURCE10} %{buildroot}%{_unitdir}/%{name}-api.service
install -p -D -m 444 %{SOURCE11} %{buildroot}%{_unitdir}/%{name}-scheduler.service
install -p -D -m 444 %{SOURCE12} %{buildroot}%{_unitdir}/%{name}-share.service
install -p -D -m 444 %{SOURCE13} %{buildroot}%{_unitdir}/%{name}-data.service
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-api
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-scheduler
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-share
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-data
### sudoers configuration for manila-rootwrap:
install -D -m 440 %{SOURCE2} %{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
%define manila_conf %{buildroot}%{_sysconfdir}/%{component}/%{component}.conf.d/010-%{component}.conf
crudini --set %{manila_conf} DEFAULT log_dir /var/log/%{component}
crudini --set %{manila_conf} DEFAULT rootwrap_config /etc/manila/rootwrap.conf
crudini --set %{manila_conf} oslo_concurrency lock_path /var/run/%{component}
%pre
%openstack_pre_user_group_create %{username} %{groupname}
%post
%tmpfiles_create %{_tmpfilesdir}/%{name}.conf
%pre api
%service_add_pre %{name}-api.service
%post api
%service_add_post %{name}-api.service
%preun api
%service_del_preun %{name}-api.service
%postun api
%restart_on_update %{name}-api.service
%service_del_postun %{name}-api.service
%pre scheduler
%service_add_pre %{name}-scheduler.service
%post scheduler
%service_add_post %{name}-scheduler.service
%preun scheduler
%service_del_preun %{name}-scheduler.service
%postun scheduler
%restart_on_update %{name}-scheduler.service
%service_del_postun %{name}-scheduler.service
%pre share
%service_add_pre %{name}-share.service
%post share
%service_add_post %{name}-share.service
%preun share
%service_del_preun %{name}-share.service
%postun share
%restart_on_update %{name}-share.service
%service_del_postun %{name}-share.service
%pre data
%service_add_pre %{name}-data.service
%post data
%service_add_post %{name}-data.service
%preun data
%service_del_preun %{name}-data.service
%postun data
%restart_on_update %{name}-data.service
%service_del_postun %{name}-data.service
%files
%defattr(-,root,root)
%license LICENSE
%doc README.rst
%dir %attr(0750, %{username}, %{groupname}) %{_localstatedir}/lib/%{component}
%dir %attr(0750, %{username}, %{groupname}) %{_localstatedir}/cache/%{component}
%dir %attr(0750, %{username}, %{groupname}) %{_localstatedir}/log/%{component}
%_tmpfilesdir/%name.conf
%dir %{_sysconfdir}/%{component}
%dir %{_sysconfdir}/%{component}/%{component}.conf.d/
%dir %{_sysconfdir}/%{component}/%{component}-share.conf.d/
%dir %{_sysconfdir}/%{component}/rootwrap.d
%{_sysconfdir}/%{component}/README.config
%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(noreplace) %attr(0640, root, %{groupname}) %{_sysconfdir}/%{component}/%{component}.conf.d/010-%{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,-)
%license LICENSE
%{python_sitelib}/%{component}/
%{python_sitelib}/%{component}-*.egg-info
%exclude %{python_sitelib}/%{component}/test*
%files api
%defattr(-,root,root,-)
%license LICENSE
%{_unitdir}/%{name}-api.service
%{_sbindir}/rc%{name}-api
%{_bindir}/%{component}-api
%{_bindir}/%{component}-wsgi
%files scheduler
%defattr(-,root,root,-)
%license LICENSE
%{_unitdir}/%{name}-scheduler.service
%{_sbindir}/rc%{name}-scheduler
%{_bindir}/%{component}-scheduler
%files share
%defattr(-,root,root,-)
%license LICENSE
%{_unitdir}/%{name}-share.service
%{_sbindir}/rc%{name}-share
%{_bindir}/%{component}-share
%files data
%defattr(-,root,root,-)
%license LICENSE
%{_unitdir}/%{name}-data.service
%{_sbindir}/rc%{name}-data
%{_bindir}/%{component}-data
%files test
%defattr(-,root,root)
%{_localstatedir}/lib/%{name}-test/
%{python_sitelib}/%{component}/test*
%changelog