File openstack-heat.spec of Package openstack-heat

#
# spec file for package openstack-heat
#
# Copyright (c) 2020 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-heat
Version:        15.1.0~dev10
Release:        0
Summary:        Openstack Orchestration (Heat)
License:        Apache-2.0
Group:          Development/Languages/Python
URL:            https://docs.openstack.org/heat
Source0:        heat-master.tar.gz
Source1:        openstack-heat.logrotate
Source2:        openstack-heat.tmpfiles
Source3:        openstack-heat.defaultconf
# systemd service files
Source20:       openstack-heat-api.service
Source21:       openstack-heat-api-cfn.service
Source22:       openstack-heat-engine.service
Source50:       openstack-heat.README.config
BuildRequires:  openstack-macros
BuildRequires:  python3-PasteDeploy
BuildRequires:  python3-Routes
BuildRequires:  python3-SQLAlchemy
BuildRequires:  python3-WebOb
BuildRequires:  python3-barbicanclient
BuildRequires:  python3-cinderclient
BuildRequires:  python3-eventlet
BuildRequires:  python3-glanceclient
BuildRequires:  python3-keystoneauth1
BuildRequires:  python3-keystoneclient
BuildRequires:  python3-lxml
BuildRequires:  python3-mock
BuildRequires:  python3-netaddr
BuildRequires:  python3-neutronclient
BuildRequires:  python3-novaclient
BuildRequires:  python3-oslo.cache
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.utils
BuildRequires:  python3-oslo.versionedobjects
BuildRequires:  python3-osprofiler
BuildRequires:  python3-pbr
BuildRequires:  python3-saharaclient
BuildRequires:  python3-stevedore
BuildRequires:  python3-swiftclient
BuildRequires:  python3-tenacity
BuildRequires:  python3-yaql
Requires:       logrotate
Requires:       python3-heat = %{version}-%{release}
BuildArch:      noarch
%if 0%{?suse_version}
BuildRequires:  systemd-rpm-macros
Requires(pre):  pwdutils
%{?systemd_requires}
%else
BuildRequires:  systemd
Requires(post): systemd
Requires(postun): systemd
Requires(pre):  shadow-utils
Requires(preun): systemd
%endif

%description
Heat is a service to orchestrate composite cloud applications using a
declarative template format through an OpenStack-native REST API.

%package -n python3-heat
Summary:        Openstack Orchestration (Heat) - Python module
Group:          Development/Languages/Python
Requires:       python3-Babel
Requires:       python3-PasteDeploy
Requires:       python3-PyYAML
Requires:       python3-Routes
Requires:       python3-SQLAlchemy
Requires:       python3-WebOb
Requires:       python3-aodhclient
Requires:       python3-barbicanclient
Requires:       python3-cinderclient
Requires:       python3-croniter
Requires:       python3-cryptography
Requires:       python3-designateclient
Requires:       python3-eventlet
Requires:       python3-glanceclient
Requires:       python3-heatclient
Requires:       python3-keystoneauth1
Requires:       python3-keystoneclient
Requires:       python3-keystonemiddleware
Requires:       python3-lxml
Requires:       python3-magnumclient
Requires:       python3-manilaclient
Requires:       python3-monascaclient
Requires:       python3-netaddr
Requires:       python3-neutron-lib
Requires:       python3-neutronclient
Requires:       python3-novaclient
Requires:       python3-octaviaclient
Requires:       python3-openstackclient
Requires:       python3-openstacksdk
Requires:       python3-oslo.cache
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.reports
Requires:       python3-oslo.serialization
Requires:       python3-oslo.service
Requires:       python3-oslo.upgradecheck
Requires:       python3-oslo.utils
Requires:       python3-oslo.versionedobjects
Requires:       python3-osprofiler
Requires:       python3-pbr
Requires:       python3-pytz
Requires:       python3-requests
Requires:       python3-six
Requires:       python3-sqlalchemy-migrate
Requires:       python3-stevedore
Requires:       python3-swiftclient
Requires:       python3-tenacity
Requires:       python3-yaql

