File openstack-manila.spec of Package openstack-manila

#
# spec file for package openstack-manila
#
# Copyright (c) 2024 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/
#


%global with_doc 1
%if 0%{?rhel} || 0%{?fedora}
%global rdo 1
%endif
Name:           openstack-manila
Epoch:          0
Version:        18.1.0~dev154
Release:        0
Summary:        OpenStack shared file system service
License:        Apache-2.0
URL:            https://docs.openstack.org/manila
Source0:        manila-master.tar.gz
Source1:        openstack-manila.sudoers
Source2:        openstack-manila.logrotate
Source3:        openstack-manila.tmpfiles
Source4:        openstack-manila.defaultconf
Source5:        openstack-manila.README.config
# systemd service files
Source6:        openstack-manila-api.service
Source7:        openstack-manila-scheduler.service
Source8:        openstack-manila-share.service
Source9:        openstack-manila-data.service
BuildRequires:  openstack-macros
BuildRequires:  python3-Babel
BuildRequires:  python3-Paste
BuildRequires:  python3-PasteDeploy
BuildRequires:  python3-Routes
BuildRequires:  python3-SQLAlchemy
BuildRequires:  python3-WebOb
BuildRequires:  python3-alembic
BuildRequires:  python3-cinderclient
BuildRequires:  python3-ddt
BuildRequires:  python3-eventlet
BuildRequires:  python3-fixtures
BuildRequires:  python3-glanceclient
BuildRequires:  python3-greenlet
BuildRequires:  python3-iso8601
BuildRequires:  python3-keystoneauth1
BuildRequires:  python3-keystonemiddleware
BuildRequires:  python3-lxml
BuildRequires:  python3-netaddr
BuildRequires:  python3-neutronclient
BuildRequires:  python3-novaclient
BuildRequires:  python3-os-api-ref
BuildRequires:  python3-oslo.concurrency
BuildRequires:  python3-oslo.config
BuildRequires:  python3-oslo.context
BuildRequires:  python3-oslo.db
BuildRequires:  python3-oslo.i18n
BuildRequires:  python3-oslo.log
BuildRequires:  python3-oslo.messaging
BuildRequires:  python3-oslo.middleware
BuildRequires:  python3-oslo.policy
BuildRequires:  python3-oslo.privsep
BuildRequires:  python3-oslo.reports
BuildRequires:  python3-oslo.rootwrap
BuildRequires:  python3-oslo.serialization
BuildRequires:  python3-oslo.service
BuildRequires:  python3-oslo.upgradecheck
BuildRequires:  python3-oslo.utils
BuildRequires:  python3-oslotest
BuildRequires:  python3-paramiko
BuildRequires:  python3-pbr
BuildRequires:  python3-psycopg2
BuildRequires:  python3-pyparsing
BuildRequires:  python3-requests
BuildRequires:  python3-requests-mock
BuildRequires:  python3-retrying
BuildRequires:  python3-six
BuildRequires:  python3-stevedore
BuildRequires:  python3-testresources
BuildRequires:  python3-testscenarios
BuildRequires:  python3-testtools
BuildRequires:  python3-tooz
BuildRequires:  sudo
Requires:       logrotate
Requires:       python3-manila = %{epoch}:%{version}-%{release}
BuildArch:      noarch
%if 0%{?suse_version}
BuildRequires:  systemd-rpm-macros
%{?systemd_requires}
%else
BuildRequires:  systemd
Requires(post): systemd
Requires(postun): systemd
Requires(pre):  shadow-utils
Requires(preun): systemd
%endif

%description
OpenStack shared file system service.
The File Share Service provides coordinated access to shared or distributed file systems.

