forked from pool/restic
Accepting request 564009 from home:cyphar:restic
- Switch away from using build.go, and instead manually build with "go". This allows us to build with the older Go compilers present in Leap, as well as to build the binary as PIC and dynamic. - Add generated man pages. - In order to build with older Go compilers, add a patch. + restic-switch-to-pre-1.8-sort.Stable-API.patch OBS-URL: https://build.opensuse.org/request/show/564009 OBS-URL: https://build.opensuse.org/package/show/Archiving/restic?expand=0&rev=2
This commit is contained in:
parent
9bcff744a3
commit
cfbdb3f10f
46
restic-switch-to-pre-1.8-sort.Stable-API.patch
Normal file
46
restic-switch-to-pre-1.8-sort.Stable-API.patch
Normal file
@ -0,0 +1,46 @@
|
||||
From 5d18f341c3191f7e472faa2659a9c973629a31a5 Mon Sep 17 00:00:00 2001
|
||||
From: Aleksa Sarai <cyphar@cyphar.com>
|
||||
Date: Sun, 14 Jan 2018 03:31:07 +1100
|
||||
Subject: [PATCH] restic: switch to pre-1.8 sort.Stable API
|
||||
|
||||
This allows us to build restic with older Go versions. It's a bit odd
|
||||
they decided to implement things this way, given that the old
|
||||
sort.Interface code still exists in the repo...
|
||||
|
||||
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
|
||||
---
|
||||
cmd/restic/cmd_snapshots.go | 11 +++--------
|
||||
1 file changed, 3 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/cmd/restic/cmd_snapshots.go b/cmd/restic/cmd_snapshots.go
|
||||
index 5dfb45e9729e..9acf8c0a9d44 100644
|
||||
--- a/cmd/restic/cmd_snapshots.go
|
||||
+++ b/cmd/restic/cmd_snapshots.go
|
||||
@@ -106,9 +106,7 @@ func newFilterLastSnapshotsKey(sn *restic.Snapshot) filterLastSnapshotsKey {
|
||||
// they will be joined and treated as one item.
|
||||
func FilterLastSnapshots(list restic.Snapshots) restic.Snapshots {
|
||||
// Sort the snapshots so that the newer ones are listed first
|
||||
- sort.SliceStable(list, func(i, j int) bool {
|
||||
- return list[i].Time.After(list[j].Time)
|
||||
- })
|
||||
+ sort.Stable(list)
|
||||
|
||||
var results restic.Snapshots
|
||||
seen := make(map[filterLastSnapshotsKey]bool)
|
||||
@@ -124,11 +122,8 @@ func FilterLastSnapshots(list restic.Snapshots) restic.Snapshots {
|
||||
|
||||
// PrintSnapshots prints a text table of the snapshots in list to stdout.
|
||||
func PrintSnapshots(stdout io.Writer, list restic.Snapshots, compact bool) {
|
||||
-
|
||||
- // always sort the snapshots so that the newer ones are listed last
|
||||
- sort.SliceStable(list, func(i, j int) bool {
|
||||
- return list[i].Time.Before(list[j].Time)
|
||||
- })
|
||||
+ // Always sort the snapshots so that the newer ones are listed last
|
||||
+ sort.Stable(sort.Reverse(list))
|
||||
|
||||
// Determine the max widths for host and tag.
|
||||
maxHost, maxTag := 10, 6
|
||||
--
|
||||
2.15.1
|
||||
|
@ -1,3 +1,13 @@
|
||||
-------------------------------------------------------------------
|
||||
Sat Jan 13 16:20:36 UTC 2018 - asarai@suse.com
|
||||
|
||||
- Switch away from using build.go, and instead manually build with "go". This
|
||||
allows us to build with the older Go compilers present in Leap, as well as to
|
||||
build the binary as PIC and dynamic.
|
||||
- Add generated man pages.
|
||||
- In order to build with older Go compilers, add a patch.
|
||||
+ restic-switch-to-pre-1.8-sort.Stable-API.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Jan 10 12:05:43 UTC 2018 - asarai@suse.com
|
||||
|
||||
|
31
restic.spec
31
restic.spec
@ -14,37 +14,52 @@
|
||||
|
||||
# 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.github.io/
|
||||
Group: Productivity/Backup
|
||||
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
|
||||
BuildRequires: golang(API) = 1.8
|
||||
# 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
|
||||
BuildRequires: python-Sphinx
|
||||
|
||||
%description
|
||||
restic is a backup program that is fast, efficient and secure.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch1 -p1
|
||||
|
||||
%build
|
||||
make %{?_smp_mflags}
|
||||
make -C doc
|
||||
# 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 -m 0755 restic %{buildroot}%{_bindir}/restic
|
||||
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*
|
||||
|
Loading…
x
Reference in New Issue
Block a user