File openstack-mistral.spec of Package openstack-mistral

#
# spec file for package openstack-mistral
#
# 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/
#


%if 0%{?rhel} || 0%{?fedora}
%global rdo 1
%endif
Name:           openstack-mistral
Version:        18.1.0~dev12
Release:        0
Summary:        Workflow Service for OpenStack cloud
License:        Apache-2.0
Group:          Development/Libraries
URL:            https://docs.openstack.org/mistral
Source0:        mistral-master.tar.gz
Source1:        openstack-mistral-api.service
Source2:        openstack-mistral-engine.service
Source3:        openstack-mistral-executor.service
Source7:        openstack-mistral.tmpfiles
BuildRequires:  openstack-macros
BuildRequires:  python3-PyJWT
BuildRequires:  python3-croniter
BuildRequires:  python3-eventlet
BuildRequires:  python3-fixtures
BuildRequires:  python3-ironic-inspector-client
BuildRequires:  python3-jsonschema
BuildRequires:  python3-kazoo
BuildRequires:  python3-keystonemiddleware
BuildRequires:  python3-mistral-lib
BuildRequires:  python3-networkx
BuildRequires:  python3-oslo.config
BuildRequires:  python3-oslo.db
BuildRequires:  python3-oslo.log
BuildRequires:  python3-oslo.messaging
BuildRequires:  python3-oslo.middleware
BuildRequires:  python3-oslo.policy
BuildRequires:  python3-oslotest
BuildRequires:  python3-osprofiler
BuildRequires:  python3-paramiko
BuildRequires:  python3-pbr
BuildRequires:  python3-requests-mock
BuildRequires:  python3-stestr
BuildRequires:  python3-stevedore
BuildRequires:  python3-tenacity
BuildRequires:  python3-tooz
BuildRequires:  python3-yaql
BuildRequires:  python3-zake
Requires:       python-mistral = %{version}-%{release}
BuildArch:      noarch
%if 0%{?suse_version}
BuildRequires:  systemd-rpm-macros
%else
BuildRequires:  systemd
%endif

%description
System package - %{name}
Python package - python-mistral

%package        doc
Summary:        Documentation for OpenStack Workflow Service
BuildRequires:  python3-Sphinx
BuildRequires:  python3-WSME
BuildRequires:  python3-openstackdocstheme
BuildRequires:  python3-pecan
BuildRequires:  python3-sphinxcontrib-httpdomain
BuildRequires:  python3-sphinxcontrib-pecanwsme

%description    doc
OpenStack Mistral documentaion.
.
This package contains the documentation

%package -n     python-mistral
Summary:        Mistral Python libraries
Requires:       python3-Babel
Requires:       python3-PyJWT
Requires:       python3-PyYAML
Requires:       python3-SQLAlchemy
Requires:       python3-WSME
Requires:       python3-alembic
Requires:       python3-cachetools
Requires:       python3-croniter
Requires:       python3-eventlet
Requires:       python3-ironic-inspector-client
Requires:       python3-jsonschema
Requires:       python3-keystonemiddleware
Requires:       python3-mistral-lib
Requires:       python3-networkx
Requires:       python3-oslo.concurrency
Requires:       python3-oslo.config
Requires:       python3-oslo.db
Requires:       python3-oslo.log
Requires:       python3-oslo.messaging
Requires:       python3-oslo.middleware
Requires:       python3-oslo.policy
Requires:       python3-oslo.serialization
Requires:       python3-oslo.service
Requires:       python3-oslo.utils
Requires:       python3-osprofiler
Requires:       python3-paramiko
Requires:       python3-pbr
Requires:       python3-pecan
Requires:       python3-requests
Requires:       python3-six
Requires:       python3-stevedore
Requires:       python3-tooz
Requires:       python3-yaql
Requires:       python3-zake

%description -n python-mistral
Mistral is a workflow service.
Most business processes consist of multiple distinct interconnected steps that need to be executed in a particular order
in a distributed environment. One can describe such process as a set of tasks and task relations and upload such description
to Mistral so that it takes care of state management, correct execution order, parallelism, synchronization and high availability.
.
This package contains the Python libraries.

