File openstack-zaqar.spec of Package openstack-zaqar

#
# spec file for package openstack-zaqar
#
# 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-zaqar
Epoch:          0
Version:        18.1.0~dev33
Release:        0
Summary:        OpenStack Message Bus (Zaqar)
License:        Apache-2.0
Group:          Development/Languages/Python
URL:            https://docs.openstack.org/zaqar
Source0:        zaqar-master.tar.gz
Source1:        openstack-zaqar.logrotate
Source2:        openstack-zaqar.tmpfiles
Source3:        openstack-zaqar.README.config
Source4:        openstack-zaqar.defaultconf
# systemd service files
Source5:        %{name}-server.service
Source6:        %{name}-gc.service
BuildRequires:  openstack-macros
BuildRequires:  python3-jsonschema
BuildRequires:  python3-oslo.cache
BuildRequires:  python3-oslo.config
BuildRequires:  python3-oslo.log
BuildRequires:  python3-osprofiler
BuildRequires:  python3-pbr
Requires:       python3-zaqar = %{epoch}:%{version}-%{release}
BuildArch:      noarch
%if 0%{?suse_version}
BuildRequires:  systemd-rpm-macros
Requires:       pwdutils
%{?systemd_requires}
%else
BuildRequires:  systemd
Requires(post): systemd
Requires(postun): systemd
Requires(pre):  shadow-utils
Requires(preun): systemd
%endif

%description
Zaqar is an OpenStack project that provides Identity, Token, Catalog
and Policy services for use specifically by projects in the OpenStack
family.

%package -n python3-zaqar
Summary:        OpenStack Message Bus (Zaqar) - Python module
Group:          Development/Languages/Python
Requires:       python3-Babel
Requires:       python3-WebOb
Requires:       python3-alembic
Requires:       python3-falcon
Requires:       python3-futurist
Requires:       python3-iso8601
Requires:       python3-jsonschema
Requires:       python3-keystoneclient
Requires:       python3-keystonemiddleware
Requires:       python3-msgpack-python
Requires:       python3-netaddr
Requires:       python3-oslo.cache
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.policy
Requires:       python3-oslo.reports
Requires:       python3-oslo.serialization
Requires:       python3-oslo.upgradecheck
Requires:       python3-oslo.utils
Requires:       python3-pymongo
Requires:       python3-python-memcached
Requires:       python3-requests
Requires:       python3-six
Requires:       python3-stevedore

%description -n python3-zaqar
Zaqar is an OpenStack project that provides Identity, Token, Catalog
and Policy services for use specifically by projects in the OpenStack
family.

This package contains the core Python module of OpenStack Zaqar.

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

%description doc
Zaqar is an OpenStack project that provides Identity, Token, Catalog
and Policy services for use specifically by projects in the OpenStack
family.

This package contains the documentation.
%endif

%package gc
Summary:        OpenStack Message Bus (Zaqar) - GC
Group:          System/Management
Requires:       %{name} = %{epoch}:%{version}-%{release}

%description gc
This package contains the OpenStack Zaqar GC Service.

%package server
Summary:        OpenStack Message Bus (Zaqar) - Server
Group:          System/Management
Requires:       %{name} = %{epoch}:%{version}-%{release}

%description server
This package contains the OpenStack Zaqar Server Service.

%prep
%autosetup -p1 -n zaqar-18.1.0.dev33
%py_req_cleanup

%build
%{py3_build}

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

%install
%{py3_install}

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

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

# sample config
PYTHONPATH=. oslo-config-generator --config-file etc/oslo-config-generator/zaqar.conf --output-file %{buildroot}%{_sysconfdir}/zaqar/zaqar.conf

### configuration files
install -p -D -m 640 %{SOURCE4} %{buildroot}%{_sysconfdir}/zaqar/zaqar.conf.d/010-zaqar.conf
install -m 644 etc/logging.conf.sample %{buildroot}%{_sysconfdir}/zaqar/logging.conf
install -p -D -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/openstack-zaqar
install -p -D -m 640 %{SOURCE3} %{buildroot}%{_sysconfdir}/zaqar/README.config

# Install systemd unit services
install -p -D -m 444 %{SOURCE5} %{buildroot}%{_unitdir}/%{name}-server.service
install -p -D -m 444 %{SOURCE6} %{buildroot}%{_unitdir}/%{name}-gc.service

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

%pre
%openstack_pre_user_group_create zaqar zaqar /sbin/nologin

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

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

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

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

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

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

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

%files
%doc README.rst
%license LICENSE
%_tmpfilesdir/%{name}.conf
%dir %attr(0750, zaqar, zaqar) %{_localstatedir}/lib/zaqar
%dir %attr(0750, zaqar, zaqar) %{_localstatedir}/log/zaqar
%dir %attr(0750, root, zaqar) %{_sysconfdir}/zaqar
%dir %attr(0750, root, zaqar) %{_sysconfdir}/zaqar/zaqar.conf.d/
%config(noreplace) %attr(0640, root, zaqar) %{_sysconfdir}/zaqar/zaqar.conf
%config(noreplace) %attr(0640, root, zaqar) %{_sysconfdir}/zaqar/logging.conf
%config(noreplace) %attr(0640, root, zaqar) %{_sysconfdir}/zaqar/zaqar.conf.d/010-zaqar.conf
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%{_sysconfdir}/zaqar/README.config
%{_bindir}/zaqar-status
%{_bindir}/zaqar-sql-db-manage
%{_bindir}/zaqar-bench

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

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

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

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

%changelog
openSUSE Build Service is sponsored by