GNU bug report logs - #32768
[PATCH] gnu: go-1.11: Add New Version

Previous Next

Package: guix-patches;

Reported by: Katherine Cox-Buday <cox.katherine.e <at> gmail.com>

Date: Wed, 19 Sep 2018 03:56:01 UTC

Severity: normal

Tags: patch

Done: Leo Famulari <leo <at> famulari.name>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 32768 in the body.
You can then email your comments to 32768 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#32768; Package guix-patches. (Wed, 19 Sep 2018 03:56:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Katherine Cox-Buday <cox.katherine.e <at> gmail.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Wed, 19 Sep 2018 03:56:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Katherine Cox-Buday <cox.katherine.e <at> gmail.com>
To: guix-patches <at> gnu.org
Subject: [PATCH] gnu: go-1.11: Add New Version
Date: Tue, 18 Sep 2018 21:52:58 -0500
---
 gnu/packages/golang.scm | 128 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 128 insertions(+)

diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index b4a088a05..be404cc16 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -12,6 +12,7 @@
 ;;; Copyright © 2018 Tomáš Čech <sleep_walker <at> gnu.org>
 ;;; Copyright © 2018 Pierre-Antoine Rouby <pierre-antoine.rouby <at> inria.fr>
 ;;; Copyright © 2018 Pierre Neidhardt <mail <at> ambrevar.xyz>
+;;; Copyright @ 2018 Katherine Cox-Buday <cox.katherine.e <at> gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -499,6 +500,133 @@ in the style of communicating sequential processes (@dfn{CSP}).")
                  (setenv "HOME" "/tmp")
                  #t)))))))))
 