%package -n     python3-manila
Summary:        OpenStack shared file system service (Manila) - Python module
Group:          Development/Languages/Python
Requires:       python3-Babel
Requires:       python3-Paste
Requires:       python3-PasteDeploy
Requires:       python3-Routes
Requires:       python3-SQLAlchemy
Requires:       python3-WebOb
Requires:       python3-alembic
Requires:       python3-cinderclient
Requires:       python3-eventlet
Requires:       python3-glanceclient
Requires:       python3-greenlet
Requires:       python3-keystoneauth1
Requires:       python3-keystonemiddleware
Requires:       python3-lxml
Requires:       python3-netaddr
Requires:       python3-neutronclient
Requires:       python3-novaclient
Requires:       python3-oslo.concurrency
Requires:       python3-oslo.config
Requires:       python3-oslo.context
Requires:       python3-oslo.db
Requires:       python3-oslo.i18n
Requires:       python3-oslo.log
Requires:       python3-oslo.messaging
Requires:       python3-oslo.middleware
Requires:       python3-oslo.policy
Requires:       python3-oslo.privsep
Requires:       python3-oslo.reports
Requires:       python3-oslo.rootwrap
Requires:       python3-oslo.serialization
Requires:       python3-oslo.service
Requires:       python3-oslo.upgradecheck
Requires:       python3-oslo.utils
Requires:       python3-paramiko
Requires:       python3-pbr
Requires:       python3-pyparsing
Requires:       python3-requests
Requires:       python3-retrying
Requires:       python3-six
Requires:       python3-stevedore
Requires:       python3-tooz
Requires:       sudo

%description -n python3-manila
OpenStack shared file system service.
This package contains the core Python module of OpenStack Manila.

%if 0%{?with_doc}
%package doc
Summary:        OpenStack shared file system service (Manila) - Documentation
Group:          Documentation/HTML
BuildRequires:  python3-Sphinx
BuildRequires:  python3-openstackdocstheme

%description doc
OpenStack shared file system service.
This package contains the Documentation.
%endif

%package api
Summary:        OpenStack shared file system service (Manila) - API
Group:          Development/Languages/Python
Requires:       openstack-manila = %{epoch}:%{version}-%{release}

%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:       openstack-manila = %{epoch}:%{version}-%{release}

%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:       openstack-manila = %{epoch}:%{version}-%{release}

%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:       openstack-manila = %{epoch}:%{version}-%{release}

%description data
OpenStack shared file system service.
This package contains the OpenStack Manila Data service.

%prep
%autosetup -p1 -n manila-18.1.0.dev154
%py_req_cleanup

%build
%{py3_build}

# doc
%if 0%{?with_doc}
PYTHONPATH=. PBR_VERSION=18.1.0.dev154 %sphinx_build -b html doc/source doc/build/html
PYTHONPATH=. PBR_VERSION=18.1.0.dev154 %sphinx_build -b man doc/source doc/build/man
# remove the Sphinx-build leftovers
rm -rf doc/build/html/.{doctrees,buildinfo}
rm -rf doc/build/man/.{doctrees,buildinfo}
%endif

# config file generation
PYTHONPATH=. oslo-config-generator --config-file etc/oslo-config-generator/manila.conf \
--output-file etc/manila.conf.sample
# policy file generation
PYTHONPATH=. oslopolicy-sample-generator --config-file=etc/manila/manila-policy-generator.conf \
--output etc/policy.json.sample

%install
%{py3_install}

### directories
install -d -m 750 %{buildroot}%{_localstatedir}/{lib,log}/manila
install -d -m 750 %{buildroot}%{_localstatedir}/cache/manila
install -d -m 700 %{buildroot}%{_localstatedir}/run/manila
install -D -m 644 %{SOURCE3} %{buildroot}/%_tmpfilesdir/manila.conf
install -d -m 755 %{buildroot}%{_sysconfdir}/manila
install -d -m 755 %{buildroot}%{_sysconfdir}/manila/manila.conf.d/
install -d -m 755 %{buildroot}%{_sysconfdir}/manila/manila-share.conf.d/
install -p -D -m 640 %{SOURCE5} %{buildroot}%{_sysconfdir}/manila/README.config

