File openstack-ironic.spec of Package openstack-ironic

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


%global with_doc 1
%if 0%{?rhel} || 0%{?fedora}
%global rdo 1
%endif
Name:           openstack-ironic
Version:        14.0.1~dev21
Release:        0
Summary:        Openstack Provisioning of Bare Metal Servers
License:        Apache-2.0
Group:          Development/Languages/Python
URL:            https://launchpad.net/ironic
Source0:        ironic-master.tar.gz
Source1:        openstack-ironic.sudoers
Source2:        openstack-ironic.logrotate
Source3:        openstack-ironic.tmpfiles
Source4:        openstack-ironic.defaultconf
Source5:        openstack-ironic.README.config
# systemd service files
Source6:        openstack-ironic-api.service
Source7:        openstack-ironic-conductor.service
BuildRequires:  openstack-macros
BuildRequires:  python3-Babel
BuildRequires:  python3-Jinja2
BuildRequires:  python3-SQLAlchemy
BuildRequires:  python3-WSME
BuildRequires:  python3-WebOb
BuildRequires:  python3-alembic
BuildRequires:  python3-automaton
BuildRequires:  python3-cinderclient
BuildRequires:  python3-ddt
BuildRequires:  python3-eventlet
BuildRequires:  python3-fixtures
BuildRequires:  python3-futurist
BuildRequires:  python3-glanceclient
BuildRequires:  python3-ironic-lib
BuildRequires:  python3-iso8601
BuildRequires:  python3-jsonpatch
BuildRequires:  python3-jsonschema
BuildRequires:  python3-keystoneauth1
BuildRequires:  python3-keystonemiddleware
BuildRequires:  python3-mock
BuildRequires:  python3-neutronclient
BuildRequires:  python3-os-traits
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.reports
BuildRequires:  python3-oslo.rootwrap
BuildRequires:  python3-oslo.serialization
BuildRequires:  python3-oslo.service
BuildRequires:  python3-oslo.upgradecheck
BuildRequires:  python3-oslo.utils
BuildRequires:  python3-oslo.versionedobjects
BuildRequires:  python3-oslotest
BuildRequires:  python3-osprofiler
BuildRequires:  python3-pbr
BuildRequires:  python3-pecan
BuildRequires:  python3-psutil
BuildRequires:  python3-pysendfile
BuildRequires:  python3-pytz
BuildRequires:  python3-requests
BuildRequires:  python3-retrying
BuildRequires:  python3-rfc3986
BuildRequires:  python3-six
BuildRequires:  python3-stestr
BuildRequires:  python3-stevedore
BuildRequires:  python3-swiftclient
BuildRequires:  python3-testtools
BuildRequires:  python3-tooz
BuildRequires:  sudo
Requires:       logrotate
Requires:       python3-ironic = %{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
Ironic is an Incubated OpenStack project which aims to provision bare metal
machines instead of virtual machines, forked from the Nova Baremetal driver.
It is best thought of as a bare metal hypervisor API and a set of plugins
which interact with the bare metal hypervisors. By default, it will use
PXE and IPMI in concert to provision and turn on/off machines, but Ironic
also supports vendor-specific plugins which may implement additional functionality.

%package -n     python3-ironic
Summary:        OpenStack shared file system service (ironic) - Python module
Group:          Development/Languages/Python
Requires:       python3-Jinja2
Requires:       python3-SQLAlchemy
Requires:       python3-WSME
Requires:       python3-WebOb
Requires:       python3-alembic
Requires:       python3-automaton
Requires:       python3-cinderclient
Requires:       python3-eventlet
Requires:       python3-futurist
Requires:       python3-glanceclient
Requires:       python3-ironic-lib
Requires:       python3-jsonpatch
Requires:       python3-jsonschema
Requires:       python3-keystoneauth1
Requires:       python3-keystonemiddleware
Requires:       python3-neutronclient
Requires:       python3-os-traits
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.rootwrap
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-pecan
Requires:       python3-psutil
Requires:       python3-pysendfile
Requires:       python3-pytz
Requires:       python3-requests
Requires:       python3-retrying
Requires:       python3-rfc3986
Requires:       python3-six
Requires:       python3-stevedore
Requires:       python3-swiftclient
Requires:       python3-tooz
Requires:       sudo

%description -n python3-ironic
This package contains the core code of OpenStack Ironic.

%if 0%{?with_doc}
%package doc
Summary:        OpenStack bare metal provisioning service (ironic) - Documentation
Group:          Documentation/HTML
BuildRequires:  python3-Sphinx
BuildRequires:  python3-openstackdocstheme
BuildRequires:  python3-sphinxcontrib-apidoc
BuildRequires:  python3-sphinxcontrib-httpdomain
BuildRequires:  python3-sphinxcontrib-pecanwsme
BuildRequires:  python3-sphinxcontrib-seqdiag
BuildRequires:  python3-sphinxcontrib-svg2pdfconverter

%description doc
OpenStack bare metal provisioning service.
This package contains the Documentation.
%endif

%package api
Summary:        OpenStack Ironic - API
Group:          System/Management
Requires:       openstack-ironic = %{version}-%{release}

%description api
This package contains the OpenStack Ironic API Daemon.

%package conductor
Summary:        OpenStack Ironic - Conductor
Group:          System/Management
Requires:       openstack-ironic = %{version}-%{release}

%description conductor
This package contains the OpenStack Ironic Conductor Manager Daemon.

%prep
%autosetup -p1 -n ironic-14.0.1.dev21
%py_req_cleanup

%build
%{py3_build}

%if 0%{?with_doc}
PYTHONPATH=. PBR_VERSION=14.0.1.dev21 %sphinx_build --keep-going -b html doc/source doc/build/html
PYTHONPATH=. PBR_VERSION=14.0.1.dev21 %sphinx_build --keep-going -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

%install
%{py3_install}

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

### Install configuration files
install -D -m 644 %{SOURCE3} %{buildroot}/%_tmpfilesdir/ironic.conf
install -p -D -m 640 %{SOURCE4} %{buildroot}%{_sysconfdir}/ironic/ironic.conf.d/010-ironic.conf
mv %{buildroot}%{_prefix}%{_sysconfdir}/ironic/* %{buildroot}%{_sysconfdir}/ironic/
cp -a etc/ironic/rootwrap.d/ %{buildroot}%{_sysconfdir}/ironic/
install -p -D -m 640 %{SOURCE5} %{buildroot}%{_sysconfdir}/ironic/README.config

# drop ironic-lib.filters which is in the ironic-lib package (see https://review.opendev.org/684270)
rm %{buildroot}%{_sysconfdir}/ironic/rootwrap.d/ironic-lib.filters

### Install systemd service files
install -p -D -m 644 %{SOURCE6} %{buildroot}%{_unitdir}/%{name}-api.service
install -p -D -m 644 %{SOURCE7} %{buildroot}%{_unitdir}/%{name}-conductor.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}-conductor
%endif

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

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

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

%check
export LC_ALL=en_US.UTF-8
python3 -m stestr.cli run

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

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

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

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

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

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

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

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

%files
%doc README.rst
%license LICENSE
%dir %attr(0750, ironic, ironic) %{_localstatedir}/lib/ironic
%dir %attr(0750, ironic, ironic) %{_localstatedir}/cache/ironic
%dir %attr(0750, ironic, ironic) %{_localstatedir}/log/ironic
%_tmpfilesdir/ironic.conf
%dir %{_sysconfdir}/ironic
%dir %{_sysconfdir}/ironic/ironic.conf.d/
%{_sysconfdir}/ironic/README.config
%config(noreplace) %{_sysconfdir}/logrotate.d/openstack-ironic
%config(noreplace) %{_sysconfdir}/sudoers.d/openstack-ironic
%config(noreplace) %attr(0640, root, ironic) %{_sysconfdir}/ironic/ironic.conf.d/010-ironic.conf
%config %{_sysconfdir}/ironic/rootwrap.conf
%dir %{_sysconfdir}/ironic/rootwrap.d
%config(noreplace) %{_sysconfdir}/ironic/rootwrap.d/ironic-images.filters
%config(noreplace) %{_sysconfdir}/ironic/rootwrap.d/ironic-utils.filters
%{_bindir}/ironic-status
%{_bindir}/ironic-rootwrap
%{_bindir}/ironic-dbsync
%if 0%{?with_doc}
%{_mandir}/man1/ironic.1.gz
%endif

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

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

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

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

%changelog