[PATCH 0/4] gnu: Fix some builds with go@1.17.

  • Done
  • quality assurance status badge
Details
2 participants
  • Sarah Morgensen
  • Leo Famulari
Owner
unassigned
Submitted by
Sarah Morgensen
Severity
normal
S
S
Sarah Morgensen wrote on 10 Sep 2021 02:47
(address . guix-patches@gnu.org)
cover.1631234078.git.iskarian@mgsn.dev
Hello Guix,

These patches fix building four packages with go@1.17. They still build
successfully with default go (on x86_64) and have a total of 9 dependents,
so should be fine for master. (Three of them are just fixing tests, and the
keybase patch doesn't actually change code, just a comment that tripped up
Go.)

--
Sarah Morgensen (4):
gnu: go-github-com-keybase-go-ps: Patch for go@1.17.
gnu: go-github-com-sevlyar-go-daemon: Fix tests for go@1.17.
gnu: go-github-com-urfave-cli: Fix tests with go@1.17.
gnu: go-github-com-urfave-cli-v2: Fix tests with go@1.17.

gnu/local.mk | 2 +
gnu/packages/golang.scm | 18 +++++++--
.../go-github-com-urfave-cli-fix-tests.patch | 28 ++++++++++++++
...o-github-com-urfave-cli-v2-fix-tests.patch | 37 +++++++++++++++++++
4 files changed, 82 insertions(+), 3 deletions(-)
create mode 100644 gnu/packages/patches/go-github-com-urfave-cli-fix-tests.patch
create mode 100644 gnu/packages/patches/go-github-com-urfave-cli-v2-fix-tests.patch


base-commit: 370d1cdb61e1b9b5467d2aed4cab89c2a8e2a491
--
2.33.0
S
S
Sarah Morgensen wrote on 10 Sep 2021 02:50
[PATCH 1/4] gnu: go-github-com-keybase-go-ps: Patch for go@1.17.
(address . 50495@debbugs.gnu.org)
ee9ec2d42f0c8d52c0b1a516461386597f8ab55e.1631234078.git.iskarian@mgsn.dev
* gnu/packages/golang.scm (go-github-com-keybase-go-ps)[arguments]
<#:phases>{fix-tests}: Remove extraneous build line to appease go@1.17.
---
gnu/packages/golang.scm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

