File openstack-zaqar.spec of Package openstack-zaqar

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


%define component zaqar
%define groupname %{component}
%define username %{component}

%define version_unconverted 7.0.1.dev10

Name:           openstack-%{component}
Version:        7.0.1~dev10
Release:        0
Summary:        OpenStack Message Bus (Zaqar)
License:        Apache-2.0
Group:          Development/Languages/Python
Url:            https://github.com/stackforge/zaqar
Source:         http://tarballs.openstack.org/zaqar/zaqar-stable-rocky.tar.gz
Source1:        %{name}.conf
Source2:        %{name}.logrotate
# systemd service files
Source10:       %{name}-server.service
Source11:       %{name}-gc.service
Source50:       README.config
BuildRequires:  openstack-suse-macros
BuildRequires:  python-devel
BuildRequires:  python-oslo.config
BuildRequires:  python-pbr
BuildRequires:  systemd-rpm-macros
%{?systemd_requires}
Requires:       logrotate
Requires:       python-zaqar = %{version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Requires(pre):  pwdutils
BuildArch:      noarch

%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 python-zaqar
Summary:        OpenStack Message Bus (Zaqar) - Python module
Group:          Development/Languages/Python
Requires:       python >= 2.7
Requires:       python-Babel >= 2.3.4
Requires:       python-WebOb >= 1.7.1
Requires:       python-enum34 >= 1.0.4
Requires:       python-falcon >= 1.0.0
Requires:       python-futurist >= 1.2.0
Requires:       python-iso8601 >= 0.1.11
Requires:       python-jsonschema >= 2.6.0
Requires:       python-keystonemiddleware >= 4.17.0
Requires:       python-msgpack >= 0.5.1
Requires:       python-oslo.cache >= 1.26.0
Requires:       python-oslo.config >= 5.2.0
Requires:       python-oslo.context >= 2.19.2
Requires:       python-oslo.db >= 4.27.0
Requires:       python-oslo.i18n >= 3.15.3
Requires:       python-oslo.log >= 3.36.0
Requires:       python-oslo.messaging >= 5.29.0
Requires:       python-oslo.policy >= 1.30.0
Requires:       python-oslo.reports >= 1.18.0
Requires:       python-oslo.serialization >= 2.18.0
Requires:       python-oslo.utils >= 3.33.0
Requires:       python-pymongo >= 3.0.2
Requires:       python-python-memcached >= 1.56
Requires:       python-requests >= 2.14.2
Requires:       python-six >= 1.10.0
Requires:       python-stevedore >= 1.20.0

%description -n python-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.

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

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

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

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

%package test
Summary:        OpenStack Message Bus (Zaqar) - Testsuite
Group:          Development/Languages/Python
Requires:       %{name} = %{version}
Requires:       python-ddt >= 1.0.1
Requires:       python-fixtures >= 3.0.0
Requires:       python-mock >= 2.0.0
Requires:       python-oslotest >= 3.2.0
Requires:       python-testrepository >= 0.0.18
Requires:       python-testtools >= 2.2.0

%description test
The OpenStack Zaqar testsuite. It is used to verify the
functionality of OpenStack Zaqar.

%prep
%setup -q -n %{component}-%{version_unconverted}
%openstack_cleanup_prep

%build
python setup.py build
#python setup.py build_sphinx -b man
oslo-config-generator --config-file etc/oslo-config-generator/zaqar.conf

%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}

### directories
install -d -m 750 %{buildroot}%{_localstatedir}/{lib,log}/zaqar
install -D -m 644 %{SOURCE1} %{buildroot}/%_tmpfilesdir/%name.conf

### configuration files
install -d -m 755 %{buildroot}%{_sysconfdir}/%{component}
install -d -m 755 %{buildroot}%{_sysconfdir}/%{component}/%{component}.conf.d/
install -m 644 etc/zaqar.conf.sample %{buildroot}%{_sysconfdir}/zaqar/zaqar.conf
install -m 644 etc/logging.conf.sample %{buildroot}%{_sysconfdir}/zaqar/logging.conf
install -p -D -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}

### README.config
cp %{SOURCE50} %{buildroot}%{_sysconfdir}/%{component}/

# Install systemd unit services
mkdir -p %{buildroot}%{_sbindir} %{buildroot}%{_unitdir}
install -p -D -m 444 %{SOURCE10} %{buildroot}%{_unitdir}/%{name}-server.service
install -p -D -m 444 %{SOURCE11} %{buildroot}%{_unitdir}/%{name}-gc.service
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-server
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-gc

### test subpackage
%openstack_test_package_install

%pre
%openstack_pre_user_group_create %{username} %{groupname}

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

%pre gc
%service_add_pre %{name}-gc.service

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

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

%postun gc
%restart_on_update %{name}-gc.service
%service_del_postun %{name}-gc.service

%pre server
%service_add_pre %{name}-server.service

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

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

%postun server
%restart_on_update %{name}-server.service
%service_del_postun %{name}-server.service

%files
%defattr(-,root,root)
%doc README.rst ChangeLog
%license LICENSE
%dir %_tmpfilesdir
%_tmpfilesdir/%name.conf
%dir %attr(0750, %{username}, %{groupname}) %{_localstatedir}/lib/%{component}
%dir %attr(0750, %{username}, %{groupname}) %{_localstatedir}/log/%{component}
%dir %attr(0750, root, %{groupname}) %{_sysconfdir}/%{component}
%dir %attr(0750, root, %{groupname}) %{_sysconfdir}/%{component}/%{component}.conf.d/
%config(noreplace) %attr(0640, root, %{groupname}) %{_sysconfdir}/%{component}/%{component}.conf
%config(noreplace) %attr(0640, root, %{groupname}) %{_sysconfdir}/%{component}/logging.conf
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%{_sysconfdir}/%{component}/README.config
#%{_mandir}/man1/zaqar*
%{_bindir}/zaqar-sql-db-manage

%files -n python-zaqar
%defattr(-,root,root,-)
%{python_sitelib}/%{component}
%{python_sitelib}/%{component}-*.egg-info

%files gc
%defattr(-,root,root,-)
%{_bindir}/zaqar-gc
%{_unitdir}/%{name}-gc.service
%{_sbindir}/rc%{name}-gc

%files server
%defattr(-,root,root,-)
%{_unitdir}/%{name}-server.service
%{_sbindir}/rc%{name}-server
%{_bindir}/zaqar-server

%files test
%defattr(-,root,root)
%{_bindir}/zaqar-bench
%{_localstatedir}/lib/openstack-%{component}-test

%changelog
openSUSE Build Service is sponsored by