### configuration files
mv %{buildroot}%{_prefix}%{_sysconfdir}/manila/* %{buildroot}%{_sysconfdir}/manila/
install -p -D -m 644 etc/manila.conf.sample %{buildroot}%{_sysconfdir}/manila/manila.conf
install -p -D -m 644 etc/policy.json.sample %{buildroot}%{_sysconfdir}/manila/policy.json
cp -a etc/manila/rootwrap.d/ %{buildroot}%{_sysconfdir}/manila/

# bash-completion/logrotate/etc.
install -p -D -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/manila

# Install systemd unit services
mkdir -p %{buildroot}%{_sbindir} %{buildroot}%{_unitdir}
install -p -D -m 444 %{SOURCE6} %{buildroot}%{_unitdir}/%{name}-api.service
install -p -D -m 444 %{SOURCE7} %{buildroot}%{_unitdir}/%{name}-scheduler.service
install -p -D -m 444 %{SOURCE8} %{buildroot}%{_unitdir}/%{name}-share.service
install -p -D -m 444 %{SOURCE9} %{buildroot}%{_unitdir}/%{name}-data.service
%if 0%{?suse_version}
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
%endif

### sudoers configuration for manila-rootwrap:
install -D -m 440 %{SOURCE1} %{buildroot}%{_sysconfdir}/sudoers.d/openstack-manila

### default configuration
install -D -m 640 %{SOURCE4} %{buildroot}/%{_sysconfdir}/manila/manila.conf.d/010-manila.conf

# man pages
%if 0%{?with_doc}
mkdir -p %{buildroot}%{_mandir}/man1
install -p -D -m 644 doc/build/man/*.1 %{buildroot}%{_mandir}/man1/
%endif

%pre
%openstack_pre_user_group_create manila manila /sbin/nologin
exit 0

%post
%tmpfiles_create %{_tmpfilesdir}/manila.conf

%post api
%systemd_post %{name}-api.service

%preun api
%systemd_preun %{name}-api.service

%postun api
%systemd_postun %{name}-api.service

%post scheduler
%systemd_post %{name}-scheduler.service

%preun scheduler
%systemd_preun %{name}-scheduler.service

%postun scheduler
%systemd_postun %{name}-scheduler.service

%post share
%systemd_post %{name}-share.service

%preun share
%systemd_preun %{name}-share.service

%postun share
%systemd_postun %{name}-share.service

%post data
%systemd_post %{name}-data.service

%preun data
%systemd_preun %{name}-data.service

%postun data
%systemd_postun %{name}-data.service

%files
%doc README.rst
%license LICENSE
%dir %attr(0750, manila, manila) %{_localstatedir}/lib/manila
%dir %attr(0750, manila, manila) %{_localstatedir}/cache/manila
%dir %attr(0750, manila, manila) %{_localstatedir}/log/manila
%_tmpfilesdir/manila.conf
%dir %{_sysconfdir}/manila
%dir %{_sysconfdir}/manila/manila.conf.d/
%dir %{_sysconfdir}/manila/manila-share.conf.d/
%dir %{_sysconfdir}/manila/rootwrap.d
%{_sysconfdir}/manila/README.config
%config(noreplace) %{_sysconfdir}/logrotate.d/manila
%config(noreplace) %{_sysconfdir}/sudoers.d/openstack-manila
%config %attr(0640, root, manila) %{_sysconfdir}/manila/api-paste.ini
%config(noreplace) %attr(0640, root, manila) %{_sysconfdir}/manila/manila.conf
%config(noreplace) %attr(0640, root, manila) %{_sysconfdir}/manila/manila.conf.d/010-manila.conf
%config %{_sysconfdir}/manila/policy.json
%config %{_sysconfdir}/manila/rootwrap.conf
%config %{_sysconfdir}/manila/rootwrap.d/share.filters
%{_bindir}/manila-all
%{_bindir}/manila-manage
%{_bindir}/manila-status
%{_bindir}/manila-rootwrap
%if 0%{?with_doc}
%{_mandir}/man1/manila-manage.1.gz
%{_mandir}/man1/manila-status.1.gz
%endif

%files -n python3-manila
%license LICENSE
%{python3_sitelib}/manila/
%{python3_sitelib}/manila-*.egg-info

%if 0%{?with_doc}
%files doc
%license LICENSE
%doc doc/build/html
%endif

%files api
%license LICENSE
%{_unitdir}/%{name}-api.service
%if 0%{?suse_version}
%{_sbindir}/rc%{name}-api
%endif
%{_bindir}/manila-api
%{_bindir}/manila-wsgi

%files scheduler
%license LICENSE
%{_unitdir}/%{name}-scheduler.service
%if 0%{?suse_version}
%{_sbindir}/rc%{name}-scheduler
%endif
%{_bindir}/manila-scheduler

%files share
%license LICENSE
%{_unitdir}/%{name}-share.service
%if 0%{?suse_version}
%{_sbindir}/rc%{name}-share
%endif
%{_bindir}/manila-share

%files data
%license LICENSE
%{_unitdir}/%{name}-data.service
%if 0%{?suse_version}
%{_sbindir}/rc%{name}-data
%endif
%{_bindir}/manila-data

%changelog
openSUSE Build Service is sponsored by