%description -n python3-heat
Heat is a service to orchestrate composite cloud applications using a
declarative template format through an OpenStack-native REST API.

This package contains the python module.

%if 0%{?with_doc}
%package doc
Summary:        Openstack Orchestration (Heat) - Documentation
Group:          Documentation/HTML
BuildRequires:  python3-Sphinx
BuildRequires:  python3-openstackdocstheme
BuildRequires:  python3-sphinxcontrib-apidoc

%description doc
Heat is a service to orchestrate composite cloud applications using a
declarative template format through an OpenStack-native REST API.

This package contains the documentation.
%endif

%package api
Summary:        Openstack Orchestration (Heat) - API
Group:          System/Management
Requires:       python3-heat = %{version}-%{release}

%description api
Heat is a service to orchestrate composite cloud applications using a
declarative template format through an OpenStack-native REST API.

This package contains the Heat API server.

%package api-cfn
Summary:        Openstack Orchestration (Heat) - CFN API
Group:          System/Management
Requires:       %{name} = %{version}-%{release}

%description api-cfn
Heat is a service to orchestrate composite cloud applications using a
declarative template format through an OpenStack-native REST API.

This package contains the Heat CFN API server.

%package engine
Summary:        Openstack Orchestration (Heat) - Engine
Group:          System/Management
Requires:       %{name} = %{version}-%{release}

%description engine
Heat is a service to orchestrate composite cloud applications using a
declarative template format through an OpenStack-native REST API.

This package contains the Heat engine.

%package plugin-heat_docker
Summary:        Openstack Orchestration (Heat) - Support for Docker
Group:          System/Management
Requires:       %{name} = %{version}-%{release}

%description plugin-heat_docker
Heat is a service to orchestrate composite cloud applications using a
declarative template format through an OpenStack-native REST API.

This package contains the Heat docker plugin

%prep
%autosetup -p1 -n openstack-heat-15.1.0.dev10
%py_req_cleanup

%build
%{py3_build}

### heat_docker plugin
pushd contrib/heat_docker
OSLO_PACKAGE_VERSION=%{version} python3 setup.py build
popd

### documentation
%if 0%{?with_doc}
PBR_VERSION=15.1.0.dev10 %sphinx_build --keep-going -b html doc/source doc/build/html
PBR_VERSION=15.1.0.dev10 %sphinx_build --keep-going -b man doc/source doc/build/man
rm -rf doc/build/html/.{doctrees,buildinfo}
rm -rf doc/build/man/.{doctrees,buildinfo}
%endif

%install
%{py3_install}

### heat_docker plugin
pushd contrib/heat_docker
OSLO_PACKAGE_VERSION=%{version} python3 setup.py install --prefix=%{_prefix} --root=%{buildroot}
# no need for the egg-info file
rm -r %{buildroot}%{python3_sitelib}/heat_contrib_docker-*.egg-info
popd

### Setup directories
install -d -m 750 %{buildroot}%{_localstatedir}/{lib,log,cache}/heat
install -d -m 755 %{buildroot}%{_sysconfdir}/heat
install -d -m 755 %{buildroot}%{_sysconfdir}/heat/heat.conf.d

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

