From patchwork Sat Mar 16 10:26:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christina O'Donnell X-Patchwork-Id: 61867 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 DF40E27BBEC; Sat, 16 Mar 2024 10:27:33 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham 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 3204927BBEA for ; Sat, 16 Mar 2024 10:27:33 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rlRGB-0000RR-Tm; Sat, 16 Mar 2024 06:27:27 -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 1rlRG9-0000Qz-PJ for guix-patches@gnu.org; Sat, 16 Mar 2024 06:27:25 -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 1rlRG9-0000mB-Gy for guix-patches@gnu.org; Sat, 16 Mar 2024 06:27:25 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rlRGk-0005mL-8h; Sat, 16 Mar 2024 06:28:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#69827] [PATCH 1/3] build-system/go: Add subdir parameter to go-version->git-ref. Resent-From: Christina O'Donnell Original-Sender: "Debbugs-submit" Resent-CC: cox.katherine.e+guix@gmail.com, sharlatanus@gmail.com, guix-patches@gnu.org Resent-Date: Sat, 16 Mar 2024 10:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 69827 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69827@debbugs.gnu.org Cc: Christina O'Donnell , 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.171058487922200 (code B ref -1); Sat, 16 Mar 2024 10:28:02 +0000 Received: (at submit) by debbugs.gnu.org; 16 Mar 2024 10:27:59 +0000 Received: from localhost ([127.0.0.1]:54861 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rlRGh-0005m0-3P for submit@debbugs.gnu.org; Sat, 16 Mar 2024 06:27:59 -0400 Received: from lists.gnu.org ([209.51.188.17]:32786) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rlRGe-0005lq-RK for submit@debbugs.gnu.org; Sat, 16 Mar 2024 06:27:57 -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 1rlRG3-0000Qb-Co for guix-patches@gnu.org; Sat, 16 Mar 2024 06:27:19 -0400 Received: from vmi993448.contaboserver.net ([194.163.141.236] helo=mutix.org) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rlRG1-0000lX-JV for guix-patches@gnu.org; Sat, 16 Mar 2024 06:27:19 -0400 Received: from [86.132.246.87] (host81-147-82-218.range81-147.btcentralplus.com [81.147.82.218]) (Authenticated sender: cdo) by mutix.org (Postfix) with ESMTPSA id A7C7FA63582; Sat, 16 Mar 2024 11:27:11 +0100 (CET) From: Christina O'Donnell Date: Sat, 16 Mar 2024 10:26:05 +0000 Message-ID: X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Received-SPF: pass client-ip=194.163.141.236; envelope-from=cdo@mutix.org; helo=mutix.org X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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-system/go.scm (go-version->git-ref): Add subdir keyword parameter. This is needed because Go can have mutliple modules at different versions in a single repo. It distinguishes their releases by using tags with their subdirectory. See https://go.dev/ref/mod#vcs-version. Change-Id: I68bc9e785e49877bb0b756de8458308549f4c957 --- guix/build-system/go.scm | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) base-commit: efc0ee1d7f2b704d3fc0c8aea0ef0ad1ac2972e1 diff --git a/guix/build-system/go.scm b/guix/build-system/go.scm index 0934fded07..94c5439dd1 100644 --- a/guix/build-system/go.scm +++ b/guix/build-system/go.scm @@ -56,11 +56,12 @@ (define %go-pseudo-version-rx "([0-9A-Fa-f]{12})" ;commit hash "(\\+incompatible)?$"))) ;optional +incompatible tag -(define (go-version->git-ref version) +(define* (go-version->git-ref version #:key subdir) "Parse VERSION, a \"pseudo-version\" as defined at -, and extract the commit hash from -it, defaulting to full VERSION (stripped from the \"+incompatible\" suffix if -present) if a pseudo-version pattern is not recognized." +, and extract the commit hash from it, +defaulting to full VERSION (stripped from the \"+incompatible\" suffix if present) if +a pseudo-version pattern is not recognized. If SUBDIR is specified and this is not a +pseudo-version, then this will prefix SUBDIR/ to the returned tag." ;; A module version like v1.2.3 is introduced by tagging a revision in the ;; underlying source repository. Untagged revisions can be referred to ;; using a "pseudo-version" like v0.0.0-yyyymmddhhmmss-abcdefabcdef, where @@ -78,7 +79,9 @@ (define (go-version->git-ref version) (match (regexp-exec %go-pseudo-version-rx version))) (if match (match:substring match 2) - version))) + (if subdir + (string-append subdir "/" version) + version)))) (define (go-pseudo-version? version) "True if VERSION is a Go pseudo-version, i.e., a version string made of a