SHA256
1
0
forked from pool/restic
restic/restic.spec

66 lines
2.2 KiB
RPMSpec
Raw Normal View History

#
# spec file for package restic
#
# Copyright (c) 2018 SUSE LINUX Products 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/
#
# nodebuginfo
%define import_path github.com/restic/restic
Name: restic
Version: 0.8.1
Release: 0
License: BSD-2-Clause
Summary: Fast, secure, efficient backup program
Url: https://restic.net/
Group: Productivity/Archiving/Backup
Source0: https://github.com/restic/%{name}/releases/download/v%{version}/%{name}-%{version}.tar.gz
Source1: https://github.com/restic/%{name}/releases/download/v%{version}/%{name}-%{version}.tar.gz.asc
Source2: %{name}.keyring
# PATCH-FIX-OPENSUSE: Revert to using pre-1.8 Go APIs so we can build on Leap 42.x.
Patch1: restic-switch-to-pre-1.8-sort.Stable-API.patch
BuildRequires: golang(API) >= 1.6
BuildRequires: golang-packaging
%description
restic is a backup program that is fast, efficient and secure.
%prep
%setup -q
%patch1 -p1
%build
# Set up GOPATH.
export GOPATH="$GOPATH:$HOME/go"
mkdir -p $HOME/go/src/%{import_path}
cp -rT $PWD $HOME/go/src/%{import_path}
# Build restic. We don't use build.go because it builds statically and also has
# weird golang version requirements for no good reason.
go build -o %{name} -buildmode=pie \
-ldflags "-s -w -X main.version=%{version}" \
%{import_path}/cmd/restic
%install
install -D -m0755 %{name} %{buildroot}%{_bindir}/%{name}
install -d %{buildroot}%{_mandir}/man1
./%{name} generate --man %{buildroot}%{_mandir}/man1
%files
%defattr(-,root,root)
%doc *.md *.rst LICENSE
%doc doc/
%{_bindir}/restic
%{_mandir}/man1/restic*.1*