Blob Blame History Raw
# Generated by go2rpm 1.9.0
%bcond_without check

# https://github.com/restic/restic
%global goipath         github.com/restic/restic
Version:                0.15.2

%gometa -f

%global goname restic

%global common_description %{expand:
Fast, secure, efficient backup program.

restic supports the following backends for storing backups natively:

* Local directory
* sftp server (via SSH)
* HTTP REST server (protocol, rest-server)
* Amazon S3 (either from Amazon or using the Minio server)
* OpenStack Swift
* BackBlaze B2
* Microsoft Azure Blob Storage
* Google Cloud Storage
* And many other services via the rclone Backend
}

%global golicenses      LICENSE
%global godocs          doc CONTRIBUTING.md CHANGELOG.md README.md

Name:           %{goname}
Release:        %autorelease
Summary:        Fast, secure, efficient backup program

License:        BSD-2-Clause
URL:            %{gourl}
Source:         %{gosource}
# https://github.com/restic/restic/pull/4201
Patch:          https://github.com/restic/restic/commit/faa83db9e477324baf90f965c771e92c0d8d76de.patch

%description %{common_description}

%prep
%goprep
%autopatch -p1

# Use original bazil.org/fuse library as we don't need MacOS support provided by
# this anacrolix fork
sed -i "s|github.com/anacrolix/fuse|bazil.org/fuse|" $(find . -name "*.go" -type f)

%generate_buildrequires
%go_generate_buildrequires

%build
%gobuild -o %{gobuilddir}/bin/%{name} %{goipath}/cmd/restic


%install
install -m 0755 -vd                     %{buildroot}%{_bindir}
install -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/

# Install manpages
install -Dpm 0644 doc/man/%{name}*.1 -t %{buildroot}%{_mandir}/man1/

# Install shell completions
install -Dpm 0644 doc/bash-completion.sh %{buildroot}%{bash_completions_dir}/%{name}
install -Dpm 0644 doc/fish-completion.fish %{buildroot}%{fish_completions_dir}/%{name}.fish
install -Dpm 0644 doc/zsh-completion.zsh  %{buildroot}%{zsh_completions_dir}/_%{name}

%if %{with check}
%check
#Skip tests using fuse due to root requirement
export RESTIC_TEST_FUSE=0
%gocheck
%endif

%files
%license LICENSE
%doc doc CONTRIBUTING.md CHANGELOG.md README.md
%{_bindir}/*
%{_mandir}/man1/%{name}*.1*
%{bash_completions_dir}/%{name}
%{fish_completions_dir}/%{name}.fish
%{zsh_completions_dir}/_%{name}

%changelog
%autochangelog