Blob Blame History Raw
%global srcname borgmatic
%global debug_package %{nil}

Name:           %{srcname}
Version:        1.1.15
Release:        3%{?dist}
Summary:        Simple Python wrapper script for borgbackup

License:        GPLv3
URL:            https://torsion.org/borgmatic
Source0:        https://files.pythonhosted.org/packages/source/b/%{srcname}/%{srcname}-%{version}.tar.gz
Source1:        https://projects.torsion.org/witten/borgmatic/raw/branch/master/LICENSE
Source2:        borgmatic.service
Source3:        borgmatic.timer

# build
BuildRequires:  python%{python3_pkgversion}-devel
BuildRequires:  python%{python3_pkgversion}-setuptools

%{?systemd_requires}
BuildRequires:  systemd

# test
%if 0%{?fedora}
BuildRequires:  python%{python3_pkgversion}-pytest
BuildRequires:  python%{python3_pkgversion}-pykwalify
BuildRequires:  python%{python3_pkgversion}-ruamel-yaml
BuildRequires:  python%{python3_pkgversion}-flexmock
%endif

%description
borgmatic (formerly atticmatic) is a simple Python wrapper script for
the Borg backup software that initiates a backup, prunes any old backups
according to a retention policy, and validates backups for consistency.

%prep
%setup -n %{srcname}-%{version}
rm -rf %{srcname}.egg-info

%build
%py3_build

%install
find . -name *.so -type f -exec chmod 0755 {} \;

%py3_install

install -d %{buildroot}%{_unitdir}
install -d %{buildroot}%{_docdir}
install -d %{buildroot}%{_sysconfdir}/borgmatic
install -d %{buildroot}%{_sysconfdir}/borgmatic.d

install -D -m 644 %{SOURCE1} %{buildroot}%{_docdir}
install -D -m 644 %{SOURCE2} %{buildroot}%{_unitdir}
install -D -m 644 %{SOURCE3} %{buildroot}%{_unitdir}

%check
# epel lacks of required packages for testing
%if 0%{?fedora}
py.test-3 borgmatic/tests/unit
%endif

%files
%doc README.md PKG-INFO

%attr(0750, root, root) %{_sysconfdir}/borgmatic
%attr(0750, root, root) %{_sysconfdir}/borgmatic.d
%{python3_sitelib}/*
%{_bindir}/borgmatic
%{_bindir}/generate-borgmatic-config
%{_bindir}/upgrade-borgmatic-config
%{_unitdir}/borgmatic.service
%{_unitdir}/borgmatic.timer
%{_docdir}/LICENSE

%post
%systemd_post borgmatic.timer

%preun
%systemd_preun borgmatic.timer

%postun
%systemd_postun borgmatic.timer

%changelog
* Thu Mar 07 2019 Troy Dawson <tdawson@redhat.com> - 1.1.15-3
- Rebuilt to change main python from 3.4 to 3.6

* Thu Apr 12 2018 Benjamin Pereto <benjamin@sandchaschte.ch> - 1.1.15-2
- add empty /etc/borgmatic.d as described in documentation
- add empty /etc/borgmatic as described in documentation

* Thu Apr 12 2018 Benjamin Pereto <benjamin@sandchaschte.ch> - 1.1.15-1
- Initial packaging for the borgmatic project