File holland.spec of Package holland.rpm

%bcond_without pgdump
%bcond_without xtrabackup
%bcond_without commvault
%bcond_without mongodump
%bcond_without mariabackup

Name: holland
Version: 1.2.2
Release: 1%{?dist}
Summary: Pluggable Backup Framework
License: BSD
URL: http://hollandbackup.org
Source0: https://github.com/holland-backup/holland/archive/v%{version}/holland-%{version}.tar.gz
Source1: https://github.com/holland-backup/holland-backup.github.com/archive/v%{version}/holland-docs-%{version}.tar.gz
BuildArch: noarch

BuildRequires: python3-devel
BuildRequires: python3-setuptools
# need at least 1.0 for man page builder
BuildRequires: python3-Sphinx
Requires: python3-setuptools
Requires: python3-six
Requires: python3-configobj


%description
A pluggable backup framework which focuses on, but is not limited to, highly
configurable database backups.


%package common
Summary: Common library functionality for Holland Plugins
License: GPLv2+
Requires: %{name} = %{version}-%{release}


%description common
Library for common functionality used by holland plugins


%package mysql
Summary: MySQL library functionality for Holland Plugins
License: GPLv2+
Requires: %{name}-common = %{version}-%{release}
Requires: python3-mysql

%description mysql
Library for MySQL functionality used by holland plugins


%package mysqldump
Summary: Logical mysqldump backup plugin for Holland
License: GPLv2+
Requires: %{name}-mysql = %{version}-%{release}
Requires: /usr/bin/mysqldump


%description mysqldump
This plugin allows holland to perform logical backups of a MySQL database
using the mysqldump command.


%package lvm
Summary: LVM library functionality for Holland Plugins
License: GPLv2+
Requires: %{name} = %{version}-%{release}


%description lvm
Library for LVM functionality used by holland plugins


%package mysqllvm
Summary: Holland LVM snapshot backup plugin for MySQL
License: GPLv2+
Requires: %{name}-mysql = %{version}-%{release}
Requires: %{name}-lvm = %{version}-%{release}
Requires: lvm2 tar


%description mysqllvm
This plugin allows holland to perform LVM snapshot backups of a MySQL database
and to generate a tar archive of the raw data directory.


%if %{with pgdump}
%package pgdump
Summary: Holland Backup Provider for PostgreSQL
License: GPLv2+
Requires: %{name}-common = %{version}-%{release}
Requires: python3-psycopg2


%description pgdump
This plugin allows holland to backup PostgreSQL databases via the pg_dump command.
%endif


%if %{with xtrabackup}
%package xtrabackup
Summary: Holland plugin for Percona XtraBackup
License: GPLv2+
Requires: %{name}-common = %{version}-%{release}
Requires: /usr/bin/xtrabackup
Requires: python3-mysql


%description xtrabackup
This package provides a Holland plugin for Percona Xtrabackup. This
plugin requires Percona XtraBackup and runs the provided
/usr/bin/innobackupex script.
%endif


%if %{with mongodump}
%package mongodump
Summary: Mongodump backup provider plugin for holland
License: GPLv2+
Requires: %{name}-common = %{version}-%{release}
Requires: python3-pymongo


%description mongodump
This plugin allows holland to backup MongoDB databases via the mongodump command.
%endif


%if %{with mariabackup}
%package mariabackup
Summary: Holland plugin for Mariabackup
License: GPLv2+
Requires: %{name}-common = %{version}-%{release}
# This plugin shells out to the `mariabackup` command, which was added in
# MariaDB 10.1.  That is not available from RHEL or EPEL.  A user can still use
# this plugin if they enable the mariadb.org repos, but since we can't
# guarantee that will be available, don't require anything and rely on the
# error message logic in the code.


%description mariabackup
This package provides a Holland plugin for mariabackup.  This plugin requires
the mariabackup command to be available.
%endif


%if %{with commvault}
%package commvault
Summary: Holland plugin for Commvault
License: BSD
Requires: %{name} = %{version}-%{release}
Requires: tar
Obsoletes: %{name}-commvault < 1.0.3-3


