diff mbox series

[bug#49221,10/13] gnu: restic: Patch tests for go-1.16.

Message ID 8faa83d9d24cbd87afd8a93613dbf872aaf45573.1624602942.git.iskarian@mgsn.dev
State Accepted
Headers show
Series Add go-1.16 and build with gccgo | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Sarah Morgensen June 25, 2021, 7:21 a.m. UTC
* gnu/packages/patches/restic-0.9.6-fix-tests-for-go1.15.patch: New
file.
* gnu/local.mk (dist_patch_DATA): Register it.
* gnu/packages/backup.scm (restic): Use it.
---
 gnu/local.mk                                  |  1 +
 gnu/packages/backup.scm                       |  5 +-
 .../restic-0.9.6-fix-tests-for-go1.15.patch   | 51 +++++++++++++++++++
 3 files changed, 56 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/restic-0.9.6-fix-tests-for-go1.15.patch

Comments

Maxim Cournoyer Aug. 5, 2021, 5:20 p.m. UTC | #1
Hello,

Sarah Morgensen <iskarian@mgsn.dev> writes:

[...]

> +From 97950ab81a18de06b95384da6d8646fef87c9d97 Mon Sep 17 00:00:00 2001
> +From: Alexander Neumann <alexander@bumpern.de>
> +Date: Sat, 12 Sep 2020 17:36:44 +0200
> +Subject: [PATCH] options: Fix test for Go >= 1.15
> +
> +---
> + internal/options/options_test.go | 12 +++++++++---
> + 1 file changed, 9 insertions(+), 3 deletions(-)
> +
> +diff --git a/internal/options/options_test.go b/internal/options/options_test.go
> +index de94fc90a1..8d268992a3 100644
> +--- a/internal/options/options_test.go
> ++++ b/internal/options/options_test.go
> +@@ -3,6 +3,7 @@ package options
> + import (
> + 	"fmt"
> + 	"reflect"
> ++	"regexp"
> + 	"testing"
> + 	"time"
> + )
> +@@ -199,7 +200,7 @@ var invalidSetTests = []struct {
> + 			"timeout": "2134",
> + 		},
> + 		"ns",
> +-		`time: missing unit in duration 2134`,
> ++		`time: missing unit in duration "?2134"?`,
> + 	},
> + }
> + 
> +@@ -212,8 +213,13 @@ func TestOptionsApplyInvalid(t *testing.T) {
> + 				t.Fatalf("expected error %v not found", test.err)
> + 			}
> + 
> +-			if err.Error() != test.err {
> +-				t.Fatalf("expected error %q, got %q", test.err, err.Error())
> ++			matched, err := regexp.MatchString(test.err, err.Error())
> ++			if err != nil {
> ++				t.Fatal(err)
> ++			}
> ++
> ++			if !matched {
> ++				t.Fatalf("expected error to match %q, got %q", test.err, err.Error())
> + 			}
> + 		})
> + 	}

I'm guessing this may also be not be necessary if we were to
successfully update restic to v0.12.1.  Do you think that would be
difficult to try?

Thanks,

Maxim
Sarah Morgensen Aug. 5, 2021, 8:24 p.m. UTC | #2
Hi Maxim,

Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:

> Hello,
>
> Sarah Morgensen <iskarian@mgsn.dev> writes:
>
> [...]
>
>> +From 97950ab81a18de06b95384da6d8646fef87c9d97 Mon Sep 17 00:00:00 2001
>> +From: Alexander Neumann <alexander@bumpern.de>
>> +Date: Sat, 12 Sep 2020 17:36:44 +0200
>> +Subject: [PATCH] options: Fix test for Go >= 1.15
>> +
>> +---
>> + internal/options/options_test.go | 12 +++++++++---
>> + 1 file changed, 9 insertions(+), 3 deletions(-)
>> +
>> +diff --git a/internal/options/options_test.go b/internal/options/options_test.go
>> +index de94fc90a1..8d268992a3 100644
>> +--- a/internal/options/options_test.go
>> ++++ b/internal/options/options_test.go
>> +@@ -3,6 +3,7 @@ package options
>> + import (
>> + 	"fmt"
>> + 	"reflect"
>> ++	"regexp"
>> + 	"testing"
>> + 	"time"
>> + )
>> +@@ -199,7 +200,7 @@ var invalidSetTests = []struct {
>> + 			"timeout": "2134",
>> + 		},
>> + 		"ns",
>> +-		`time: missing unit in duration 2134`,
>> ++		`time: missing unit in duration "?2134"?`,
>> + 	},
>> + }
>> + 
>> +@@ -212,8 +213,13 @@ func TestOptionsApplyInvalid(t *testing.T) {
>> + 				t.Fatalf("expected error %v not found", test.err)
>> + 			}
>> + 
>> +-			if err.Error() != test.err {
>> +-				t.Fatalf("expected error %q, got %q", test.err, err.Error())
>> ++			matched, err := regexp.MatchString(test.err, err.Error())
>> ++			if err != nil {
>> ++				t.Fatal(err)
>> ++			}
>> ++
>> ++			if !matched {
>> ++				t.Fatalf("expected error to match %q, got %q", test.err, err.Error())
>> + 			}
>> + 		})
>> + 	}
>
> I'm guessing this may also be not be necessary if we were to
> successfully update restic to v0.12.1.  Do you think that would be
> difficult to try?