### install config files
install -p -D -m 640 %{SOURCE3} %{buildroot}%{_sysconfdir}/heat/heat.conf.d/010-heat.conf
mv %{buildroot}/%{_prefix}/%{_sysconfdir}/heat/* %{buildroot}%{_sysconfdir}/heat/
### sample config and policy
PYTHONPATH=. oslo-config-generator --config-file=config-generator.conf --output %{buildroot}%{_sysconfdir}/heat/heat.conf
PYTHONPATH=. oslopolicy-sample-generator --config-file=etc/heat/heat-policy-generator.conf --output %{buildroot}%{_sysconfdir}/heat/policy.json
rm etc/heat/heat-policy-generator.conf
install -p -D -m 640 %{SOURCE50} %{buildroot}%{_sysconfdir}/heat/README.config

### install systemd service files
install -p -D -m 644 %{SOURCE20} %{buildroot}%{_unitdir}/openstack-heat-api.service
install -p -D -m 644 %{SOURCE21} %{buildroot}%{_unitdir}/openstack-heat-api-cfn.service
install -p -D -m 644 %{SOURCE22} %{buildroot}%{_unitdir}/openstack-heat-engine.service

### install symlinks on SUSE
%if 0%{?suse_version}
mkdir -p %{buildroot}%{_sbindir}
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-api
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-api-cfn
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-engine
%endif

### Install logrotate
install -p -D -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/openstack-heat

### 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 heat heat /sbin/nologin
exit 0

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

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

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

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

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

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

%postun api-cfn
%systemd_postun_with_restart %{name}-api-cfn.service

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

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

%postun engine
%systemd_postun_with_restart %{name}-engine.service

%files
%license LICENSE
%{_sysconfdir}/heat/README.config
%dir %attr(0750, root, heat) %{_sysconfdir}/heat
%dir %attr(0750, root, heat) %{_sysconfdir}/heat/heat.conf.d/
%config(noreplace) %attr(0640, root, heat) %{_sysconfdir}/heat/heat.conf
%config(noreplace) %attr(0640, root, heat) %{_sysconfdir}/heat/heat.conf.d/010-heat.conf
%config(noreplace) %attr(-, root, heat) %{_sysconfdir}/heat/api-paste.ini
%config %{_sysconfdir}/logrotate.d/openstack-heat
%config %{_sysconfdir}/heat/policy.json
%config %{_sysconfdir}/heat/environment.d
%config %{_sysconfdir}/heat/templates
%_tmpfilesdir/%{name}.conf
%dir %attr(0750, heat, root) %{_localstatedir}/log/heat
%dir %attr(0750, heat, root) %{_localstatedir}/lib/heat
%dir %attr(0750, heat, root) %{_localstatedir}/cache/heat
%{_bindir}/heat-db-setup
%{_bindir}/heat-manage
%{_bindir}/heat-status
%{_bindir}/heat-keystone-setup
%{_bindir}/heat-keystone-setup-domain
%{_bindir}/heat-all
%if 0%{?with_doc}
%{_mandir}/man1/heat-db-setup.1.gz
%{_mandir}/man1/heat-keystone-setup.1.gz
%{_mandir}/man1/heat-keystone-setup-domain.1.gz
%{_mandir}/man1/heat-manage.1.gz
%{_mandir}/man1/heat-status.1.gz
%endif

%files -n python3-heat
%license LICENSE
%{python3_sitelib}/heat/
%{python3_sitelib}/openstack_heat-*.egg-info
%{python3_sitelib}/heat_integrationtests

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

%files api
%license LICENSE
%{_bindir}/heat-*api
%{_unitdir}/%{name}-api.service
%if 0%{?suse_version}
%{_sbindir}/rc%{name}-api
%endif
%if 0%{?with_doc}
%{_mandir}/man1/heat-api.1.gz
%endif

%files api-cfn
%license LICENSE
%{_bindir}/heat-*api-cfn
%{_unitdir}/%{name}-api-cfn.service
%if 0%{?suse_version}
%{_sbindir}/rc%{name}-api-cfn
%endif
%if 0%{?with_doc}
%{_mandir}/man1/heat-api-cfn.1.gz
%endif

%files engine
%license LICENSE
%{_bindir}/heat-engine
%{_unitdir}/%{name}-engine.service
%if 0%{?suse_version}
%{_sbindir}/rc%{name}-engine
%endif
%if 0%{?with_doc}
%{_mandir}/man1/heat-engine.1.gz
%endif

%files plugin-heat_docker
%dir %{_prefix}/lib/heat/
%{_prefix}/lib/heat/docker/

%changelog