%description commvault
This package provides the holland Commvault command plugin, enabling Commvault
environments to trigger a backup through holland.
%endif


%prep
%setup -q -a 1
rmdir docs
mv holland-backup.github.com-%{version} docs

find -name setup.cfg -delete
mv plugins/README README.plugins
mv config/providers/README README.providers

# cleanup, will be removed upstream at some point
rm plugins/ACTIVE


%build
%py3_build
make -C docs man
 
# library : holland.lib.common
pushd plugins/holland.lib.common
%py3_build
popd
 
# library : holland.lib.mysql
pushd plugins/holland.lib.mysql
%py3_build
popd
 
# library: holland.lib.lvm
pushd plugins/holland.lib.lvm
%py3_build
popd
 
# plugin : holland.backup.mysqldump
pushd plugins/holland.backup.mysqldump
%py3_build
popd
 
# plugin : holland.backup.mysql_lvm
pushd plugins/holland.backup.mysql_lvm
%py3_build
popd
 
%if %{with pgdump}
# plugin : holland.backup.pgdump
pushd plugins/holland.backup.pgdump
%py3_build
popd
%endif
 
%if %{with xtrabackup}
# plugin : holland.backup.xtrabackup
pushd plugins/holland.backup.xtrabackup
%py3_build
popd
%endif
 
%if %{with mongodump}
# plugin : holland.backup.mongodump
pushd plugins/holland.backup.mongodump
%py3_build
popd
%endif
 
%if %{with mariabackup}
# plugin : holland.backup.mariabackup
pushd plugins/holland.backup.mariabackup
%py3_build
popd
%endif
 
%if %{with commvault}
# plugin : holland_commvault
pushd contrib/holland-commvault
%py3_build
popd
%endif
 
 
%install
mkdir -p %{buildroot}%{_sysconfdir}/holland/{backupsets,providers} \
         %{buildroot}%{_localstatedir}/spool/holland \
         %{buildroot}%{_localstatedir}/log/holland \
         %{buildroot}%{_mandir}/man5
 
# holland-core
%py3_install
mkdir -p %{buildroot}%{python3_sitelib}/holland/{lib,backup,commands,restore}
install -m 0640 config/holland.conf %{buildroot}%{_sysconfdir}/holland/
mkdir -p %{buildroot}%{_mandir}/man1
install -m 0644 docs/_build/man/holland.1 %{buildroot}%{_mandir}/man1
 
# library : holland.lib.common
pushd plugins/holland.lib.common
%py3_install
popd
 
# library : holland.lib.mysql
pushd plugins/holland.lib.mysql
%py3_install
popd
 
# library: holland.lib.lvm
pushd plugins/holland.lib.lvm
%py3_install
popd
 
# plugin : holland.backup.mysqldump
pushd plugins/holland.backup.mysqldump
%py3_install
popd
install -m 0640 config/providers/mysqldump.conf %{buildroot}%{_sysconfdir}/holland/providers/
 
# plugin : holland.backup.mysql_lvm
pushd plugins/holland.backup.mysql_lvm
%py3_install
popd
install -m 0640 config/providers/mysql-lvm.conf %{buildroot}%{_sysconfdir}/holland/providers/
install -m 0640 config/providers/mysqldump-lvm.conf %{buildroot}%{_sysconfdir}/holland/providers/
 
# plugin : holland.backup.pgdump
%if %{with pgdump}
pushd plugins/holland.backup.pgdump
%py3_install
popd
install -m 0640 config/providers/pgdump.conf %{buildroot}%{_sysconfdir}/holland/providers/
%endif
 
%if %{with xtrabackup}
# plugin : holland.backup.xtrabackup
pushd plugins/holland.backup.xtrabackup
%py3_install
popd
install -m 0640 config/providers/xtrabackup.conf %{buildroot}%{_sysconfdir}/holland/providers/
%endif
 
