From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id qPGYNiAlSGHHRQEAgWs5BA (envelope-from ) for ; Mon, 20 Sep 2021 08:07:28 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id GJFHMiAlSGFuZgAA1q6Kng (envelope-from ) for ; Mon, 20 Sep 2021 06:07:28 +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 438021A866 for ; Mon, 20 Sep 2021 08:07:28 +0200 (CEST) Received: from localhost ([::1]:44634 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mSBjw-0002ou-LX for larch@yhetil.org; Mon, 20 Sep 2021 01:21:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49296) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mSBjk-0002mM-B1 for bug-guix@gnu.org; Mon, 20 Sep 2021 01:21:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:57273) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mSBjk-00035S-2k for bug-guix@gnu.org; Mon, 20 Sep 2021 01:21:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mSBjj-0007X2-VP for bug-guix@gnu.org; Mon, 20 Sep 2021 01:21:03 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#50493: [PATCH 2/4] build-system/go: Initialize build cache from input packages. Resent-From: Sarah Morgensen Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Mon, 20 Sep 2021 05:21:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50493 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 50493@debbugs.gnu.org Received: via spool by 50493-submit@debbugs.gnu.org id=B50493.163211526328945 (code B ref 50493); Mon, 20 Sep 2021 05:21:03 +0000 Received: (at 50493) by debbugs.gnu.org; 20 Sep 2021 05:21:03 +0000 Received: from localhost ([127.0.0.1]:40583 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mSBjj-0007WO-1F for submit@debbugs.gnu.org; Mon, 20 Sep 2021 01:21:03 -0400 Received: from out2.migadu.com ([188.165.223.204]:41712) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mSBjb-0007VH-70 for 50493@debbugs.gnu.org; Mon, 20 Sep 2021 01:21:00 -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=1632115254; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GZ5iPxFRLyQRvT+3cDSGw0gcN+tlNQkzqXDpVDuawZY=; b=NCH4WtlvGy0FITnjxq+MZaqp5h0zS9lefCR6AtHTEJN09xWCJ23St3+t0X67zkFrZ+soW7 FUKeqmXaAhcNdpnMwLL8eX1chDFeodSokTJIsXhb6OPu3PYH2EZ5nmftZUtVpZUsGXHoew QqqPpkMh73Bz7XKueAzR9MK+KFO7+Is= From: Sarah Morgensen Date: Sun, 19 Sep 2021 22:20:49 -0700 Message-Id: In-Reply-To: References: 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: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1632118048; 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:dkim-signature; bh=GZ5iPxFRLyQRvT+3cDSGw0gcN+tlNQkzqXDpVDuawZY=; b=i30AU44lPrUJo7tuQr2gQ0irZxp0XLVL0FHTbXpPx7S8KrtDW54kRuVP9rkdc7xr5DqUN3 r8IpW9Al4YxIzJqlBqqN2V82v+y4rZhWE50b606ssf8Ys3rMBSUntviSyh3hxLQXlnSq1S sKf1L9QR8BCZU9OkD6nteNAlB1FG0HTae0NVqhaFqLgsrnv3AH3FRQnX7UlOm+HLnjcOcv WteXQK2NgHCLI+JeTnDZwddy9u/DcyVp0j1HWqATbbBkhRDnJ3RIeILB0HBX0w743w6QAu YA2hBnkyiSGavzykBSC6hJKZr33yVPpgIffXaGsy96t8Nghcjror1ugbD8tGcg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1632118048; a=rsa-sha256; cv=none; b=o0aAmbdXSILKxu9kUsR3vy/ElIqy8Hr50YX/otgqwiONpBBFl+PqdaO7mkc2Pvv9VM1XzV Wtk0N0gM8NtdIIySJQKVgt2cL0dWmAljV7vn9fFDeSWlUJcIR8+EiYF3E5VomZt/0HeqnQ Lk4ZqjeUn0iSz+N7BhlQNDz1APPkVI5VkRGcZuVd3nui5LZgWqqAQmdfsqzs06o2BB1ls3 04UARGNVRxOYghzK1gHlfl02sfGgRkbJhXhRwTenkAlRYpKR9HPrr2oQJzCJdzP407P4Oa p/rGVGeETgL6D8wQk6yOj+b7iBERr9bMFHOm7XjLtu5Eh919r+WgYm69YnavRg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mgsn.dev header.s=key1 header.b=NCH4Wtlv; dmarc=fail reason="SPF not aligned (relaxed)" header.from=mgsn.dev (policy=none); spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Migadu-Spam-Score: 1.21 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mgsn.dev header.s=key1 header.b=NCH4Wtlv; dmarc=fail reason="SPF not aligned (relaxed)" header.from=mgsn.dev (policy=none); spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Migadu-Queue-Id: 438021A866 X-Spam-Score: 1.21 X-Migadu-Scanner: scn0.migadu.com X-TUID: /IN5AJT2POas * guix/build/go-build-system.com (setup-go-environment): Set GOCACHE to a location within the build directory. Union "/var/cache/go/build" input directories to initialize the cache. Generate "trim.txt" within the cache, with the current time. --- guix/build/go-build-system.scm | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/guix/build/go-build-system.scm b/guix/build/go-build-system.scm index 645d2fe680..9f249b0777 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, 2021 Efraim Flashner +;;; Copyright © 2021 Sarah Morgensen ;;; ;;; This file is part of GNU Guix. ;;; @@ -138,9 +139,28 @@ (define* (setup-go-environment #:key inputs outputs goos goarch #:allow-other-ke where executables (\"commands\") are installed to. This phase is sometimes used by packages that use (guix build-system gnu) but have a handful of Go dependencies, so it should be self-contained." - ;; The Go cache is required starting in Go 1.12. We don't actually use it but - ;; we need it to be a writable directory. - (setenv "GOCACHE" "/tmp/go-cache") + (define (search-input-directories dir) + (filter directory-exists? + (map (match-lambda + ((name . directory) + (string-append directory "/" dir))) + inputs))) + + ;; Seed the Go build cache with the build caches from input packages. + (let ((cache (string-append (getcwd) "/go-build"))) + (setenv "GOCACHE" cache) + (union-build cache + (search-input-directories "/var/cache/go/build") + ;; Creating all directories isn't that bad, because there are + ;; only ever 256 of them. + #:create-all-directories? #t + #:log-port (%make-void-port "w")) + + ;; Tell Go that the cache was recently trimmed, so it doesn't try to. + (call-with-output-file (string-append cache "/trim.txt") + (lambda (port) + (format port "~a" (current-time))))) + ;; Using the current working directory as GOPATH makes it easier for packagers ;; who need to manipulate the unpacked source code. (setenv "GOPATH" (getcwd)) -- 2.33.0