[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
20/172: build-system/go: Add subdir parameter to go-version->git-ref.
From: |
guix-commits |
Subject: |
20/172: build-system/go: Add subdir parameter to go-version->git-ref. |
Date: |
Sat, 9 Nov 2024 16:44:47 -0500 (EST) |
sharlatan pushed a commit to branch master
in repository guix.
commit 18a77fb3f85423e351a99a916ec023024adfc49c
Author: Christina O'Donnell <cdo@mutix.org>
AuthorDate: Sat Mar 16 10:26:05 2024 +0000
build-system/go: Add subdir parameter to go-version->git-ref.
This implements logic to handle cases where Go can have multiple modules
at different versions within a single repository. It distinguishes their
releases by using tags along with their subdirectories. See
https://go.dev/ref/mod#vcs-version.
* guix/build-system/go.scm (go-version->git-ref): Add <#:subdir> keyword
parameter and extend condition checks.
Change-Id: I68bc9e785e49877bb0b756de8458308549f4c957
Co-authored-by: Sharlatan Hellseher <sharlatanus@gmail.com>
Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
---
guix/build-system/go.scm | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/guix/build-system/go.scm b/guix/build-system/go.scm
index f4231df4ec..e39502991b 100644
--- a/guix/build-system/go.scm
+++ b/guix/build-system/go.scm
@@ -58,11 +58,13 @@
"([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
<https://golang.org/ref/mod#pseudo-versions>, 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."
+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; when VERSION misses 'v' prefix use SUBDIR/v instead."
;; 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
@@ -80,7 +82,13 @@ present) if a pseudo-version pattern is not recognized."
(match (regexp-exec %go-pseudo-version-rx version)))
(if match
(match:substring match 2)
- version)))
+ (cond
+ ((and subdir (string-prefix? "v" version))
+ (string-append subdir "/" version))
+ ((and subdir (not (string-prefix? "v" version)))
+ (string-append subdir "/v" version))
+ (else
+ version)))))
(define (go-pseudo-version? version)
"True if VERSION is a Go pseudo-version, i.e., a version string made of a
- 01/172: gnu: go-github-com-lithammer-fuzzysearch: Enable tests., (continued)
- 01/172: gnu: go-github-com-lithammer-fuzzysearch: Enable tests., guix-commits, 2024/11/09
- 03/172: gnu: Remove go-github-com-niemeyer-pretty., guix-commits, 2024/11/09
- 04/172: gnu: go-github-com-jhillyerd-enmime: Update to 1.3.0., guix-commits, 2024/11/09
- 06/172: gnu: go-github-com-jaytaylor-html2text: Update to 0.0.0-20230321000545-74c2419ad056., guix-commits, 2024/11/09
- 13/172: gnu: Remove go-github-com-kyoh86-xdg., guix-commits, 2024/11/09
- 14/172: gnu: Remove go-github-com-rylans-getlang., guix-commits, 2024/11/09
- 11/172: gnu: go-github-com-deckarep-golang-set: Move to golang-xyz., guix-commits, 2024/11/09
- 16/172: import/go: Add comment about monorepo., guix-commits, 2024/11/09
- 18/172: gnu: go-1.23: Update to 1.23.1., guix-commits, 2024/11/09
- 19/172: gnu: go-1.20: Build with gccgo-12 on some systems., guix-commits, 2024/11/09
- 20/172: build-system/go: Add subdir parameter to go-version->git-ref.,
guix-commits <=
- 21/172: import/go: Account for monorepo modules in the Go importer., guix-commits, 2024/11/09
- 36/172: gnu: go-github-com-golang-groupcache: Fix indentation., guix-commits, 2024/11/09
- 29/172: gnu: go-golang-org-x-text: Update to 0.18.0., guix-commits, 2024/11/09
- 23/172: gnu: packages/golang-crypto: Apply #:subdir parameter., guix-commits, 2024/11/09
- 31/172: gnu: go-golang-org-x-xerrors: Fix indentation., guix-commits, 2024/11/09
- 24/172: gnu: go-golang-org-x-image: Update to 0.20.0., guix-commits, 2024/11/09
- 38/172: gnu: go-github-com-libp2p-go-msgio: Fix build., guix-commits, 2024/11/09
- 25/172: gnu: go-golang-org-x-mod: Update to 0.21.0., guix-commits, 2024/11/09
- 42/172: gnu: go-github-com-prometheus-exporter-toolkit: Fix build., guix-commits, 2024/11/09
- 46/172: gnu: kubo: Fix build., guix-commits, 2024/11/09