Toggle diff (17 lines)
diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index 2dfd47d396..4577c49cba 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -1597,7 +1597,9 @@ (define-public go-github-com-keybase-go-ps
(("/bin/sleep" command)
(string-append
(assoc-ref (or native-inputs inputs) "coreutils")
- command))))))))
+ command)))
+ (substitute* "src/github.com/keybase/go-ps/process_openbsd.go"
+ (("^// \\+build ignore") "")))))))
(native-inputs
`(("coreutils" ,coreutils)
("go-github-com-stretchr-testify"
--
2.33.0
S
S
Sarah Morgensen wrote on 10 Sep 2021 02:50
[PATCH 2/4] gnu: go-github-com-sevlyar-go-daemon: Fix tests for go@1.17.
(address . 50495@debbugs.gnu.org)
4804d8146607ac2795118557ee2087c198bd6fa6.1631234078.git.iskarian@mgsn.dev
* gnu/packages/golang.scm (go-github-com-sevlyar-go-daemon)[source]:
Add snippet to fix tests for go@1.17.
---
gnu/packages/golang.scm | 6 ++++++
1 file changed, 6 insertions(+)

Toggle diff (19 lines)
diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index 4577c49cba..b08796e22a 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -1558,6 +1558,12 @@ (define-public go-github-com-sevlyar-go-daemon
(url "https://github.com/sevlyar/go-daemon")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
+ (modules '((guix build utils)))
+ (snippet
+ ;; XXX: Remove when updating
+ '(begin
+ (substitute* "compilation_test.go"
+ ((".*\"darwin/386\".*") ""))))
(sha256
(base32 "1y3gnxaifykcjcbzx91lz9bc93b95w3xj4rjxjbii26pm3j7gqyk"))))
(build-system go-build-system)
--
2.33.0
S
S
Sarah Morgensen wrote on 10 Sep 2021 02:50
[PATCH 3/4] gnu: go-github-com-urfave-cli: Fix tests with go@1.17.
(address . 50495@debbugs.gnu.org)
c67651f0bd73c067755961f17558f37b8186565e.1631234078.git.iskarian@mgsn.dev
* gnu/packages/patches/go-github-com-urfave-cli-fix-tests.patch: New
file.
* gnu/local.mk (dist_patch_DATA): Register it.
* gnu/packages/golang.scm (go-github-com-urfave-cli)[origin]: Apply it.
---
gnu/local.mk | 1 +
gnu/packages/golang.scm | 3 +-
.../go-github-com-urfave-cli-fix-tests.patch | 28 +++++++++++++++++++
3 files changed, 31 insertions(+), 1 deletion(-)
create mode 100644 gnu/packages/patches/go-github-com-urfave-cli-fix-tests.patch

Toggle diff (62 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 2a56c4a9e2..bd6e2e79d0 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1184,6 +1184,7 @@ dist_patch_DATA = \
%D%/packages/patches/gobject-introspection-cc.patch \
%D%/packages/patches/gobject-introspection-girepository.patch \
%D%/packages/patches/go-fix-script-tests.patch \
+ %D%/packages/patches/go-github-com-urfave-cli-fix-tests.patch \
%D%/packages/patches/go-skip-gc-test.patch \
%D%/packages/patches/gpm-glibc-2.26.patch \
%D%/packages/patches/gpodder-disable-updater.patch \
diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index b08796e22a..2d0bbdb30d 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -4976,7 +4976,8 @@ (define-public go-github-com-urfave-cli
(file-name (git-file-name name version))
(sha256
(base32
- "10mcnvi5qmn00vpyk6si8gjka7p654wr9hac4zc9w5h3ickhvbdc"))))
+ "10mcnvi5qmn00vpyk6si8gjka7p654wr9hac4zc9w5h3ickhvbdc"))
+ (patches (search-patches "go-github-com-urfave-cli-fix-tests.patch"))))
(build-system go-build-system)
(arguments
'(#:import-path "github.com/urfave/cli"))
diff --git a/gnu/packages/patches/go-github-com-urfave-cli-fix-tests.patch b/gnu/packages/patches/go-github-com-urfave-cli-fix-tests.patch
new file mode 100644
index 0000000000..7408d4ec16
--- /dev/null
+++ b/gnu/packages/patches/go-github-com-urfave-cli-fix-tests.patch
@@ -0,0 +1,28 @@
+Backported from upstream PR: https://github.com/urfave/cli/pull/1299
+---
+diff --git a/app_test.go b/app_test.go
+index 33024ff..6b3aaa3 100644
+--- a/app_test.go
++++ b/app_test.go
+@@ -513,18 +513,18 @@ func TestApp_RunAsSubcommandParseFlags(t *testing.T) {
+ func TestApp_RunAsSubCommandIncorrectUsage(t *testing.T) {
+ a := App{
+ Flags: []Flag{
+- StringFlag{Name: "--foo"},
++ StringFlag{Name: "foo"},
+ },
+ Writer: bytes.NewBufferString(""),
+ }
+
+ set := flag.NewFlagSet("", flag.ContinueOnError)
+- _ = set.Parse([]string{"", "---foo"})
++ _ = set.Parse([]string{"", "-bar"})
+ c := &Context{flagSet: set}
+
+ err := a.RunAsSubcommand(c)
+
+- expect(t, err, errors.New("bad flag syntax: ---foo"))
++ expect(t, err.Error(), "flag provided but not defined: -bar")
+ }
+
+ func TestApp_CommandWithFlagBeforeTerminator(t *testing.T) {
--
2.33.0
S
S
Sarah Morgensen wrote on 10 Sep 2021 02:50
[PATCH 4/4] gnu: go-github-com-urfave-cli-v2: Fix tests with go@1.17.
(address . 50495@debbugs.gnu.org)
4acdf53ef984f8726f85f0a135441daa4f02d19a.1631234078.git.iskarian@mgsn.dev
* gnu/packages/patches/go-github-com-urfave-cli-v2-fix-tests.patch: New
file.
* gnu/local.mk (dist_patch_DATA): Register it.
* gnu/packages/golang.scm (go-github-com-urfave-cli-v2)[origin]: Apply it.
---
gnu/local.mk | 1 +
gnu/packages/golang.scm | 5 ++-
...o-github-com-urfave-cli-v2-fix-tests.patch | 37 +++++++++++++++++++
3 files changed, 42 insertions(+), 1 deletion(-)
create mode 100644 gnu/packages/patches/go-github-com-urfave-cli-v2-fix-tests.patch

Toggle diff (73 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index bd6e2e79d0..c7fde5348f 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1185,6 +1185,7 @@ dist_patch_DATA = \
%D%/packages/patches/gobject-introspection-girepository.patch \
%D%/packages/patches/go-fix-script-tests.patch \
%D%/packages/patches/go-github-com-urfave-cli-fix-tests.patch \
+ %D%/packages/patches/go-github-com-urfave-cli-v2-fix-tests.patch \
%D%/packages/patches/go-skip-gc-test.patch \
%D%/packages/patches/gpm-glibc-2.26.patch \
%D%/packages/patches/gpodder-disable-updater.patch \
diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index 2d0bbdb30d..4c6b41e406 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -5003,7 +5003,10 @@ (define-public go-github-com-urfave-cli-v2
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
- (base32 "08pvn7gyfznni72xrxfh2x6xxa8ykr7l1ka278js8g8qkh71bj8l"))))
+ (base32 "08pvn7gyfznni72xrxfh2x6xxa8ykr7l1ka278js8g8qkh71bj8l"))
+ ;; XXX: Remove patch when updating.
+ (patches
+ (search-patches "go-github-com-urfave-cli-v2-fix-tests.patch"))))
(arguments
'(#:import-path "github.com/urfave/cli/v2"))))
diff --git a/gnu/packages/patches/go-github-com-urfave-cli-v2-fix-tests.patch b/gnu/packages/patches/go-github-com-urfave-cli-v2-fix-tests.patch
new file mode 100644
index 0000000000..87ccc2b655
--- /dev/null
+++ b/gnu/packages/patches/go-github-com-urfave-cli-v2-fix-tests.patch
@@ -0,0 +1,37 @@
+From upstream PR: https://github.com/urfave/cli/pull/1299
+
+From: William Wilson <william.wilson@canonical.com>
+Date: Tue, 31 Aug 2021 14:19:17 -0500
+Subject: Make test case compatible with Go 1.17
+
+As of Go 1.17, the go flag package will panic if given a syntactically invalid
+flag. This causes TestApp_RunAsSubCommandIncorrectUsage to panic and therefore
+fail. See https://golang.org/doc/go1.17#flag for more information.
+
+---
+diff --git a/app_test.go b/app_test.go
+index 7c38f6048..76e211d68 100644
+--- a/app_test.go
++++ b/app_test.go
+@@ -476,18 +476,18 @@ func TestApp_RunAsSubCommandIncorrectUsage(t *testing.T) {
+ a := App{
+ Name: "cmd",
+ Flags: []Flag{
+- &StringFlag{Name: "--foo"},
++ &StringFlag{Name: "foo"},
+ },
+ Writer: bytes.NewBufferString(""),
+ }
+
+ set := flag.NewFlagSet("", flag.ContinueOnError)
+- _ = set.Parse([]string{"", "---foo"})
++ _ = set.Parse([]string{"", "-bar"})
+ c := &Context{flagSet: set}
+
+ err := a.RunAsSubcommand(c)
+
+- expect(t, err, errors.New("bad flag syntax: ---foo"))
++ expect(t, err.Error(), "flag provided but not defined: -bar")
+ }
+
+ func TestApp_CommandWithFlagBeforeTerminator(t *testing.T) {
--
2.33.0
S
S
Sarah Morgensen wrote on 10 Sep 2021 02:51
control message for bug #50348
(address . control@debbugs.gnu.org)
8635qdmevt.fsf@mgsn.dev
block 50348 by 50227 49921 50495
thanks
S
S
Sarah Morgensen wrote on 10 Sep 2021 02:55
(address . control@debbugs.gnu.org)
861r5xmeq2.fsf@mgsn.dev
unblock 50348 by 50227 49921 50495
thanks

Oops, wrong bug #.
S
S
Sarah Morgensen wrote on 10 Sep 2021 02:56
control message for bug #50493
(address . control@debbugs.gnu.org)
86zgsll03k.fsf@mgsn.dev
block 50493 by 50495 49921 50227
thanks
L
L
Leo Famulari wrote on 10 Sep 2021 03:41
Re: [bug#50495] [PATCH 0/4] gnu: Fix some builds with go@1.17.
(name . Sarah Morgensen)(address . iskarian@mgsn.dev)(address . 50495@debbugs.gnu.org)
YTq335YGSlpSmCFn@jasmine.lan
On Thu, Sep 09, 2021 at 05:47:32PM -0700, Sarah Morgensen wrote:
Toggle quote (8 lines)
> Hello Guix,
>
> These patches fix building four packages with go@1.17. They still build
> successfully with default go (on x86_64) and have a total of 9 dependents,
> so should be fine for master. (Three of them are just fixing tests, and the
> keybase patch doesn't actually change code, just a comment that tripped up
> Go.)

Thanks for these patches!

I tweaked the commit titles to make them a little more consistent and
less idiomatic and pushed as 63cc4dd5793b62802354a31d8e6913f065d3bcec.

I think that using plain and verbose English can help people coming from
other languages.
L
L
Leo Famulari wrote on 10 Sep 2021 03:42
(no subject)
(address . control@debbugs.gnu.org)
YTq37F/fr60vDAZ2@jasmine.lan
close 50495
?