From patchwork Mon Sep 16 15:38:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Efraim Flashner X-Patchwork-Id: 67987 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 A5C6127BBE9; Mon, 16 Sep 2024 16:41:08 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 19B3A27BBE2 for ; Mon, 16 Sep 2024 16:41:07 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sqDqN-0008TP-Oh; Mon, 16 Sep 2024 11:40:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sqDqL-0008Sl-Ky for guix-patches@gnu.org; Mon, 16 Sep 2024 11:40:49 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sqDqL-0007me-CE for guix-patches@gnu.org; Mon, 16 Sep 2024 11:40:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:Subject; bh=L7ycULewj21LLIB8ON1fukN/NdADpbRliXnmwMwasDY=; b=tdLQ44iqU042eUGHNW9Op7Bw8/TC3Ei1GrCBrphX6ACmRYYQMxyI481szaApHF7OtUxsXeXgRjRXwdtVVtDEKOfMokHB6l+SohfnB4eOR+uxepUUVhbEQsR+bNyHIINyL62LlOcTLRjwo1VICm6/Io5rYVq3c5FrRf3Pd3RtVrQaULZHFHyK/z5BxafIQVAhjOB3rsb20u5tUsyW0tb1YTzHgNL31fYwavZ0NwMBamjXjAUQSqTIXhxUwGH1iFb/x8LsqC1pziQV0RrWbFbkPuVNF4cNgdbY3B9e7m8NH7vAgDN5660ygG2nF4NpUuiVtpxvvFT0f+20izua0Vj0VA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sqDqY-0007Tt-OX; Mon, 16 Sep 2024 11:41:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#73299] [PATCH] build/go: Replace symlinks with a copy of the file. Resent-From: Efraim Flashner Original-Sender: "Debbugs-submit" Resent-CC: cox.katherine.e+guix@gmail.com, sharlatanus@gmail.com, guix-patches@gnu.org Resent-Date: Mon, 16 Sep 2024 15:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 73299 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 73299@debbugs.gnu.org Cc: Sharlatan Hellseher , Efraim Flashner , Katherine Cox-Buday , Sharlatan Hellseher X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: Katherine Cox-Buday , Sharlatan Hellseher Received: via spool by submit@debbugs.gnu.org id=B.172650120928190 (code B ref -1); Mon, 16 Sep 2024 15:41:02 +0000 Received: (at submit) by debbugs.gnu.org; 16 Sep 2024 15:40:09 +0000 Received: from localhost ([127.0.0.1]:53089 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sqDph-0007Kb-8O for submit@debbugs.gnu.org; Mon, 16 Sep 2024 11:40:09 -0400 Received: from lists.gnu.org ([209.51.188.17]:54554) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sqDpf-0007KR-20 for submit@debbugs.gnu.org; Mon, 16 Sep 2024 11:40:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sqDpR-0007Oj-9r for guix-patches@gnu.org; Mon, 16 Sep 2024 11:39:53 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sqDpO-0007Sr-SP for guix-patches@gnu.org; Mon, 16 Sep 2024 11:39:52 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-42ca4e0299eso35677985e9.2 for ; Mon, 16 Sep 2024 08:39:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726501188; x=1727105988; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:sender:from:to:cc:subject:date:message-id:reply-to; bh=L7ycULewj21LLIB8ON1fukN/NdADpbRliXnmwMwasDY=; b=RvELhoRu6L/uGuwrqQ8SyBpJTZtJyPCChDonP0mFuHVXckcXurIdL3IVIMZHI0pMrV 0L2b4/yCLbVJWaSM31EEIvKJxHaMOssnB5iAGoM1Xg4d7lQqhKzVFptBqpbdluciCZPt GVTc4V5iKr2eVYddsL9EUxewk4qAAiukEj0DynT1m3Q3VvTE8qulTlZu+Qo1d2yM8uTl x64WjTBUCSA1GCKYh0YDAEF7VXtOr6dRg7nhZA3eOjwJZW8FO7olvQmVFHxI/Qrb/LSa sb+RKKgSijFGVGeFBFWlDSza9sg+zAFkX8gOhSduKQp+1s1WEt6FGG7ekH00XOQnoMBD 5rIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726501188; x=1727105988; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:sender:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=L7ycULewj21LLIB8ON1fukN/NdADpbRliXnmwMwasDY=; b=F79NGQomUkhzyYTphee6ue9czS0UrpAfgxHcO9pH9fIx1V8VJRWvG0OpPjGGCA+OI4 r0WZH+UUvKXQnzMh3JMyiUDBnvzwMK73tyZgfj9xU9tj98sS0jkzxosKwq9FYllzkLQd gMxcEqhlfyX9G14b1MtEsStXIrT4zsZafdee4rgqoE/5kETyEZ8m87fRfmemaL7DKMvD kAfNLnVe7k96fDiki7u6OtZtr7IWP9SbaWiOtpUhzfhGrTX4pvFTLNPkQsI0yzqVAMtf J8NmeHwdmX5D2NhvE6pnKSCNXScw20kkt5+YKD/z3HMBveFEIOWmjgvYGjJo5umPmLlE +Oig== X-Gm-Message-State: AOJu0YxpMvk+pcSqx96FG5KD/NQJpHgttKsmtM9nTLNsE13N5dmdviVy sN4pIq5pGNgPwQOmYzP/gzs2cn1f+2qiRPKeu4RTU1cPB3mX3qHlLgPxhmZu X-Google-Smtp-Source: AGHT+IEwBazEgTnUj17k2JxkWHNWsLlGOtv33FEuYB6pc4iVPMXiI/1TdWXIzHXubFyJYsZ5+Cti8w== X-Received: by 2002:adf:b30e:0:b0:374:c3e4:d6c5 with SMTP id ffacd0b85a97d-378c2d59673mr7566151f8f.57.1726501187383; Mon, 16 Sep 2024 08:39:47 -0700 (PDT) Received: from localhost ([141.226.162.35]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-378e71f068esm7585470f8f.3.2024.09.16.08.39.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Sep 2024 08:39:46 -0700 (PDT) From: Efraim Flashner Date: Mon, 16 Sep 2024 18:38:46 +0300 Message-ID: X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=efraim.flashner@gmail.com; helo=mail-wm1-x32e.google.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * guix/build/go-build-system.scm (fix-embed-files): New procedure. (%standard-phases): Add 'fix-embed-files after 'unpack. Co-authored-by: Sharlatan Hellseher Change-Id: I27bc46fa1a3f4675ff73b6cba4ef5c3d177c22b1 --- I saw this pattern coming up a couple of times in the go-team branch so I figured I could factor it out, as the comment said. I figure later we can adjust it to match other symlinked files. guix/build/go-build-system.scm | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) base-commit: 0091fa2cc2ac2104d7945b585e4eaec908ca742f diff --git a/guix/build/go-build-system.scm b/guix/build/go-build-system.scm index 3f0f5700a1e..c953976b485 100644 --- a/guix/build/go-build-system.scm +++ b/guix/build/go-build-system.scm @@ -4,10 +4,11 @@ ;;; Copyright © 2019 Maxim Cournoyer ;;; Copyright © 2020 Jack Hill ;;; Copyright © 2020 Jakub Kądziołka -;;; Copyright © 2020, 2021, 2023 Efraim Flashner +;;; Copyright © 2020, 2021, 2023, 2024 Efraim Flashner ;;; Copyright © 2021 Sarah Morgensen ;;; Copyright © 2024 Ekaitz Zarraga ;;; Copyright © 2024 Picnoir +;;; Copyright © 2024 Sharlatan Hellseher ;;; ;;; This file is part of GNU Guix. ;;; @@ -201,6 +202,23 @@ (define* (setup-go-environment #:key inputs outputs goos goarch #:allow-other-ke (delete-file-recursively tmpdir)) #t) +(define* (fix-embed-files #:rest args) + "Golang can't determine the valid directory of the module of embed file +which is symlinked during setup environment phase, but easy resolved after +coping file from the store to the build directory of the current package." +;; see details in Golang source: +;; +;; - URL: +;; - commit: 82c14346d89ec0eeca114f9ca0e88516b2cda454 +;; - file: src/cmd/go/internal/load/pkg.go#L2059 + (for-each (lambda (file) + (when (eq? (stat:type (lstat file)) + 'symlink) + (let ((file-store-path (readlink file))) + (delete-file file) + (copy-recursively file-store-path file)))) + (find-files "src" ".*(editions_defaults.binpb)$"))) + (define* (unpack #:key source import-path unpack-path #:allow-other-keys) "Relative to $GOPATH, unpack SOURCE in UNPACK-PATH, or IMPORT-PATH when UNPACK-PATH is unset. If the SOURCE archive has a single top level directory, @@ -321,6 +339,7 @@ (define %standard-phases (delete 'patch-generated-file-shebangs) (add-before 'unpack 'setup-go-environment setup-go-environment) (replace 'unpack unpack) + (add-after 'unpack 'fix-embed-files fix-embed-files) (replace 'build build) (replace 'check check) (replace 'install install)