%if %{with mongodump}
# plugin : holland.backup.mongodump
pushd plugins/holland.backup.mongodump
%py3_install
popd
install -m 0640 config/providers/mongodump.conf %{buildroot}%{_sysconfdir}/holland/providers/
%endif
 
%if %{with mariabackup}
# plugin : holland.backup.mariabackup
pushd plugins/holland.backup.mariabackup
%py3_install
popd
install -m 0640 config/providers/mariabackup.conf %{buildroot}%{_sysconfdir}/holland/providers/
%endif
 
%if %{with commvault}
# plugin : holland_commvault
pushd contrib/holland-commvault
%py3_install
install -m 0644 doc/holland_cvmysqlsv.1 %{buildroot}%{_mandir}/man1
popd
%endif
 
# logrotate
mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d
cat > %{buildroot}%{_sysconfdir}/logrotate.d/holland <<EOF
/var/log/holland.log /var/log/holland/holland.log {
    rotate 4
    weekly
    compress
    missingok
    create root adm
}
EOF
 
 
%files
%license LICENSE
%doc CHANGES.rst README.md README.plugins README.providers config/backupsets/examples/
%{_bindir}/holland
%{_mandir}/man1/holland.1*
%{_localstatedir}/log/holland/
%attr(0755,root,root) %dir %{_sysconfdir}/holland/
%attr(0755,root,root) %dir %{_sysconfdir}/holland/backupsets/
%attr(0755,root,root) %dir %{_sysconfdir}/holland/providers/
%attr(0640,root,root) %config(noreplace) %{_sysconfdir}/holland/holland.conf
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/logrotate.d/holland
%attr(0755,root,root) %{_localstatedir}/spool/holland/
%dir %{python3_sitelib}/holland/
%dir %{python3_sitelib}/holland/backup/
%dir %{python3_sitelib}/holland/backup/__pycache__
%dir %{python3_sitelib}/holland/restore/
%dir %{python3_sitelib}/holland/lib/
%dir %{python3_sitelib}/holland/lib/__pycache__
%{python3_sitelib}/holland/commands/
%{python3_sitelib}/holland/core/
%{python3_sitelib}/holland-%{version}-py%{python3_version}-nspkg.pth
%{python3_sitelib}/holland-%{version}-py%{python3_version}.egg-info/
 
 
%files common
%license plugins/holland.lib.common/LICENSE
%doc plugins/holland.lib.common/README
%{python3_sitelib}/holland/lib/archive/
%{python3_sitelib}/holland/lib/compression.py
%{python3_sitelib}/holland/lib/safefilename.py
%{python3_sitelib}/holland/lib/which.py
%{python3_sitelib}/holland/lib/__pycache__/compression.cpython-%{python3_version_nodots}*.py*
%{python3_sitelib}/holland/lib/__pycache__/safefilename.cpython-%{python3_version_nodots}*.py*
%{python3_sitelib}/holland/lib/__pycache__/which.cpython-%{python3_version_nodots}*.py*
%{python3_sitelib}/holland.lib.common-%{version}-py%{python3_version}-nspkg.pth
%{python3_sitelib}/holland.lib.common-%{version}-py%{python3_version}.egg-info/
 
 
%files mysql
%license plugins/holland.lib.mysql/LICENSE
%{python3_sitelib}/holland/lib/mysql/
%{python3_sitelib}/holland.lib.mysql-%{version}-py%{python3_version}-nspkg.pth
%{python3_sitelib}/holland.lib.mysql-%{version}-py%{python3_version}.egg-info/
 
 
%files mysqldump
%license plugins/holland.backup.mysqldump/LICENSE
%doc plugins/holland.backup.mysqldump/README
%{python3_sitelib}/holland/backup/mysqldump/
%{python3_sitelib}/holland.backup.mysqldump-%{version}-py%{python3_version}-nspkg.pth
%{python3_sitelib}/holland.backup.mysqldump-%{version}-py%{python3_version}.egg-info/
%config(noreplace) %{_sysconfdir}/holland/providers/mysqldump.conf
 
 
%files lvm
%license plugins/holland.lib.lvm/LICENSE
%doc plugins/holland.lib.lvm/README
%{python3_sitelib}/holland/lib/lvm/
%{python3_sitelib}/holland.lib.lvm-%{version}-py%{python3_version}-nspkg.pth
%{python3_sitelib}/holland.lib.lvm-%{version}-py%{python3_version}.egg-info/
 
 
%files mysqllvm
%license plugins/holland.backup.mysql_lvm/LICENSE
%doc plugins/holland.backup.mysql_lvm/README
%{python3_sitelib}/holland/backup/mysql_lvm/
%{python3_sitelib}/holland.backup.mysql_lvm-%{version}-py%{python3_version}-nspkg.pth
%{python3_sitelib}/holland.backup.mysql_lvm-%{version}-py%{python3_version}.egg-info/
%config(noreplace) %{_sysconfdir}/holland/providers/mysql-lvm.conf
%config(noreplace) %{_sysconfdir}/holland/providers/mysqldump-lvm.conf
 
 
%if %{with pgdump}
%files pgdump
%license plugins/holland.backup.pgdump/LICENSE
%doc plugins/holland.backup.pgdump/README
%{python3_sitelib}/holland/backup/pgdump/
%{python3_sitelib}/holland.backup.pgdump-%{version}-py%{python3_version}-nspkg.pth
%{python3_sitelib}/holland.backup.pgdump-%{version}-py%{python3_version}.egg-info/
%config(noreplace) %{_sysconfdir}/holland/providers/pgdump.conf
%endif
 
 
%if %{with xtrabackup}
%files xtrabackup
%license plugins/holland.backup.xtrabackup/LICENSE
%doc plugins/holland.backup.xtrabackup/README
%{python3_sitelib}/holland/backup/xtrabackup/
%{python3_sitelib}/holland.backup.xtrabackup-%{version}-py%{python3_version}-nspkg.pth
%{python3_sitelib}/holland.backup.xtrabackup-%{version}-py%{python3_version}.egg-info/
%config(noreplace) %{_sysconfdir}/holland/providers/xtrabackup.conf
%endif
 
 
%if %{with mongodump}
%files mongodump
%license plugins/holland.backup.mongodump/LICENSE
%doc plugins/holland.backup.mongodump/README
%{python3_sitelib}/holland/backup/mongodump.py
%{python3_sitelib}/holland/backup/__pycache__/mongodump.cpython-%{python3_version_nodots}*.py*
%{python3_sitelib}/holland.backup.mongodump-%{version}-py%{python3_version}-nspkg.pth
%{python3_sitelib}/holland.backup.mongodump-%{version}-py%{python3_version}.egg-info/
%config(noreplace) %{_sysconfdir}/holland/providers/mongodump.conf
%endif
 
 
%if %{with mariabackup}
%files mariabackup
%license plugins/holland.backup.mariabackup/LICENSE
%doc plugins/holland.backup.mariabackup/README
%{python3_sitelib}/holland/backup/mariabackup/
%{python3_sitelib}/holland.backup.mariabackup-%{version}-py%{python3_version}-nspkg.pth
%{python3_sitelib}/holland.backup.mariabackup-%{version}-py%{python3_version}.egg-info/
%config(noreplace) %{_sysconfdir}/holland/providers/mariabackup.conf
%endif
 
 
%if %{with commvault}
%files commvault
%license contrib/holland-commvault/LICENSE
%doc contrib/holland-commvault/README
%{_bindir}/holland_cvmysqlsv
%{_mandir}/man1/holland_cvmysqlsv.1*
%{python3_sitelib}/holland_commvault/
%{python3_sitelib}/holland_commvault-%{version}-py%{python3_version}.egg-info/
%endif

%changelog
* Tue Sep 1 2020 Steven Soulen <steven@soulen.net> - 1.2.2-1
- Latest upstream
openSUSE Build Service is sponsored by