File openstack-freezer.spec of Package openstack-freezer

#
# spec file for package openstack-freezer
#
# 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
Version:        5.0.1~dev8
Release:        0
Summary:        OpenStack Backup and Restore
License:        Apache-2.0
Group:          Development/Languages/Python
Url:            https://launchpad.net/freezer
Source0:        freezer-stable-pike.tar.gz
Source1:        openstack-freezer.logrotate
Source2:        openstack-freezer-scheduler.service
BuildRequires:  openstack-macros
BuildRequires:  openstack-tempest
BuildRequires:  python-APScheduler
BuildRequires:  python-Babel >= 2.3.4
BuildRequires:  python-PyMySQL >= 0.7.6
BuildRequires:  python-botocore >= 1.0.0
BuildRequires:  python-cinderclient >= 3.1.0
BuildRequires:  python-ddt >= 1.0.1
BuildRequires:  python-fixtures >= 3.0.0
BuildRequires:  python-freezerclient >= 1.3.0
BuildRequires:  python-glanceclient >= 2.8.0
BuildRequires:  python-keystoneauth1 >= 3.1.0
BuildRequires:  python-keystoneclient >= 3.8.0
BuildRequires:  python-mock >= 2.0
BuildRequires:  python-neutronclient >= 6.3.0
BuildRequires:  python-novaclient >= 9.0.0
BuildRequires:  python-os-brick >= 1.15.2
BuildRequires:  python-oslo.config >= 4.0.0
BuildRequires:  python-oslo.log >= 3.22.0
BuildRequires:  python-oslo.service >= 1.10.0
BuildRequires:  python-oslo.utils >= 3.20.0
BuildRequires:  python-paramiko >= 2.0
BuildRequires:  python-pbr >= 2.0.0
BuildRequires:  python-psutil >= 3.2.2
BuildRequires:  python-pycrypto >= 2.6
BuildRequires:  python-pymongo >= 3.0.2
BuildRequires:  python-setuptools >= 16.0
BuildRequires:  python-six >= 1.9.0
BuildRequires:  python-swiftclient >= 3.2.0
Requires:       python-freezer = %{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
OpenStack Swift incremental backup and restore automation tool for
file system, MongoDB, MySQL. LVM snapshot and encryption support.

%package -n     python-freezer
Summary:        Freezer Python libraries
Group:          Applications/System
Requires:       python-APScheduler
Requires:       python-Babel >= 2.3.4
Requires:       python-PyMySQL >= 0.7.6
Requires:       python-botocore >= 1.0.0
Requires:       python-cinderclient >= 3.1.0
Requires:       python-freezerclient >= 1.3.0
Requires:       python-glanceclient >= 2.8.0
Requires:       python-keystoneauth1 >= 3.1.0
Requires:       python-keystoneclient >= 3.8.0
Requires:       python-neutronclient >= 6.3.0
Requires:       python-novaclient >= 9.0.0
Requires:       python-os-brick >= 1.15.2
Requires:       python-oslo.config >= 4.0.0
Requires:       python-oslo.log >= 3.22.0
Requires:       python-oslo.service >= 1.10.0
Requires:       python-oslo.utils >= 3.20.0
Requires:       python-paramiko >= 2.0
Requires:       python-psutil >= 3.2.2
Requires:       python-pycrypto >= 2.6
Requires:       python-pymongo >= 3.0.2
Requires:       python-six >= 1.9.0
Requires:       python-swiftclient >= 3.2.0

%description -n python-freezer
OpenStack Swift incremental backup and restore automation tool for
file system, MongoDB, MySQL. LVM snapshot and encryption support.

This package contains the Freezer python libraries.

%package agent
Summary:        OpenStack Freezer - Agent service
Group:          Applications/System
Requires:       %{name} = %{version}-%{release}

%description agent
OpenStack Swift incremental backup and restore automation tool for
file system, MongoDB, MySQL. LVM snapshot and encryption support.

This package contains the Freezer agent code.

%package scheduler
Summary:        OpenStack Freezer - Scheduler service
Group:          Applications/System
Requires:       %{name} = %{version}-%{release}

%description scheduler
OpenStack Swift incremental backup and restore automation tool for
file system, MongoDB, MySQL. LVM snapshot and encryption support.

This package contains the Freezer scheduler agent.

%package doc
Summary:        Documentation for OpenStack Backup Service
Group:          Documentation/HTML
BuildRequires:  fdupes
BuildRequires:  python-Sphinx
BuildRequires:  python-openstackdocstheme >= 1.16.0

%description doc
OpenStack Freezer documentaion.

This package contains the documentation

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

%build
%{py2_build}

#NOTE(aplanas): The manual page cannot be generated yet
%{__python2} setup.py build_sphinx --builder=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/scheduler.conf \
    --output-file etc/scheduler.conf.sample

%install
%{py2_install}
install -d -m 755 %{buildroot}%{_sysconfdir}/freezer
install -d -m 755 %{buildroot}%{_localstatedir}/{lib,log}/freezer
install -d -m 755 %{buildroot}%{_sysconfdir}/freezer/freezer.conf.d/
install -d -m 750 %{buildroot}%{_sysconfdir}/freezer/scheduler/
install -d -m 750 %{buildroot}%{_sysconfdir}/freezer/scheduler/conf.d/
install -p -D -m 640 etc/scheduler.conf.sample %{buildroot}%{_sysconfdir}/freezer/scheduler.conf
install -p -D -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/openstack-freezer
install -p -D -m 755 %{SOURCE2} %{buildroot}%{_unitdir}/%{name}-scheduler.service

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

# remove Windows script
rm -fr %{buildroot}%{_prefix}/freezer/scripts/vss.ps1

%pre
%openstack_pre_user_group_create freezer freezer /sbin/nologin

#POST actions
%post scheduler
%systemd_post %{name}-scheduler.service

#PREUN actions
%preun scheduler
%systemd_preun %{name}-scheduler.service

#POSTUN actions
%postun scheduler
%systemd_postun_with_restart %{name}-scheduler.service

%check
OS_TEST_PATH=./freezer/tests/unit python setup.py testr

%files
%license LICENSE
%doc README.rst
%dir %attr(0750, root, freezer) %{_sysconfdir}/freezer/
%dir %attr(0750, root, freezer) %{_sysconfdir}/freezer/freezer.conf.d/
%dir %attr(0750, root, freezer) %{_sysconfdir}/freezer/scheduler/
%dir %attr(0750, root, freezer) %{_sysconfdir}/freezer/scheduler/conf.d/
%config(noreplace) %attr(0640, root, freezer) %{_sysconfdir}/freezer/scheduler.conf
%config(noreplace) %{_sysconfdir}/logrotate.d/openstack-freezer
%dir %attr(0755, freezer, freezer) %{_localstatedir}/lib/freezer
%dir %attr(0750, freezer, freezer) %{_localstatedir}/log/freezer

%files -n python-freezer
%defattr(-,root,root,-)
%doc README.rst
%license LICENSE
%{python2_sitelib}/freezer*
%{python2_sitelib}/freezer-*.egg-info

%files agent
%license LICENSE
%{_bindir}/freezer-agent

%files scheduler
%license LICENSE
%{_bindir}/freezer-scheduler
%{_unitdir}/%{name}-scheduler.service

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

%changelog
openSUSE Build Service is sponsored by