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

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


%if 0%{?rhel} || 0%{?fedora}
%global rdo 1
%endif
Name:           openstack-freezer-api
Version:        15.0.1~dev5
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-master.tar.gz
Source1:        openstack-freezer-api.logrotate
BuildRequires:  openstack-macros
BuildRequires:  python3-Paste
BuildRequires:  python3-PasteDeploy
BuildRequires:  python3-astroid
BuildRequires:  python3-elasticsearch
BuildRequires:  python3-falcon
BuildRequires:  python3-fixtures
BuildRequires:  python3-jsonschema
BuildRequires:  python3-keystonemiddleware
BuildRequires:  python3-oslo.config
BuildRequires:  python3-oslo.context
BuildRequires:  python3-oslo.db
BuildRequires:  python3-oslo.i18n
BuildRequires:  python3-oslo.log
BuildRequires:  python3-oslo.middleware
BuildRequires:  python3-oslo.policy
BuildRequires:  python3-oslo.serialization
BuildRequires:  python3-oslo.upgradecheck
BuildRequires:  python3-oslotest
BuildRequires:  python3-reno
BuildRequires:  python3-stestr
BuildRequires:  python3-testresources
BuildRequires:  python3-testscenarios
BuildRequires:  python3-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:       python3-Paste
Requires:       python3-PasteDeploy
Requires:       python3-elasticsearch
Requires:       python3-falcon
Requires:       python3-jsonschema
Requires:       python3-keystonemiddleware
Requires:       python3-oslo.config
Requires:       python3-oslo.context
Requires:       python3-oslo.db
Requires:       python3-oslo.i18n
Requires:       python3-oslo.log
Requires:       python3-oslo.middleware
Requires:       python3-oslo.policy
Requires:       python3-oslo.serialization

%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:  python3-Sphinx
#BuildRequires: python3-openstackdocstheme
BuildRequires:  python3-os-api-ref

%description doc
OpenStack Freezer API documentation.

This package contains the documentation

%prep
%autosetup -p1 -n freezer-api-15.0.1.dev5
%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
%{openstack_stestr_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