From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id IGSKGdMBKWEU1gAAgWs5BA (envelope-from ) for ; Fri, 27 Aug 2021 17:16:35 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id ICMbFdMBKWFyKAAA1q6Kng (envelope-from ) for ; Fri, 27 Aug 2021 15:16:35 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id E669D126F8 for ; Fri, 27 Aug 2021 17:16:34 +0200 (CEST) Received: from localhost ([::1]:41248 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mJdar-0000Ws-VT for larch@yhetil.org; Fri, 27 Aug 2021 11:16:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55432) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mJdYQ-0006v2-RH for guix-patches@gnu.org; Fri, 27 Aug 2021 11:14:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:41159) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mJdYQ-0007yQ-JX for guix-patches@gnu.org; Fri, 27 Aug 2021 11:14:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mJdYQ-00073o-Fm for guix-patches@gnu.org; Fri, 27 Aug 2021 11:14:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50227] [PATCH 1/3] build-system/go: Use a native-search-path for GOPATH. References: <20210827151052.12611-1-marius@gnu.org> In-Reply-To: <20210827151052.12611-1-marius@gnu.org> Resent-From: Marius Bakke Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 27 Aug 2021 15:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50227 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 50227@debbugs.gnu.org Received: via spool by 50227-submit@debbugs.gnu.org id=B50227.163007722727092 (code B ref 50227); Fri, 27 Aug 2021 15:14:02 +0000 Received: (at 50227) by debbugs.gnu.org; 27 Aug 2021 15:13:47 +0000 Received: from localhost ([127.0.0.1]:52699 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mJdY6-00072i-Ms for submit@debbugs.gnu.org; Fri, 27 Aug 2021 11:13:47 -0400 Received: from eggs.gnu.org ([209.51.188.92]:39196) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mJdY1-00072P-Ay for 50227@debbugs.gnu.org; Fri, 27 Aug 2021 11:13:41 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:50744) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mJdXw-0007do-6N for 50227@debbugs.gnu.org; Fri, 27 Aug 2021 11:13:32 -0400 Received: from host-37-191-231-185.lynet.no ([37.191.231.185]:38002 helo=localhost) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mJdXv-00023J-Sh for 50227@debbugs.gnu.org; Fri, 27 Aug 2021 11:13:32 -0400 From: Marius Bakke Date: Fri, 27 Aug 2021 17:13:28 +0200 Message-Id: <20210827151330.13112-1-marius@gnu.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1630077395; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=IGXapkg1CkrD5jHEtHdiPhaDmKrcd56DljqIgSBiCww=; b=iUhFlp6OLyTlILlA/JgaFwrUhl+DJ2JvbZgWQfOxv23csl+PqDaqwxEtQbsHd06guEDg7d 0FRuMZvxNwG44f9cPTzFtCf8VL6F90QXnNRFuEhrr3KBLPzWkNn8MKDnEKRWJ6u3jhQ48Z VilPzmzo8XqaEfsd7yIXHOExTIvV5cxk1mrJtygcMXFuKs9oGTpElcvy3znmkwjEI7qikl tEoTn/YaSfABlRrbEILqu2QNGpaCJUyT8zCczlBDjar9M2a4cN5Fw9e4YRChoOnsUbwFEL wFpBSCG0mWi/Cprj2lQii3nL+zmkl/aVmOzn04VpRSNHHK4n7+44M0dMWlu6Lw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1630077395; a=rsa-sha256; cv=none; b=B2aL7iiw3wCkXElPpZ62LRCkS6mxPOZcS3YaAkjO8BBTqFOgvRRuy6pyBA44poScEIJhyR y876P9EhbRm7fu8BIX+FU8GCiuQPI5JDFruOg9I2VI+u6eJOQtbzqu6mbkWdBqeduEDac/ g20ohIGTlsqcjVHwakyW5AGj9dBM2RfLVHq3oNYGGYC7HomF6ErCX45FNNblM65zThm6VC Xxhwt5WRgozhFTz+jnXY7OeY46KvuJm3yDVq53XYOFcENnpgZx0cZKR8v5HfH9bKTMAzIp JCSb2NAfVDWXCcz71dM4oFQIYmsSCkfZzDx3J4DnotFDqoifXOyu3Oqa75GjNg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: -1.93 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: E669D126F8 X-Spam-Score: -1.93 X-Migadu-Scanner: scn0.migadu.com X-TUID: 4o0C1vAA+Bix * gnu/packages/golang.scm (go-1.14)[native-search-paths]: New field. * guix/build/go-build-system.scm (setup-go-environment): Make the working directory the first entry on GOPATH instead of creating a union. (unpack, install): Adjust accordingly. (go-package?, go-inputs): Remove variables. --- gnu/packages/golang.scm | 4 ++++ guix/build/go-build-system.scm | 37 ++++------------------------------ 2 files changed, 8 insertions(+), 33 deletions(-) diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm index 72579d6bd2..3a5c6ddc3f 100644 --- a/gnu/packages/golang.scm +++ b/gnu/packages/golang.scm @@ -257,6 +257,10 @@ in the style of communicating sequential processes (@dfn{CSP}).") (sha256 (base32 "1crh90qkvhlx23hwsi4wxy3l3h8973lr18135y6h1nnzzwr3n3ps")))) + (native-search-paths + (list (search-path-specification + (variable "GOPATH") + (files '("src/.." "pkg/.."))))) (arguments (substitute-keyword-arguments (package-arguments go-1.4) ((#:system system) diff --git a/guix/build/go-build-system.scm b/guix/build/go-build-system.scm index 227df820db..01dd8cd249 100644 --- a/guix/build/go-build-system.scm +++ b/guix/build/go-build-system.scm @@ -5,6 +5,7 @@ ;;; Copyright © 2020 Jack Hill ;;; Copyright © 2020 Jakub Kądziołka ;;; Copyright © 2020 Efraim Flashner +;;; Copyright © 2021 Marius Bakke ;;; ;;; This file is part of GNU Guix. ;;; @@ -88,7 +89,6 @@ ;; a tmpdir when creating the inputs union. ;; * Use Go modules [4] ;; * Re-use compiled packages [5] -;; * Avoid the go-inputs hack ;; * Stop needing remove-go-references (-trimpath ? ) ;; * Remove module packages, only offering the full Git repos? This is ;; more idiomatic, I think, because Go downloads Git repos, not modules. @@ -143,23 +143,12 @@ dependencies, so it should be self-contained." (setenv "GOCACHE" "/tmp/go-cache") ;; Using the current working directory as GOPATH makes it easier for packagers ;; who need to manipulate the unpacked source code. - (setenv "GOPATH" (getcwd)) + (setenv "GOPATH" (string-append (getcwd) ":" (getenv "GOPATH"))) ;; Go 1.13 uses go modules by default. The go build system does not ;; currently support modules, so turn modules off to continue using the old ;; GOPATH behavior. (setenv "GO111MODULE" "off") (setenv "GOBIN" (string-append (assoc-ref outputs "out") "/bin")) - (let ((tmpdir (tmpnam))) - (match (go-inputs inputs) - (((names . directories) ...) - (union-build tmpdir (filter directory-exists? directories) - #:create-all-directories? #t - #:log-port (%make-void-port "w")))) - ;; XXX A little dance because (guix build union) doesn't use mkdir-p. - (copy-recursively tmpdir - (string-append (getenv "GOPATH")) - #:keep-mtime? #t) - (delete-file-recursively tmpdir)) #t) (define* (unpack #:key source import-path unpack-path #:allow-other-keys) @@ -191,31 +180,13 @@ unpacking." (display "WARNING: The Go import path is unset.\n")) (when (string-null? unpack-path) (set! unpack-path import-path)) - (let ((dest (string-append (getenv "GOPATH") "/src/" unpack-path))) + (let ((dest (string-append (getcwd) "/src/" unpack-path))) (mkdir-p dest) (if (file-is-directory? source) (copy-recursively source dest #:keep-mtime? #t) (unpack-maybe-strip source dest))) #t) -(define (go-package? name) - (string-prefix? "go-" name)) - -(define (go-inputs inputs) - "Return the alist of INPUTS that are Go software." - ;; XXX This should not check the file name of the store item. Instead we - ;; should pass, from the host side, the list of inputs that are packages using - ;; the go-build-system. - (alist-delete "go" ; Exclude the Go compiler - (alist-delete "source" ; Exclude the source code of the package being built - (filter (match-lambda - ((label . directory) - (go-package? ((compose package-name->name+version - strip-store-file-name) - directory))) - (_ #f)) - inputs)))) - (define* (build #:key import-path build-flags #:allow-other-keys) "Build the package named by IMPORT-PATH." (with-throw-handler @@ -249,7 +220,7 @@ XXX We can't make use of compiled libraries (Go \"packages\")." (if (string-null? import-path) ((display "WARNING: The Go import path is unset.\n"))) (let* ((out (assoc-ref outputs "out")) - (source (string-append (getenv "GOPATH") "/src/" import-path)) + (source (string-append "src/" import-path)) (dest (string-append out "/src/" import-path))) (mkdir-p dest) (copy-recursively source dest #:keep-mtime? #t))) -- 2.31.1