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

#
# spec file for package openstack-freezer-api
#
# Copyright (c) 2018 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 http://bugs.opensuse.org/
#


%if 0%{?rhel} || 0%{?fedora}
%global rdo 1
%endif
Name:           openstack-freezer-api
Version:        5.0.0.0~xrc2~dev2
Release:        0
Summary:        OpenStack Backup and Restore - API service
License:        Apache-2.0
Group:          Applications/System
Url:            https://launchpad.net/freezer
Source0:        freezer-api-stable-pike.tar.gz
Source1:        openstack-freezer-api.logrotate
BuildRequires:  openstack-macros
BuildRequires:  python-Paste
BuildRequires:  python-PasteDeploy >= 1.5.0
BuildRequires:  python-astroid
BuildRequires:  python-elasticsearch >= 2.0.0
BuildRequires:  python-falcon >= 1.0.0
BuildRequires:  python-fixtures >= 3.0.0
BuildRequires:  python-jsonschema >= 2.0.0
BuildRequires:  python-keystonemiddleware >= 4.12.0
BuildRequires:  python-mock >= 2.0
BuildRequires:  python-oslo.config >= 4.0.0
BuildRequires:  python-oslo.context >= 2.14.0
BuildRequires:  python-oslo.db >= 4.24.0
BuildRequires:  python-oslo.i18n >= 2.1.0
BuildRequires:  python-oslo.log >= 3.22.0
BuildRequires:  python-oslo.middleware >= 3.27.0
BuildRequires:  python-oslo.policy >= 1.23.0
BuildRequires:  python-reno >= 1.8.0
BuildRequires:  python-six >= 1.9.0
BuildRequires:  python-testrepository >= 0.0.18
BuildRequires:  python-testtools >= 1.4.0
Requires:       python-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     python-freezer-api
Summary:        Freezer API Python library
Group:          Applications/System
Requires:       python-Paste
Requires:       python-PasteDeploy >= 1.5.0
Requires:       python-elasticsearch >= 2.0.0
Requires:       python-falcon >= 1.0.0
Requires:       python-jsonschema >= 2.0.0
Requires:       python-keystonemiddleware >= 4.12.0
Requires:       python-oslo.config >= 4.0.0
Requires:       python-oslo.context >= 2.14.0
Requires:       python-oslo.db >= 4.24.0
Requires:       python-oslo.i18n >= 2.1.0
Requires:       python-oslo.log >= 3.22.0
Requires:       python-oslo.middleware >= 3.27.0
Requires:       python-oslo.policy >= 1.23.0
Requires:       python-six >= 1.9.0

%description -n python-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:  python-Sphinx
#BuildRequires:  python-openstackdocstheme >= 1.16.0
BuildRequires:  python-os-api-ref >= 1.0.0
BuildRequires:  python-oslosphinx >= 4.7.0

%description doc
OpenStack Freezer API documentation.

This package contains the documentation

%prep
%autosetup -p1 -n freezer-api-5.0.0.0rc2.dev2
%py_req_cleanup
sed -i 's/^warning-is-error.*/warning-is-error = 0/g' setup.cfg

%build
%{py2_build}

%{__python2} setup.py build_sphinx --builder=html,man
# 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

%install
%{py2_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/policy.json %{buildroot}%{_sysconfdir}/freezer/policy.json
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}%{python2_sitelib}

%pre
%openstack_pre_user_group_create freezer freezer /sbin/nologin

%check
OS_PATH_TEST=./freezer_api/tests/unit python setup.py test

%files
%license LICENSE
%doc README.rst
%{_bindir}/freezer-api
%{_bindir}/freezer-api-wsgi
%{_bindir}/freezer-manage
%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.json
%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 python-freezer-api
%defattr(-,root,root,-)
%doc README.rst
%license LICENSE
%{python2_sitelib}/freezer_api/
%{python2_sitelib}/freezer_api*.egg-info

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

%changelog
openSUSE Build Service is sponsored by