+(define-public go-1.11
+  (package
+    (inherit go-1.10)
+    (name "go")
+    (version "1.11")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://storage.googleapis.com/golang/"
+                           name version ".src.tar.gz"))
+       (sha256
+        (base32
+         "1ysj04jzds6xa8kdflkdsgyv3mg9fdn90zdf78g4g6p4bwpy3hdg"))))
+    (arguments
+     (substitute-keyword-arguments (package-arguments go-1.10)
+       ((#:phases phases)
+        `(modify-phases ,phases
+           (replace 'prebuild
+             (lambda* (#:key inputs outputs #:allow-other-keys)
+               (let* ((gcclib (string-append (assoc-ref inputs "gcc:lib") "/lib"))
+                      (ld (string-append (assoc-ref inputs "libc") "/lib"))
+                      (loader (car (find-files ld "^ld-linux.+")))
+                      (net-base (assoc-ref inputs "net-base"))
+                      (tzdata-path
+                       (string-append (assoc-ref inputs "tzdata") "/share/zoneinfo"))
+                      (output (assoc-ref outputs "out")))
+
+                 (for-each delete-file
+                           ;; Removing net/ tests, which fail when attempting to access
+                           ;; network resources not present in the build container.
+                           '("net/listen_test.go"
+                             "net/parse_test.go"
+                             "net/cgo_unix_test.go"
+                             ;; A side affect of these test scripts is testing
+                             ;; cgo. Attempts at using cgo flags and
+                             ;; directives with these scripts as specified
+                             ;; here (https://golang.org/cmd/cgo/) have not
+                             ;; worked. The tests continue to state that they
+                             ;; can not find crt1.o despite being present.
+                             "cmd/go/testdata/script/list_compiled_imports.txt"
+                             "cmd/go/testdata/script/mod_case_cgo.txt"
+                             ;; https://github.com/golang/go/issues/24884
+                             "os/user/user_test.go"))
+
+                 (substitute* "os/os_test.go"
+                   (("/usr/bin") (getcwd))
+                   (("/bin/pwd") (which "pwd"))
+                   (("/bin/sh") (which "sh")))
+
+                 (substitute* "cmd/vendor/golang.org/x/sys/unix/syscall_unix_test.go"
+                   (("/usr/bin") "/tmp"))
+
+                 ;; Add libgcc to runpath
+                 (substitute* "cmd/link/internal/ld/lib.go"
+                   (("!rpath.set") "true"))
+                 (substitute* "cmd/go/internal/work/gccgo.go"
+                   (("cgoldflags := \\[\\]string\\{\\}")
+                    (string-append "cgoldflags := []string{"
+                                   "\"-rpath=" gcclib "\""
+                                   "}"))
+                   (("\"-lgcc_s\", ")
+                    (string-append
+                     "\"-Wl,-rpath=" gcclib "\", \"-lgcc_s\", ")))
+                 (substitute* "cmd/go/internal/work/gc.go"
+                   (("ldflags = setextld\\(ldflags, compiler\\)")
+                    (string-append
+                     "ldflags = setextld(ldflags, compiler)\n"
+                     "ldflags = append(ldflags, \"-r\")\n"
+                     "ldflags = append(ldflags, \"" gcclib "\")\n")))
+
+                 ;; Disable failing tests: these tests attempt to access
+                 ;; commands or network resources which are neither available
+                 ;; nor necessary for the build to succeed.
+                 (for-each
+                  (match-lambda
+                    ((file regex)
+                     (substitute* file
+                       ((regex all before test_name)
+                        (string-append before "Disabled" test_name)))))
+                  '(("net/net_test.go" "(.+)(TestShutdownUnix.+)")
+                    ("net/dial_test.go" "(.+)(TestDialTimeout.+)")
+                    ("os/os_test.go" "(.+)(TestHostname.+)")
+                    ("time/format_test.go" "(.+)(TestParseInSydney.+)")
+                    ("time/format_test.go" "(.+)(TestParseInLocation.+)")
+                    ("os/exec/exec_test.go" "(.+)(TestEcho.+)")
+                    ("os/exec/exec_test.go" "(.+)(TestCommandRelativeName.+)")
+                    ("os/exec/exec_test.go" "(.+)(TestCatStdin.+)")
+                    ("os/exec/exec_test.go" "(.+)(TestCatGoodAndBadFile.+)")
+                    ("os/exec/exec_test.go" "(.+)(TestExitStatus.+)")
+                    ("os/exec/exec_test.go" "(.+)(TestPipes.+)")
+                    ("os/exec/exec_test.go" "(.+)(TestStdinClose.+)")
+                    ("os/exec/exec_test.go" "(.+)(TestIgnorePipeErrorOnSuccess.+)")
+                    ("syscall/syscall_unix_test.go" "(.+)(TestPassFD\\(.+)")
+                    ("os/exec/exec_test.go" "(.+)(TestExtraFiles/areturn.+)")
+                    ("cmd/go/go_test.go" "(.+)(TestCoverageWithCgo.+)")
+                    ("cmd/go/go_test.go" "(.+)(TestTwoPkgConfigs.+)")
+                    ("os/exec/exec_test.go" "(.+)(TestOutputStderrCapture.+)")
+                    ("os/exec/exec_test.go" "(.+)(TestExtraFiles.+)")
+                    ("os/exec/exec_test.go" "(.+)(TestExtraFilesRace.+)")
+                    ("net/lookup_test.go" "(.+)(TestLookupPort.+)")
+                    ("syscall/exec_linux_test.go"
+                     "(.+)(TestCloneNEWUSERAndRemapNoRootDisableSetgroups.+)")))
+
+                 ;; fix shebang for testar script
+                 ;; note the target script is generated at build time.
+                 (substitute* "../misc/cgo/testcarchive/carchive_test.go"
+                   (("#!/usr/bin/env") (string-append "#!" (which "env"))))
+
+                 (substitute* "net/lookup_unix.go"
+                   (("/etc/protocols") (string-append net-base "/etc/protocols")))
+                 (substitute* "net/port_unix.go"
+                   (("/etc/services") (string-append net-base "/etc/services")))
+                 (substitute* "time/zoneinfo_unix.go"
+                   (("/usr/share/zoneinfo/") tzdata-path))
+                 (substitute* (find-files "cmd" "\\.go")
+                   (("/lib(64)?/ld-linux.*\\.so\\.[0-9]") loader))
+                 #t)))
+           (replace 'set-bootstrap-variables
+             (lambda* (#:key outputs inputs #:allow-other-keys)
+               ;; Tell the build system where to find the bootstrap Go.
+               (let ((go  (assoc-ref inputs "go")))
+                 (setenv "GOROOT_BOOTSTRAP" go)
+                 (setenv "GOGC" "400")
+                 ;; Go 1.10 tries to write to $HOME in a test
+                 (setenv "HOME" "/tmp")
+                 #t)))))))))
+
 (define-public go go-1.9)
 
 (define-public go-github-com-alsm-ioprogress
-- 
2.17.1




Information forwarded to guix-patches <at> gnu.org:
bug#32768; Package guix-patches. (Wed, 19 Sep 2018 21:21:02 GMT) Full text and rfc822 format available.

Message #8 received at 32768 <at> debbugs.gnu.org (full text, mbox):

From: Leo Famulari <leo <at> famulari.name>
To: Katherine Cox-Buday <cox.katherine.e <at> gmail.com>
Cc: 32768 <at> debbugs.gnu.org
Subject: Re: [bug#32768] [PATCH] gnu: go-1.11: Add New Version
Date: Wed, 19 Sep 2018 17:20:32 -0400
[Message part 1 (text/plain, inline)]
On Tue, Sep 18, 2018 at 09:52:58PM -0500, Katherine Cox-Buday wrote:
> +(define-public go-1.11

Thanks!

I tested that some basic packages build within the go-build-system using
Go 1.11 (several need to be updated to support Go 1.11, however).

> +                             ;; A side affect of these test scripts is testing
> +                             ;; cgo. Attempts at using cgo flags and
> +                             ;; directives with these scripts as specified
> +                             ;; here (https://golang.org/cmd/cgo/) have not
> +                             ;; worked. The tests continue to state that they
> +                             ;; can not find crt1.o despite being present.
> +                             "cmd/go/testdata/script/list_compiled_imports.txt"
> +                             "cmd/go/testdata/script/mod_case_cgo.txt"
> +                             ;; https://github.com/golang/go/issues/24884
> +                             "os/user/user_test.go"))

Okay, we can punt on this for now.

> +           (replace 'set-bootstrap-variables
> +             (lambda* (#:key outputs inputs #:allow-other-keys)
> +               ;; Tell the build system where to find the bootstrap Go.
> +               (let ((go  (assoc-ref inputs "go")))
> +                 (setenv "GOROOT_BOOTSTRAP" go)
> +                 (setenv "GOGC" "400")
> +                 ;; Go 1.10 tries to write to $HOME in a test
> +                 (setenv "HOME" "/tmp")
> +                 #t)))))))))

This phase is identical to the one that would be inherited from Go 1.10,
right?
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#32768; Package guix-patches. (Fri, 21 Sep 2018 14:59:02 GMT) Full text and rfc822 format available.

Message #11 received at 32768 <at> debbugs.gnu.org (full text, mbox):

From: Katherine Cox-Buday <cox.katherine.e <at> gmail.com>
To: Leo Famulari <leo <at> famulari.name>
Cc: 32768 <at> debbugs.gnu.org
Subject: Re: [bug#32768] [PATCH] gnu: go-1.11: Add New Version
Date: Fri, 21 Sep 2018 09:58:28 -0500
[Message part 1 (text/plain, inline)]
> I tested that some basic packages build within the go-build-system
> using Go 1.11 (several need to be updated to support Go 1.11,
> however).

Great to hear. I didn't think to do that, thanks!

> Okay, we can punt on this for now.

For future code spelunkers, I tried setting environmental variables in
the scripts pointing to glibc's lib path (and verified this was
correct), and also tried using cgo directives in the files. This
technique worked for resolving linux headers, but did not work for
resolving requisite libraries. I'm guessing this is because they try and
sandbox these scripts, but I'm not sure.

>> +           (replace 'set-bootstrap-variables
>> +             (lambda* (#:key outputs inputs #:allow-other-keys)
>> + ;; Tell the build system where to find the bootstrap Go.
>> +               (let ((go  (assoc-ref inputs "go")))
>> +                 (setenv "GOROOT_BOOTSTRAP" go)
>> +                 (setenv "GOGC" "400")
>> +                 ;; Go 1.10 tries to write to $HOME in a test
>> +                 (setenv "HOME" "/tmp")
>> +                 #t)))))))))
>
> This phase is identical to the one that would be inherited from Go
> 1.10,
> right?

Yes, thanks! Removed.

As an aside, this workflow is new to me. I'd greatly appreciate any
pointers on convention if anyone has any. I hope I'm doing this
correctly :)

[0001-Remove-Unecessary-Stage-Replacement.patch (text/x-patch, inline)]
From 52199d74e7e417f6257b2bdf73b9982724183347 Mon Sep 17 00:00:00 2001
In-Reply-To: <32768 <at> debbugs.gnu.org>
References: <32768 <at> debbugs.gnu.org>
From: Katherine Cox-Buday <cox.katherine.e <at> gmail.com>
Date: Fri, 21 Sep 2018 09:38:23 -0500
Subject: [PATCH] Remove Unecessary Stage Replacement

---
 gnu/packages/golang.scm | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index be404cc16..9c7a2e209 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -616,15 +616,6 @@ in the style of communicating sequential processes (@dfn{CSP}).")
                    (("/usr/share/zoneinfo/") tzdata-path))
                  (substitute* (find-files "cmd" "\\.go")
                    (("/lib(64)?/ld-linux.*\\.so\\.[0-9]") loader))
-                 #t)))
-           (replace 'set-bootstrap-variables
-             (lambda* (#:key outputs inputs #:allow-other-keys)
-               ;; Tell the build system where to find the bootstrap Go.
-               (let ((go  (assoc-ref inputs "go")))
-                 (setenv "GOROOT_BOOTSTRAP" go)
-                 (setenv "GOGC" "400")
-                 ;; Go 1.10 tries to write to $HOME in a test
-                 (setenv "HOME" "/tmp")
                  #t)))))))))
 
 (define-public go go-1.9)
-- 
2.17.1

[Message part 3 (text/plain, inline)]

-- 
Katherine

Reply sent to Leo Famulari <leo <at> famulari.name>:
You have taken responsibility. (Sat, 22 Sep 2018 18:45:02 GMT) Full text and rfc822 format available.

Notification sent to Katherine Cox-Buday <cox.katherine.e <at> gmail.com>:
bug acknowledged by developer. (Sat, 22 Sep 2018 18:45:02 GMT) Full text and rfc822 format available.

Message #16 received at 32768-done <at> debbugs.gnu.org (full text, mbox):

From: Leo Famulari <leo <at> famulari.name>
To: Katherine Cox-Buday <cox.katherine.e <at> gmail.com>
Cc: 32768-done <at> debbugs.gnu.org
Subject: Re: [bug#32768] [PATCH] gnu: go-1.11: Add New Version
Date: Sat, 22 Sep 2018 14:44:18 -0400
[Message part 1 (text/plain, inline)]
On Fri, Sep 21, 2018 at 09:58:28AM -0500, Katherine Cox-Buday wrote:
> 
> > I tested that some basic packages build within the go-build-system
> > using Go 1.11 (several need to be updated to support Go 1.11,
> > however).
> 
> Great to hear. I didn't think to do that, thanks!

It can be done per-package by setting '#:go ,go-1.11' in the arguments
field of the package you'd like to test, or for the entire
go-build-system like this:

diff --git a/guix/build-system/go.scm b/guix/build-system/go.scm
index cf9116327..80894677f 100644
--- a/guix/build-system/go.scm
+++ b/guix/build-system/go.scm
@@ -44,7 +44,7 @@
 (define (default-go)
   ;; Lazily resolve the binding to avoid a circular dependency.
   (let ((go (resolve-interface '(gnu packages golang))))
-    (module-ref go 'go)))
+    (module-ref go 'go-1.11)))
 
 (define* (lower name
                 #:key source inputs native-inputs outputs system target

> > This phase is identical to the one that would be inherited from Go
> > 1.10,
> > right?
> 
> Yes, thanks! Removed.

Great! Pushed as 21280a8cd805ace5f95cd2580b8a6ca1e25050d7

> As an aside, this workflow is new to me. I'd greatly appreciate any
> pointers on convention if anyone has any. I hope I'm doing this
> correctly :)

> From 52199d74e7e417f6257b2bdf73b9982724183347 Mon Sep 17 00:00:00 2001
> In-Reply-To: <32768 <at> debbugs.gnu.org>
> References: <32768 <at> debbugs.gnu.org>
> From: Katherine Cox-Buday <cox.katherine.e <at> gmail.com>
> Date: Fri, 21 Sep 2018 09:38:23 -0500
> Subject: [PATCH] Remove Unecessary Stage Replacement

In general, I prefer to make a change like this locally, amend the
original commit (I use `git add --patch && git commit --amend
--verbose`), and then send a new version of the original patch.

git-format-patch and git-send-email both take the --subject-prefix
argument, so you can generate the new patch with, for example,
'--subject-prefix=v2'. Then the subject line of your patch or email is
helpfully annotated:

Subject: [v2] gnu: Add Go 1.11.

But, for simple edits like this, or when there is only one patch,
sending a diff on the original patch works, too.

Please let us know if you have other workflow questions!
[signature.asc (application/pgp-signature, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 21 Oct 2018 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 182 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.