[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
20/169: build-system/go: Add subdir parameter to go-version->git-ref.
From: |
guix-commits |
Subject: |
20/169: build-system/go: Add subdir parameter to go-version->git-ref. |
Date: |
Thu, 26 Sep 2024 09:25:32 -0400 (EDT) |
sharlatan pushed a commit to branch go-team
in repository guix.
commit 9e7d7cf56101ef70bf4c2aa2b14f2bf93e105252
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
- 08/169: gnu: go-github-com-jaytaylor-html2text: Move to golang-web., (continued)
- 08/169: gnu: go-github-com-jaytaylor-html2text: Move to golang-web., guix-commits, 2024/09/26
- 10/169: gnu: go-github-com-operatorfoundation-monolith-go: Update to 1.0.10., guix-commits, 2024/09/26
- 12/169: gnu: Add go-github-com-deckarep-golang-set-v2., guix-commits, 2024/09/26
- 15/169: gnu: go-github-com-aws-aws-sdk-go-v2: Update to 1.30.5., guix-commits, 2024/09/26
- 09/169: gnu: Add go-html2text., guix-commits, 2024/09/26
- 13/169: gnu: Remove go-github-com-kyoh86-xdg., guix-commits, 2024/09/26
- 40/169: gnu: go-github-com-prometheus-common: Fix build., guix-commits, 2024/09/26
- 37/169: gnu: go-github-com-golang-groupcache: Fix build., guix-commits, 2024/09/26
- 27/169: gnu: go-golang-org-x-sys: Update to 0.25.0., guix-commits, 2024/09/26
- 25/169: gnu: go-golang-org-x-mod: Update to 0.21.0., guix-commits, 2024/09/26
- 20/169: build-system/go: Add subdir parameter to go-version->git-ref.,
guix-commits <=
- 21/169: import/go: Account for monorepo modules in the Go importer., guix-commits, 2024/09/26
- 43/169: gnu: go-github-com-prometheus-statsd-exporter: Fix build., guix-commits, 2024/09/26
- 39/169: gnu: go-github-com-dgraph-io-badger: Fix build., guix-commits, 2024/09/26
- 44/169: gnu: go-github-com-ipfs-go-ds-badger: Fix build., guix-commits, 2024/09/26
- 49/169: gnu: Add go-golang-org-x-telemetry-config., guix-commits, 2024/09/26
- 50/169: gnu: go-github-com-google-go-cmdtest: Update to 0.4.0., guix-commits, 2024/09/26
- 54/169: gnu: go-github-com-google-go-cmdtest: Move to golang-build., guix-commits, 2024/09/26
- 55/169: gnu: go-golang-org-x-vuln: Update to 1.1.3., guix-commits, 2024/09/26
- 56/169: gnu: go-golang-org-x-vuln: Move to golang-build., guix-commits, 2024/09/26
- 07/169: gnu: go-github-com-jaytaylor-html2text: Enable tests., guix-commits, 2024/09/26