You are correct. This should eventually be done, but between v0.9.6 and
v0.10, restic unvendored all its dependencies, so it would require
packaging any missing dependencies.

>
> Thanks,
>
> Maxim

--
Sarah
Maxim Cournoyer Aug. 6, 2021, 2:59 a.m. UTC | #3
Hello Sarah,

Sarah Morgensen <iskarian@mgsn.dev> writes:

[...]

>> I'm guessing this may also be not be necessary if we were to
>> successfully update restic to v0.12.1.  Do you think that would be
>> difficult to try?
>
> You are correct. This should eventually be done, but between v0.9.6 and
> v0.10, restic unvendored all its dependencies, so it would require
> packaging any missing dependencies.

I see!  Thanks for the explanation.  I've now merged both remaining
patches from this tracker as commits 733ca63bcd and 1273548f4f, with the
first one modified to do the patching as a phase (the patch file name
was too long -- caught by guix lint).

Thank you!

Closing.

Maxim
diff mbox series

Patch

diff --git a/gnu/local.mk b/gnu/local.mk
index a176772ece..24f2d9d013 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1674,6 +1674,7 @@  dist_patch_DATA =						\
   %D%/packages/patches/rtags-separate-rct.patch			\
   %D%/packages/patches/racket-sh-via-rktio.patch		\
   %D%/packages/patches/remake-impure-dirs.patch			\
+  %D%/packages/patches/restic-0.9.6-fix-tests-for-go1.15.patch	\
   %D%/packages/patches/retroarch-LIBRETRO_DIRECTORY.patch	\
   %D%/packages/patches/rnp-add-version.cmake.patch		\
   %D%/packages/patches/rnp-disable-ruby-rnp-tests.patch		\
diff --git a/gnu/packages/backup.scm b/gnu/packages/backup.scm
index d425243848..67dc4b2cc9 100644
--- a/gnu/packages/backup.scm
+++ b/gnu/packages/backup.scm
@@ -19,6 +19,7 @@ 
 ;;; Copyright © 2020 Marcin Karpezo <sirmacik@wioo.waw.pl>
 ;;; Copyright © 2020 Michael Rohleder <mike@rohleder.de>
 ;;; Copyright © 2021 Timothy Sample <samplet@ngyro.com>
+;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -876,7 +877,9 @@  is like a time machine for your data. ")
               (file-name (string-append name "-" version ".tar.gz"))
               (sha256
                (base32
-                "1zmh42aah32ah8w5n6ilz9bci0y2xrf8p7qshy3yf1lzm5gnbj0w"))))
+                "1zmh42aah32ah8w5n6ilz9bci0y2xrf8p7qshy3yf1lzm5gnbj0w"))
+              (patches
+               (search-patches "restic-0.9.6-fix-tests-for-go1.15.patch"))))
     (build-system go-build-system)
     (arguments
      `(#:import-path "github.com/restic/restic"
diff --git a/gnu/packages/patches/restic-0.9.6-fix-tests-for-go1.15.patch b/gnu/packages/patches/restic-0.9.6-fix-tests-for-go1.15.patch
new file mode 100644
index 0000000000..cc510c1cfe
--- /dev/null
+++ b/gnu/packages/patches/restic-0.9.6-fix-tests-for-go1.15.patch
@@ -0,0 +1,51 @@ 
+This cherry-picked patch fixes tests for Go >= 1.15. Restic v0.10 (which
+includes this patch) requires go module support from the Go build system.
+Original patch follows.
+
+---
+From 97950ab81a18de06b95384da6d8646fef87c9d97 Mon Sep 17 00:00:00 2001
+From: Alexander Neumann <alexander@bumpern.de>
+Date: Sat, 12 Sep 2020 17:36:44 +0200
+Subject: [PATCH] options: Fix test for Go >= 1.15
+
+---
+ internal/options/options_test.go | 12 +++++++++---
+ 1 file changed, 9 insertions(+), 3 deletions(-)
+
+diff --git a/internal/options/options_test.go b/internal/options/options_test.go
+index de94fc90a1..8d268992a3 100644
+--- a/internal/options/options_test.go
++++ b/internal/options/options_test.go
+@@ -3,6 +3,7 @@ package options
+ import (
+ 	"fmt"
+ 	"reflect"
++	"regexp"
+ 	"testing"
+ 	"time"
+ )
+@@ -199,7 +200,7 @@ var invalidSetTests = []struct {
+ 			"timeout": "2134",
+ 		},
+ 		"ns",
+-		`time: missing unit in duration 2134`,
++		`time: missing unit in duration "?2134"?`,
+ 	},
+ }
+ 
+@@ -212,8 +213,13 @@ func TestOptionsApplyInvalid(t *testing.T) {
+ 				t.Fatalf("expected error %v not found", test.err)
+ 			}
+ 
+-			if err.Error() != test.err {
+-				t.Fatalf("expected error %q, got %q", test.err, err.Error())
++			matched, err := regexp.MatchString(test.err, err.Error())
++			if err != nil {
++				t.Fatal(err)
++			}
++
++			if !matched {
++				t.Fatalf("expected error to match %q, got %q", test.err, err.Error())
+ 			}
+ 		})
+ 	}