%global forgeurl https://github.com/yboetz/pyznap Version: 1.6.0 %forgemeta Name: pyznap Release: 3%{?dist} Summary: ZFS snapshot tool written in python License: GPL-3.0-only URL: %{forgeurl} Source0: %{forgesource} Source1: pyznap-send.service Source2: pyznap-send-daily.timer Source3: pyznap-snap.service Source4: pyznap-snap-hourly.timer Source5: pyznap.logrotate # https://github.com/yboetz/pyznap/pull/101 Patch0: pyznap-send-first-raw-snapshot.patch BuildArch: noarch Requires: logrotate Recommends: mbuffer Recommends: openssh-clients Recommends: pv BuildRequires: python3-devel BuildRequires: python3dist(pytest) BuildRequires: python3dist(paramiko) BuildRequires: systemd-rpm-macros %global _description %{expand: pyznap is a ZFS snapshot management tool. It automatically takes and deletes snapshots and can send them to different backup locations. You can specify a policy for a given filesystem in the pyznap.conf file and then use cron to let it run regularly.} %description %_description %package -n python3-%{name} Summary: %{summary} %description -n python3-%{name} %_description %prep %forgeautosetup -p1 # Remove shebang from main.py sed -i '\|#!/usr/bin/env python|d' pyznap/main.py %generate_buildrequires %pyproject_buildrequires %build %pyproject_wheel %install %pyproject_install %pyproject_save_files %{name} install -dm 0700 %{buildroot}%{_localstatedir}/log/pyznap install -Dpm 0644 pyznap/config/pyznap.conf %{buildroot}%{_sysconfdir}/pyznap/pyznap.conf install -dm 0755 %{buildroot}%{_unitdir} install -pm 0644 %{SOURCE1} %{buildroot}%{_unitdir} install -pm 0644 %{SOURCE2} %{buildroot}%{_unitdir} install -pm 0644 %{SOURCE3} %{buildroot}%{_unitdir} install -pm 0644 %{SOURCE4} %{buildroot}%{_unitdir} install -Dpm 0644 %{SOURCE5} %{buildroot}%{_sysconfdir}/logrotate.d/pyznap %check # only run tests that do not create zpools %pytest tests/test_functions.py -k 'test_read_config or test_parse_name' %post %systemd_post pyznap-snap.service pyznap-snap-hourly.timer pyznap-send.service pyznap-send-daily.timer %preun %systemd_preun pyznap-snap.service pyznap-snap-hourly.timer pyznap-send.service pyznap-send-daily.timer %postun %systemd_postun pyznap-snap.service pyznap-snap-hourly.timer pyznap-send.service pyznap-send-daily.timer %files -f %{pyproject_files} %license LICENSE %doc README.md %{_bindir}/pyznap %{_unitdir}/pyznap* %config(noreplace) %{_sysconfdir}/logrotate.d/pyznap %config(noreplace) %{_sysconfdir}/pyznap/pyznap.conf %dir %{_localstatedir}/log/pyznap %changelog %autochangelog