From unknown Thu Aug 14 22:20:07 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#49615] [PATCH] gnu: go-1.16: Clean up installation location and logic. Resent-From: Sarah Morgensen Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 18 Jul 2021 03:54:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 49615 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49615@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.162658043110340 (code B ref -1); Sun, 18 Jul 2021 03:54:01 +0000 Received: (at submit) by debbugs.gnu.org; 18 Jul 2021 03:53:51 +0000 Received: from localhost ([127.0.0.1]:54989 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m4xsF-0002gi-Cb for submit@debbugs.gnu.org; Sat, 17 Jul 2021 23:53:51 -0400 Received: from lists.gnu.org ([209.51.188.17]:44044) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m4xsC-0002gZ-NS for submit@debbugs.gnu.org; Sat, 17 Jul 2021 23:53:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50378) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m4xsB-0007RR-I3 for guix-patches@gnu.org; Sat, 17 Jul 2021 23:53:48 -0400 Received: from out2.migadu.com ([2001:41d0:2:aacc::]:36111) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m4xs8-00060w-Lh for guix-patches@gnu.org; Sat, 17 Jul 2021 23:53:47 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mgsn.dev; s=key1; t=1626580419; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=quSJtI1maTy3s8hmyJSiaz4fkExS6nQlAEHGKFaWHe4=; b=RxhxaanAy/i5MSGHnWDyGUeQfwZRLgQk3b1bPLFi5vpnKLcjgQ8UfHt05cVsl3wvf7p1tT T1ILvXrEs0SEPvf5jNrVR21DCneD8ClcNAhMwbtjVIdY7M2aK4FB94/vGoJ8BpWhbdzp99 PYJ+nrX0lDCBMDIrHPIb0vs79c1gvEI= From: Sarah Morgensen Date: Sat, 17 Jul 2021 20:53:36 -0700 Message-Id: <1e0ee9395729f43db61b2e582d1718f536ed0c45.1626580143.git.iskarian@mgsn.dev> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: iskarian@mgsn.dev Received-SPF: pass client-ip=2001:41d0:2:aacc::; envelope-from=iskarian@mgsn.dev; helo=out2.migadu.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) * gnu/packages/golang.scm (go-1.16)[arguments]<#:tests>: Fix formatting. <#:strip-directories>: Avoid stripping standard library which breaks it. <#:phases>{install}: Install to out/lib/go instead of out. {build}: Use the new location. {reset-cwd}: Chdir back to source root before install-license-files. --- Hello Guix, Currently the "out" output of Go looks like... /gnu/store/...-go-1.16.5 |-> bin [binaries] |-> lib [host-independent timezone data] |-> misc [various arch-independent resources] |-> pkg [compiled Go std library] |-> src [Go compiler and std library source] ...which means that after installing Go, all of those directories are polluting ~/.guix-profile. Unfortunately, Go does not have any standardized installation process, and it expects all these directories to be siblings (yes, it needs its own source to work). Its install instructions suggest installing everything in /usr/local/go; Debian installs in /usr/lib/go-X.Y and /usr/share/go-X.Y, with symlinks in /usr/lib/go-X.Y for anything in /usr/share/go-X.Y. We could install source to e.g. /share/go (or even in its own output), but we would still require a symlink like Debian so that Go sees it in its main tree. (Tests (6MB) and docs (7MB) are currently installed in separate directories in separate outputs, which makes them difficult to actually use.) This patch is fairly conservative, and just moves everything to "/lib/go": /gnu/store/...-go-1.16.5 |-> bin [symlinks to "lib/go/bin"] |-> lib |-> go |-> bin [binaries] |-> lib [host-independent timezone data] |-> misc [various arch-independent resources] |-> pkg [compiled Go std library] |-> src [Go compiler and std library source] But if it were up to me, I'd chuck it all in "out" and symlink like Debian. WDYT? -- Sarah gnu/packages/golang.scm | 48 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm index f38f307392..77df7bfbf4 100644 --- a/gnu/packages/golang.scm +++ b/gnu/packages/golang.scm @@ -1405,7 +1405,8 @@ in the style of communicating sequential processes (@dfn{CSP}).") "19a93p217h5xi2sgh34qzv24pkd4df0sw4fc5z6k47lspjp3vx2l")))) (arguments (substitute-keyword-arguments (package-arguments go-1.14) - ((#:tests? _) #t) + ((#:tests? _ #t) #t) + ((#:strip-directories _ '()) ''("lib/go/pkg/tool" "lib/go/bin")) ((#:phases phases) `(modify-phases ,phases (add-after 'unpack 'remove-unused-sourcecode-generators @@ -1523,7 +1524,7 @@ in the style of communicating sequential processes (@dfn{CSP}).") (setenv "GO_LDSO" loader) (setenv "GOOS" "linux") (setenv "GOROOT" (dirname (getcwd))) - (setenv "GOROOT_FINAL" output) + (setenv "GOROOT_FINAL" (string-append output "/lib/go")) (setenv "GOCACHE" "/tmp/go-cache") (invoke "sh" "make.bash" "--no-banner")))) (replace 'check @@ -1537,7 +1538,48 @@ in the style of communicating sequential processes (@dfn{CSP}).") (lambda _ ;; Rewrite references to perl input in test scripts (substitute* "net/http/cgi/testdata/test.cgi" - (("^#!.*") "#!/usr/bin/env perl\n")))))))) + (("^#!.*") "#!/usr/bin/env perl\n")))) + (replace 'install + ;; TODO: Most of this could be factorized with Go 1.4. + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (tests (assoc-ref outputs "tests")) + (out-lib (string-append out "/lib/go")) + (tests-share (string-append tests "/share/go")) + (docs (string-append (assoc-ref outputs "doc") + "/share/doc/go-" + ,(package-version this-package)))) + ;; 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") + + (install-file "../VERSION" out-lib) + (copy-recursively "../pkg" (string-append out-lib "/pkg")) + (copy-recursively "../src" (string-append out-lib "/src")) + (copy-recursively "../bin" (string-append out-lib "/bin")) + (copy-recursively "../lib" (string-append out-lib "/lib")) + (copy-recursively "../misc" (string-append out-lib "/misc")) + + (mkdir-p (string-append out "/bin")) + (with-directory-excursion (string-append out "/bin") + (symlink "../lib/go/bin/go" "go") + (symlink "../lib/go/bin/gofmt" "gofmt")) + + (mkdir-p tests-share) + (copy-recursively "../test" (string-append tests-share "/test")) + (copy-recursively "../api" (string-append tests-share "/api")) + + (for-each + (lambda (file) (install-file (string-append "../" file) docs)) + ;; Note the slightly different file names compared to 1.4. + '("AUTHORS" "CONTRIBUTING.md" "CONTRIBUTORS" "PATENTS" + "README.md" "SECURITY.md" "favicon.ico" "robots.txt")) + (copy-recursively "../doc" (string-append docs "/doc"))))) + (add-before 'install-license-files 'reset-cwd + (lambda _ + (chdir ".."))))))) (native-inputs `(("go-fix-script-tests.patch" ,(search-patch "go-fix-script-tests.patch")) ,@(if (not (member (%current-system) (package-supported-systems go-1.4))) base-commit: 9cb35c02164d929fcb8929e7f454df215df8cf25 -- 2.31.1 From unknown Thu Aug 14 22:20:07 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Sarah Morgensen Subject: bug#49615: closed (Re: [bug#49615] [PATCH] gnu: go-1.16: Clean up installation location and logic.) Message-ID: References: <86wnnyxy9a.fsf@mgsn.dev> <1e0ee9395729f43db61b2e582d1718f536ed0c45.1626580143.git.iskarian@mgsn.dev> X-Gnu-PR-Message: they-closed 49615 X-Gnu-PR-Package: guix-patches X-Gnu-PR-Keywords: patch Reply-To: 49615@debbugs.gnu.org Date: Fri, 03 Sep 2021 01:08:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1630631282-28109-1" This is a multi-part message in MIME format... ------------=_1630631282-28109-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #49615: [PATCH] gnu: go-1.16: Clean up installation location and logic. which was filed against the guix-patches package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 49615@debbugs.gnu.org. --=20 49615: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D49615 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1630631282-28109-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 49615-done) by debbugs.gnu.org; 3 Sep 2021 01:07:38 +0000 Received: from localhost ([127.0.0.1]:42385 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mLxgA-0007Il-4h for submit@debbugs.gnu.org; Thu, 02 Sep 2021 21:07:38 -0400 Received: from out1.migadu.com ([91.121.223.63]:52644) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mLxg6-0007Ia-OO for 49615-done@debbugs.gnu.org; Thu, 02 Sep 2021 21:07:36 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mgsn.dev; s=key1; t=1630631253; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to; bh=OkYKqC4iJw6pMV5/ymkUuXwZxf2XMJVxPcJUz3wBHbY=; b=U+5T5TzdKy+SU5uas61ZDnvPMrzNGHmLWOhpmc0Ow3FuSHytAccyZ164eS8KGDc31ubssV PE4HtKljJ9yPR8dLMIBHKdEs5dTGVNJgfYEWBTl9PlO/azNzVmlmQmArKPXcoSjniQW4bZ wo+4iLXg+dS/FzyjbrqlTGW4hAesmVA= From: Sarah Morgensen To: 49615-done@debbugs.gnu.org Subject: Re: [bug#49615] [PATCH] gnu: go-1.16: Clean up installation location and logic. Date: Thu, 02 Sep 2021 18:07:29 -0700 In-Reply-To: Sarah Morgensen's message of "Sat, 17 Jul 2021 20:53:36 -0700 (6 weeks, 4 days, 21 hours ago)" Message-ID: <86wnnyxy9a.fsf@mgsn.dev> MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: iskarian@mgsn.dev X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 49615-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) This will be superseded by a backport of the changes in #50348, if accepted. -- Sarah ------------=_1630631282-28109-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 18 Jul 2021 03:53:51 +0000 Received: from localhost ([127.0.0.1]:54989 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m4xsF-0002gi-Cb for submit@debbugs.gnu.org; Sat, 17 Jul 2021 23:53:51 -0400 Received: from lists.gnu.org ([209.51.188.17]:44044) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m4xsC-0002gZ-NS for submit@debbugs.gnu.org; Sat, 17 Jul 2021 23:53:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50378) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m4xsB-0007RR-I3 for guix-patches@gnu.org; Sat, 17 Jul 2021 23:53:48 -0400 Received: from out2.migadu.com ([2001:41d0:2:aacc::]:36111) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m4xs8-00060w-Lh for guix-patches@gnu.org; Sat, 17 Jul 2021 23:53:47 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mgsn.dev; s=key1; t=1626580419; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=quSJtI1maTy3s8hmyJSiaz4fkExS6nQlAEHGKFaWHe4=; b=RxhxaanAy/i5MSGHnWDyGUeQfwZRLgQk3b1bPLFi5vpnKLcjgQ8UfHt05cVsl3wvf7p1tT T1ILvXrEs0SEPvf5jNrVR21DCneD8ClcNAhMwbtjVIdY7M2aK4FB94/vGoJ8BpWhbdzp99 PYJ+nrX0lDCBMDIrHPIb0vs79c1gvEI= From: Sarah Morgensen To: guix-patches@gnu.org Subject: [PATCH] gnu: go-1.16: Clean up installation location and logic. Date: Sat, 17 Jul 2021 20:53:36 -0700 Message-Id: <1e0ee9395729f43db61b2e582d1718f536ed0c45.1626580143.git.iskarian@mgsn.dev> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: iskarian@mgsn.dev Received-SPF: pass client-ip=2001:41d0:2:aacc::; envelope-from=iskarian@mgsn.dev; helo=out2.migadu.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) * gnu/packages/golang.scm (go-1.16)[arguments]<#:tests>: Fix formatting. <#:strip-directories>: Avoid stripping standard library which breaks it. <#:phases>{install}: Install to out/lib/go instead of out. {build}: Use the new location. {reset-cwd}: Chdir back to source root before install-license-files. --- Hello Guix, Currently the "out" output of Go looks like... /gnu/store/...-go-1.16.5 |-> bin [binaries] |-> lib [host-independent timezone data] |-> misc [various arch-independent resources] |-> pkg [compiled Go std library] |-> src [Go compiler and std library source] ...which means that after installing Go, all of those directories are polluting ~/.guix-profile. Unfortunately, Go does not have any standardized installation process, and it expects all these directories to be siblings (yes, it needs its own source to work). Its install instructions suggest installing everything in /usr/local/go; Debian installs in /usr/lib/go-X.Y and /usr/share/go-X.Y, with symlinks in /usr/lib/go-X.Y for anything in /usr/share/go-X.Y. We could install source to e.g. /share/go (or even in its own output), but we would still require a symlink like Debian so that Go sees it in its main tree. (Tests (6MB) and docs (7MB) are currently installed in separate directories in separate outputs, which makes them difficult to actually use.) This patch is fairly conservative, and just moves everything to "/lib/go": /gnu/store/...-go-1.16.5 |-> bin [symlinks to "lib/go/bin"] |-> lib |-> go |-> bin [binaries] |-> lib [host-independent timezone data] |-> misc [various arch-independent resources] |-> pkg [compiled Go std library] |-> src [Go compiler and std library source] But if it were up to me, I'd chuck it all in "out" and symlink like Debian. WDYT? -- Sarah gnu/packages/golang.scm | 48 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm index f38f307392..77df7bfbf4 100644 --- a/gnu/packages/golang.scm +++ b/gnu/packages/golang.scm @@ -1405,7 +1405,8 @@ in the style of communicating sequential processes (@dfn{CSP}).") "19a93p217h5xi2sgh34qzv24pkd4df0sw4fc5z6k47lspjp3vx2l")))) (arguments (substitute-keyword-arguments (package-arguments go-1.14) - ((#:tests? _) #t) + ((#:tests? _ #t) #t) + ((#:strip-directories _ '()) ''("lib/go/pkg/tool" "lib/go/bin")) ((#:phases phases) `(modify-phases ,phases (add-after 'unpack 'remove-unused-sourcecode-generators @@ -1523,7 +1524,7 @@ in the style of communicating sequential processes (@dfn{CSP}).") (setenv "GO_LDSO" loader) (setenv "GOOS" "linux") (setenv "GOROOT" (dirname (getcwd))) - (setenv "GOROOT_FINAL" output) + (setenv "GOROOT_FINAL" (string-append output "/lib/go")) (setenv "GOCACHE" "/tmp/go-cache") (invoke "sh" "make.bash" "--no-banner")))) (replace 'check @@ -1537,7 +1538,48 @@ in the style of communicating sequential processes (@dfn{CSP}).") (lambda _ ;; Rewrite references to perl input in test scripts (substitute* "net/http/cgi/testdata/test.cgi" - (("^#!.*") "#!/usr/bin/env perl\n")))))))) + (("^#!.*") "#!/usr/bin/env perl\n")))) + (replace 'install + ;; TODO: Most of this could be factorized with Go 1.4. + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (tests (assoc-ref outputs "tests")) + (out-lib (string-append out "/lib/go")) + (tests-share (string-append tests "/share/go")) + (docs (string-append (assoc-ref outputs "doc") + "/share/doc/go-" + ,(package-version this-package)))) + ;; 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") + + (install-file "../VERSION" out-lib) + (copy-recursively "../pkg" (string-append out-lib "/pkg")) + (copy-recursively "../src" (string-append out-lib "/src")) + (copy-recursively "../bin" (string-append out-lib "/bin")) + (copy-recursively "../lib" (string-append out-lib "/lib")) + (copy-recursively "../misc" (string-append out-lib "/misc")) + + (mkdir-p (string-append out "/bin")) + (with-directory-excursion (string-append out "/bin") + (symlink "../lib/go/bin/go" "go") + (symlink "../lib/go/bin/gofmt" "gofmt")) + + (mkdir-p tests-share) + (copy-recursively "../test" (string-append tests-share "/test")) + (copy-recursively "../api" (string-append tests-share "/api")) + + (for-each + (lambda (file) (install-file (string-append "../" file) docs)) + ;; Note the slightly different file names compared to 1.4. + '("AUTHORS" "CONTRIBUTING.md" "CONTRIBUTORS" "PATENTS" + "README.md" "SECURITY.md" "favicon.ico" "robots.txt")) + (copy-recursively "../doc" (string-append docs "/doc"))))) + (add-before 'install-license-files 'reset-cwd + (lambda _ + (chdir ".."))))))) (native-inputs `(("go-fix-script-tests.patch" ,(search-patch "go-fix-script-tests.patch")) ,@(if (not (member (%current-system) (package-supported-systems go-1.4))) base-commit: 9cb35c02164d929fcb8929e7f454df215df8cf25 -- 2.31.1 ------------=_1630631282-28109-1--