all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#69827] [PATCH 1/3] build-system/go: Add subdir parameter to go-version->git-ref.
@ 2024-03-16 10:26 Christina O'Donnell
  2024-03-16 10:30 ` [bug#69827] [PATCH 2/3] import/go: Account for monorepo modules in the Go importer Christina O'Donnell
                   ` (7 more replies)
  0 siblings, 8 replies; 10+ messages in thread
From: Christina O'Donnell @ 2024-03-16 10:26 UTC (permalink / raw)
  To: 69827; +Cc: Christina O'Donnell, Katherine Cox-Buday, Sharlatan Hellseher

* 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(-)

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
-<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."
+<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.  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

base-commit: efc0ee1d7f2b704d3fc0c8aea0ef0ad1ac2972e1
-- 
2.41.0





^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-09-15 20:42 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-16 10:26 [bug#69827] [PATCH 1/3] build-system/go: Add subdir parameter to go-version->git-ref Christina O'Donnell
2024-03-16 10:30 ` [bug#69827] [PATCH 2/3] import/go: Account for monorepo modules in the Go importer Christina O'Donnell
2024-03-16 10:30 ` [bug#69827] [PATCH 3/3] import/go: Add diagnostics Christina O'Donnell
2024-03-16 10:45 ` [bug#69827] Fixing the go importer so that it can import modules located in a monorepo Christina O'Donnell
2024-04-16 19:05 ` [bug#69827] [PATCH 1/3] build-system/go: Add subdir parameter to go-version->git-ref Sharlatan Hellseher
2024-05-11 12:04 ` Christina O'Donnell
2024-09-04 19:18 ` Sharlatan Hellseher
2024-09-07 14:28 ` Sharlatan Hellseher
2024-09-10 12:21   ` Simon Tournier
2024-09-15 20:40 ` bug#69827: " Sharlatan Hellseher

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.