From patchwork Sat Mar 16 22:24:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Katherine Cox-Buday X-Patchwork-Id: 1472 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id F17C316D16; Sat, 16 Mar 2019 22:40:24 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 3BC3D16CED for ; Sat, 16 Mar 2019 22:40:24 +0000 (GMT) Received: from localhost ([127.0.0.1]:47381 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h5HyX-00058P-F2 for patchwork@mira.cbaines.net; Sat, 16 Mar 2019 18:40:23 -0400 Received: from eggs.gnu.org ([209.51.188.92]:53169) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h5HxH-0003tm-QS for guix-patches@gnu.org; Sat, 16 Mar 2019 18:39:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h5HxG-0001wy-Cl for guix-patches@gnu.org; Sat, 16 Mar 2019 18:39:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:33245) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h5HxG-0001wr-3T for guix-patches@gnu.org; Sat, 16 Mar 2019 18:39:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1h5HxG-000386-0b for guix-patches@gnu.org; Sat, 16 Mar 2019 18:39:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#34887] [PATCH] Create Package for Go v1.12.1 Resent-From: Katherine Cox-Buday Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 16 Mar 2019 22:39:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 34887 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 34887@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.155277593812017 (code B ref -1); Sat, 16 Mar 2019 22:39:01 +0000 Received: (at submit) by debbugs.gnu.org; 16 Mar 2019 22:38:58 +0000 Received: from localhost ([127.0.0.1]:46789 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h5Hx6-00037e-PY for submit@debbugs.gnu.org; Sat, 16 Mar 2019 18:38:58 -0400 Received: from eggs.gnu.org ([209.51.188.92]:38750) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h5Hx5-00037S-7q for submit@debbugs.gnu.org; Sat, 16 Mar 2019 18:38:51 -0400 Received: from lists.gnu.org ([209.51.188.17]:34629) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h5Hx0-0001qm-1O for submit@debbugs.gnu.org; Sat, 16 Mar 2019 18:38:46 -0400 Received: from eggs.gnu.org ([209.51.188.92]:53106) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h5Hwy-0003g6-Dj for guix-patches@gnu.org; Sat, 16 Mar 2019 18:38:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h5Hit-0003GU-2d for guix-patches@gnu.org; Sat, 16 Mar 2019 18:24:12 -0400 Received: from mail-it1-x12c.google.com ([2607:f8b0:4864:20::12c]:39137) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h5His-0003GI-MJ for guix-patches@gnu.org; Sat, 16 Mar 2019 18:24:11 -0400 Received: by mail-it1-x12c.google.com with SMTP id l15so16227436iti.4 for ; Sat, 16 Mar 2019 15:24:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:user-agent:mime-version; bh=drRTAIY2Ku78SeJM2pIf71Kq8ERM1C56M1jdPLcpu6k=; b=Ta2wSaaOX5iWTQmX1q+UqNI41wgAOwB71SbjktqKuV1D02IC9mXB6KItK9T7S7joJF 7qsGlBm6q6TqMTqLehZ1UoVZgwzU28Qq1M6H3HnsdMVUDhOTx5BRDuJB+62vmlJGCdJa WxI3bbijPJeLnYar4DT7lR2Ar1bXekKveKW6HcbLNykiZBmJOeNfB2+F0wXvqF2ibdka 7pOpmsWglUskz7VDwDZSNrRunVx93rCseAdYRCclKcdjPpIPbOKQm7ALudmPeXhrX6iB WsT6D5NovuxueTEz8q9dGbKZfBFxxLaKQ34QWh/YrRYaeAzPTiv9dnLY1eYydNNLFQ+8 1iyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:user-agent :mime-version; bh=drRTAIY2Ku78SeJM2pIf71Kq8ERM1C56M1jdPLcpu6k=; b=UUApLz5aN2u5SQz1H4kOUq/EHIsQ60dk0LduItM71JiJLh0oGsMPveIGkyQLLXlhgR 81uhREs52BgpSzruoR025alUnUZFVRAzdyZHWTtvBJuWMdPLzpv3j1rg/FUzB2DI1en3 59Lj3ZlPmDckcim7HrwBDLWXg7LAkEWVBwKszgcb1WJKqMX8IydY7bYfR2OmO0Hbt1Vf Xbg0NSwRKesakseXHv8kzP1c2KYUy6XA2bXpxDHbjKxxgz1L2dtkmiqle9t3zRVL8W5d XYVeiJdfmqkyqHWgWNPynukQHRVr98N+YGpOzx5/jASXhKLrfiQPjGenoh/xmQimeJCG r7/g== X-Gm-Message-State: APjAAAV0iUDKazSQAe6htcRET3nQ2kZ4qTO6d04Lmt1WkT7fpq1yiX61 jSJoC4ogbEZW16DPbDF0+GAnvVk3 X-Google-Smtp-Source: APXvYqzA2UaOdisD8z0zyiuWrpsE2ppGCEP/M9oxa/Pmu4fqZTO2hj4dytxJpCufOe63mlGHpi7OdA== X-Received: by 2002:a24:7f04:: with SMTP id r4mr5990923itc.17.1552775049364; Sat, 16 Mar 2019 15:24:09 -0700 (PDT) Received: from gazelle-pro (172-221-246-205.dhcp.chtrptr.net. [172.221.246.205]) by smtp.gmail.com with ESMTPSA id s10sm2376096ioc.54.2019.03.16.15.24.07 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 16 Mar 2019 15:24:08 -0700 (PDT) From: Katherine Cox-Buday Date: Sat, 16 Mar 2019 17:24:06 -0500 Message-ID: <87mulu31bt.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches From a1e39884b9d4f876e64406d94ee3f8c554d62a5d Mon Sep 17 00:00:00 2001 From: Katherine Cox-Buday Date: Sat, 16 Mar 2019 16:24:56 -0500 Subject: [PATCH] Create Package for Go v1.12.1 --- gnu/packages/golang.scm | 188 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 187 insertions(+), 1 deletion(-) diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm index 4bcd5cfcf..e24ed8dde 100644 --- a/gnu/packages/golang.scm +++ b/gnu/packages/golang.scm @@ -12,7 +12,7 @@ ;;; Copyright © 2018 Tomáš Čech ;;; Copyright © 2018 Pierre-Antoine Rouby ;;; Copyright © 2018 Pierre Neidhardt -;;; Copyright @ 2018 Katherine Cox-Buday +;;; Copyright @ 2018, 2019 Katherine Cox-Buday ;;; ;;; This file is part of GNU Guix. ;;; @@ -413,6 +413,192 @@ in the style of communicating sequential processes (@dfn{CSP}).") ,@(package-native-inputs go-1.4))) (supported-systems %supported-systems))) + +(define-public go-1.12 + (package + (inherit go-1.4) + (name "go") + (version "1.12.1") + (source + (origin + (method url-fetch) + (uri (string-append "https://storage.googleapis.com/golang/" + name version ".src.tar.gz")) + (sha256 + (base32 + "12l12mmgqvy3nbscy7sz83qj4m6iz5a322aq9sk45f7l9ml2gq8b")))) + (arguments + (substitute-keyword-arguments (package-arguments go-1.4) + ((#: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"))) + + ;; A side effect 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 object files/headers despite being present. + (for-each + delete-file + '("cmd/go/testdata/script/mod_case_cgo.txt" + "cmd/go/testdata/script/list_find.txt" + "cmd/go/testdata/script/list_compiled_imports.txt" + "cmd/go/testdata/script/cgo_syso_issue29253.txt")) + + (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.+)") + ("net/cgo_unix_test.go" "(.+)(TestCgoLookupPort.+)") + ("net/cgo_unix_test.go" "(.+)(TestCgoLookupPortWithCancel.+)") + ;; 127.0.0.1 doesn't exist + ("net/cgo_unix_test.go" "(.+)(TestCgoLookupPTR.+)") + ;; 127.0.0.1 doesn't exist + ("net/cgo_unix_test.go" "(.+)(TestCgoLookupPTRWithCancel.+)") + ;; /etc/services doesn't exist + ("net/parse_test.go" "(.+)(TestReadLine.+)") + ("os/os_test.go" "(.+)(TestHostname.+)") + ;; The user's directory doesn't exist + ("os/os_test.go" "(.+)(TestUserHomeDir.+)") + ("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))) + (add-before 'build '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") + #t))) + (replace 'build + (lambda* (#:key inputs outputs #:allow-other-keys) + ;; FIXME: Some of the .a files are not bit-reproducible. + (let* ((output (assoc-ref outputs "out"))) + (setenv "CC" (which "gcc")) + (setenv "GOOS" "linux") + (setenv "GOROOT" (dirname (getcwd))) + (setenv "GOROOT_FINAL" output) + (setenv "CGO_ENABLED" "1") + (invoke "sh" "all.bash")))) + + (replace 'install + ;; TODO: Most of this could be factorized with Go 1.4. + (lambda* (#:key outputs #:allow-other-keys) + (let* ((output (assoc-ref outputs "out")) + (doc_out (assoc-ref outputs "doc")) + (docs (string-append doc_out "/share/doc/" ,name "-" ,version)) + (src (string-append + (assoc-ref outputs "tests") "/share/" ,name "-" ,version))) + (delete-file-recursively "../pkg/bootstrap") + ;; Prevent installation of the build cache, which contains + ;; store references to most of the tools used to build Go and + ;; would unnecessarily increase the size of Go's closure if it + ;; was installed. + (delete-file-recursively "../pkg/obj") + + (mkdir-p src) + (copy-recursively "../test" (string-append src "/test")) + (delete-file-recursively "../test") + (mkdir-p docs) + (copy-recursively "../api" (string-append docs "/api")) + (delete-file-recursively "../api") + (copy-recursively "../doc" (string-append docs "/doc")) + (delete-file-recursively "../doc") + + (for-each + (lambda (file) + (let* ((filein (string-append "../" file)) + (fileout (string-append docs "/" file))) + (copy-file filein fileout) + (delete-file filein))) + ;; Note the slightly different file names compared to 1.4. + '("README.md" "CONTRIBUTORS" "AUTHORS" "PATENTS" + "LICENSE" "VERSION" "CONTRIBUTING.md" "robots.txt")) + + (copy-recursively "../" output) + #t))))))) + (native-inputs + `(("go" ,go-1.4) + ,@(match (%current-system) + ((or "armhf-linux" "aarch64-linux") + `(("gold" ,binutils-gold))) + (_ `())) + ,@(package-native-inputs go-1.4))) + (supported-systems %supported-systems))) + (define-public go go-1.11) (define-public go-github-com-alsm-ioprogress -- 2.17.1