File openstack-freezer-api.spec of Package openstack-freezer-api

#
# spec file for package openstack-freezer-api
#
# Copyright (c) 2023 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-freezer-api
Version:        12.0.0.0~xrc2~dev2
Release:        0
Summary:        OpenStack Backup and Restore - API service
License:        Apache-2.0
Group:          Development/Languages/Python
URL:            https://docs.openstack.org/freezer
Source0:        freezer-api-stable-yoga.tar.gz
Source1:        openstack-freezer-api.logrotate
BuildRequires:  openstack-macros
BuildRequires:  python39-Paste
BuildRequires:  python39-PasteDeploy
BuildRequires:  python39-astroid
BuildRequires:  python39-elasticsearch
BuildRequires:  python39-falcon
BuildRequires:  python39-fixtures
BuildRequires:  python39-jsonschema
BuildRequires:  python39-keystonemiddleware
BuildRequires:  python39-mock
BuildRequires:  python39-oslo.config
BuildRequires:  python39-oslo.context
BuildRequires:  python39-oslo.db
BuildRequires:  python39-oslo.i18n
BuildRequires:  python39-oslo.log
BuildRequires:  python39-oslo.middleware
BuildRequires:  python39-oslo.policy
BuildRequires:  python39-oslo.serialization
BuildRequires:  python39-oslo.upgradecheck
BuildRequires:  python39-oslotest
BuildRequires:  python39-reno
BuildRequires:  python39-six
BuildRequires:  python39-stestr
BuildRequires:  python39-testresources
BuildRequires:  python39-testscenarios
BuildRequires:  python39-testtools
Requires:       python3-freezer-api = %{version}-%{release}
BuildArch:      noarch
%if 0%{?suse_version}
BuildRequires:  systemd-rpm-macros
Requires(pre):  pwdutils
%{?systemd_requires}
%endif
%if 0%{?rdo}
BuildRequires:  systemd
Requires(post): systemd
Requires(postun):systemd
Requires(pre):  shadow-utils
Requires(preun):systemd
%endif

%description
API service for OpenStack Freeze: an OpenStack Swift incremental
backup and restore automation tool for file system, MongoDB,
MySQL. LVM snapshot and encryption support.

%package -n     python3-freezer-api
Summary:        Freezer API Python library
Group:          Development/Languages/Python
Requires:       python39-Paste
Requires:       python39-PasteDeploy
Requires:       python39-elasticsearch
Requires:       python39-falcon
Requires:       python39-jsonschema
Requires:       python39-keystonemiddleware
Requires:       python39-oslo.config
Requires:       python39-oslo.context
Requires:       python39-oslo.db
Requires:       python39-oslo.i18n
Requires:       python39-oslo.log
Requires:       python39-oslo.middleware
Requires:       python39-oslo.policy
Requires:       python39-oslo.serialization
Requires:       python39-six

%description -n python3-freezer-api
API service for OpenStack Freezer: an OpenStack Swift incremental
backup and restore automation tool for file system, MongoDB,
MySQL. LVM snapshot and encryption support.

This package contains the Freezer API python libraries.

%package doc
Summary:        Documentation for OpenStack Backup Service
Group:          Documentation/HTML
BuildRequires:  fdupes
BuildRequires:  python39-Sphinx
#BuildRequires: python39-openstackdocstheme
BuildRequires:  python39-os-api-ref

%description doc
OpenStack Freezer API documentation.

This package contains the documentation

%prep
%autosetup -p1 -n freezer-api-12.0.0.0rc2.dev2
%py_req_cleanup

%build
%{py3_build}

PBR_VERSION=%{version} %sphinx_build -b html doc/source doc/build/html
# remove the Sphinx-build leftovers
rm -rf doc/build/html/.{doctrees,buildinfo}
%fdupes doc/build/html/

# config file generation
PYTHONPATH=. oslo-config-generator --config-file config-generator/freezer-api.conf \
    --output-file etc/freezer/freezer-api.conf.sample
# policy file generation
PYTHONPATH=. oslopolicy-sample-generator --config-file etc/freezer/freezer-policy-generator.conf \
    --output-file etc/freezer/freezer-api.policy.yaml

%install
%{py3_install}
install -d -m 755 %{buildroot}%{_sysconfdir}/freezer
install -d -m 755 %{buildroot}%{_sysconfdir}/freezer/freezer-api.conf.d/
install -d -m 755 %{buildroot}%{_localstatedir}/{lib,log}/freezer
install -p -D -m 640 etc/freezer/freezer-api.conf.sample %{buildroot}%{_sysconfdir}/freezer/freezer-api.conf
install -p -D -m 640 etc/freezer/freezer-api.policy.yaml %{buildroot}%{_sysconfdir}/freezer/policy.yaml
install -p -D -m 640 etc/freezer/freezer-paste.ini %{buildroot}%{_sysconfdir}/freezer/freezer-paste.ini
install -p -D -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/openstack-freezer-api

# remove duplicates
%fdupes %{buildroot}%{python3_sitelib}

%pre
%openstack_pre_user_group_create freezer freezer /sbin/nologin

%check
python3 -m stestr.cli run

%files
%license LICENSE
%doc README.rst
%{_bindir}/freezer-api
%{_bindir}/freezer-api-wsgi
%{_bindir}/freezer-manage
%{_bindir}/freezer-manager-status
%dir %attr(0750, root, freezer) %{_sysconfdir}/freezer/
%dir %attr(0750, root, freezer) %{_sysconfdir}/freezer/freezer-api.conf.d/
%config(noreplace) %attr(0640, root, freezer) %{_sysconfdir}/freezer/freezer-api.conf
%config(noreplace) %attr(0640, root, freezer) %{_sysconfdir}/freezer/freezer-paste.ini
%config(noreplace) %attr(0640, root, freezer) %{_sysconfdir}/freezer/policy.yaml
%config(noreplace) %{_sysconfdir}/logrotate.d/openstack-freezer-api
%dir %attr(0755, freezer, freezer) %{_localstatedir}/lib/freezer
%dir %attr(0750, freezer, freezer) %{_localstatedir}/log/freezer

%files -n python3-freezer-api
%doc README.rst
%license LICENSE
%{python3_sitelib}/freezer_api/
%{python3_sitelib}/freezer_api*.egg-info

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

%changelog
openSUSE Build Service is sponsored by