%package        api
Summary:        OpenStack Mistral API service
Requires:       %{name} = %{version}

%description    api
OpenStack rest API to the Mistral api.
.
This package contains the ReST API.

%package        engine
Summary:        OpenStack Mistral Engine service
Requires:       %{name} = %{version}

%description    engine
OpenStack Mistral Engine service.
.
This package contains the mistral engine, which is one of core services of mistral.

%package        executor
Summary:        OpenStack Mistral Executor service
Requires:       %{name} = %{version}

%description    executor
OpenStack Mistral Executor service.
.
This package contains the mistral executor, which is one of core services of mistral, and
which the API servers will use.

%prep
%if 0%{?rdo}
%autosetup -p1 -n mistral-%{upstream_version}
%else
%autosetup -p1 -n mistral-18.1.0.dev12
%endif

%py_req_cleanup

%build
%{py3_build}
export PYTHONPATH="."
oslo-config-generator --config-file tools/config/config-generator.mistral.conf \
--output-file etc/mistral.conf.sample

PBR_VERSION=18.1.0.dev12 %sphinx_build -b html doc/source doc/build/html
# remove the sphinx-build leftovers
rm -rf doc/build/html/.{doctrees,buildinfo}

%install
%{py3_install}

install -d -m 755 %{buildroot}%{_sysconfdir}/mistral/
install -d -m 750 %{buildroot}%{_localstatedir}/log/mistral

# install tmpfiles
install -D -m 644 %{SOURCE7} %{buildroot}/%_tmpfilesdir/%name.conf

#systemd unitfiles
install -p -D -m 644 %SOURCE1 %{buildroot}%{_unitdir}/openstack-mistral-api.service
install -p -D -m 644 %SOURCE2 %{buildroot}%{_unitdir}/openstack-mistral-engine.service
install -p -D -m 644 %SOURCE3 %{buildroot}%{_unitdir}/openstack-mistral-executor.service

install -p -D -m 640 etc/mistral.conf.sample %{buildroot}%{_sysconfdir}/mistral/mistral.conf
install -p -D -m 640 etc/logging.conf.sample %{buildroot}%{_sysconfdir}/mistral/logging.conf
install -p -D -m 640 etc/wf_trace_logging.conf.sample %{buildroot}%{_sysconfdir}/mistral/wf_trace_logging.conf
chmod +x %{buildroot}%{_bindir}/mistral*

%pre
%openstack_pre_user_group_create mistral mistral

%check
# we don't want hacking/pep8 tests
rm -r mistral/tests/unit/hacking/
%{openstack_stestr_run}

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

%post api
%systemd_post openstack-mistral-api.service

%preun api
%systemd_preun openstack-mistral-api.service

%postun api
%systemd_postun_with_restart openstack-mistral-api.service

%post engine
%systemd_post openstack-mistral-engine.service

%preun engine
%systemd_preun openstack-mistral-engine.service

%postun engine
%systemd_postun_with_restart openstack-mistral-engine.service

%post executor
%systemd_post openstack-mistral-executor.service

%preun executor
%systemd_preun openstack-mistral-executor.service

%postun executor
%systemd_postun_with_restart openstack-mistral-executor.service

%files api
%{_unitdir}/openstack-mistral-api.service

%files
%license LICENSE
%dir %{_sysconfdir}/mistral
%config(noreplace) %attr(-, mistral, mistral) %{_sysconfdir}/mistral/*
%{_bindir}/mistral-*
%_tmpfilesdir/%name.conf
%dir %attr(750, mistral, mistral) %{_localstatedir}/log/mistral

%files doc
%license LICENSE
%doc doc/build/html

%files engine
%{_unitdir}/openstack-mistral-engine.service

%files executor
%{_unitdir}/openstack-mistral-executor.service

%files -n python-mistral
%{python3_sitelib}/mistral*

%changelog
openSUSE Build Service is sponsored by