GNU bug report logs - #74370
[PATCH 0/4] Module aware go build system, downloader

Previous Next

Package: guix-patches;

Reported by: Jørgen Kvalsvik <j <at> lambda.is>

Date: Fri, 15 Nov 2024 21:12:02 UTC

Severity: normal

Tags: patch

Merged with 74371, 74372, 74373

Done: Steve George <steve <at> futurile.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Steve George <steve <at> futurile.net>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#74371: closed ([PATCH 3/4] guix: Add module aware 'guix
 import go')
Date: Tue, 08 Apr 2025 13:51:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Tue, 8 Apr 2025 14:49:48 +0100
with message-id <Z_UpfF8epIVhnBam <at> t25sg>
and subject line Re: bug#74370: Module aware go build system (for Guix)
has caused the debbugs.gnu.org bug report #74370,
regarding [PATCH 3/4] guix: Add module aware 'guix import go'
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
74370: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=74370
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Jørgen Kvalsvik <j <at> lambda.is>
To: guix-patches <at> gnu.org
Cc: Jørgen Kvalsvik <j <at> lambda.is>
Subject: [PATCH 3/4] guix: Add module aware 'guix import go'
Date: Fri, 15 Nov 2024 22:11:05 +0100
Emit module aware package go packages.  It does not compute the hash of the
full module yet, and only supports git, but goes a long way towards making it
easy to package new go programs using the module-aware build system.

* guix/import/go.scm (go-module->guix-package): Add go.mod awareness
* guix/scripts/import/go.scm (show-help): Document -m, --mod
(%options): Accept them.

Change-Id: I4efd7260d69276279940e21698ecc7eb57232a67
---
 guix/import/go.scm         | 88 ++++++++++++++++++++++++--------------
 guix/scripts/import/go.scm |  6 +++
 2 files changed, 61 insertions(+), 33 deletions(-)

diff --git a/guix/import/go.scm b/guix/import/go.scm
index dd9298808d..967aa54d58 100644
--- a/guix/import/go.scm
+++ b/guix/import/go.scm
@@ -615,6 +615,7 @@ (define (validate-version version available-versions module-path)
 (define* (go-module->guix-package module-path #:key
                                   (goproxy "https://proxy.golang.org")
                                   version
+                                  go-mod?
                                   pin-versions?
                                   #:allow-other-keys)
   "Return the package S-expression corresponding to MODULE-PATH at VERSION, a Go package.
@@ -641,43 +642,62 @@ (define* (go-module->guix-package module-path #:key
          (meta-data (fetch-module-meta-data root-module-path))
          (vcs-type (module-meta-vcs meta-data))
          (vcs-repo-url (module-meta-data-repo-url meta-data goproxy))
+         (home-page (format #f "https://~a" root-module-path))
          (synopsis (go-package-synopsis module-path))
-         (description (go-package-description module-path))
-         (licenses (go-package-licenses module-path)))
-    (values
-     `(package
-        (name ,guix-name)
-        (version ,(strip-v-prefix version*))
-        (source
-         ,(vcs->origin vcs-type vcs-repo-url version*))
-        (build-system go-build-system)
-        (arguments
-         (list ,@(if (version>? min-go-version (package-version (go-package)))
-                     `(#:go ,(string->number min-go-version))
-                     '())
-               #:import-path ,module-path
-               ,@(if (string=? module-path-sans-suffix root-module-path)
-                     '()
-                     `(#:unpack-path ,root-module-path))))
-        ,@(maybe-propagated-inputs
-           (map (match-lambda
-                  ((name version)
-                   (go-module->guix-package-name name (strip-v-prefix version)))
-                  (name
-                   (go-module->guix-package-name name)))
-                dependencies))
-        (home-page ,(format #f "https://~a" root-module-path))
-        (synopsis ,synopsis)
-        (description ,(and=> description beautify-description))
-        (license ,(match (list->licenses licenses)
+         (description (and=> (go-package-description module-path) beautify-description))
+         (licenses (go-package-licenses module-path))
+         (license (match (list->licenses licenses)
                     (() #f)                       ;unknown license
-                    ((license)                    ;a single license
-                     license)
+                    ((license) license)           ;a single license
                     ((license ...)                ;a list of licenses
                      `(list ,@license)))))
-     (if pin-versions?
-         dependencies+versions
-         dependencies))))
+    (if go-mod?
+        (values
+         `(package
+            (name ,guix-name)
+            (version ,(strip-v-prefix version*))
+            (source
+             (origin
+               (method go-mod-fetch)
+               (uri (go-mod-reference
+                     (source ,(vcs->origin vcs-type vcs-repo-url version*))))
+               (sha256
+                (base32
+                 ;; FIXME: fetch & compute checksum
+                 "0000000000000000000000000000000000000000000000000000"))))
+             (build-system go-mod-build-system)
+             (home-page ,home-page)
+             (synopsis ,synopsis)
+             (description ,description)
+             (license ,license)))
+        (values
+         `(package
+            (name ,guix-name)
+            (version ,(strip-v-prefix version*))
+            (source ,(vcs->origin vcs-type vcs-repo-url version*))
+            (build-system go-build-system)
+         (arguments
+          (list ,@(if (version>? min-go-version (package-version (go-package)))
+                      `(#:go ,(string->number min-go-version))
+                      '())
+                #:import-path ,module-path
+                ,@(if (string=? module-path-sans-suffix root-module-path)
+                      '()
+                      `(#:unpack-path ,root-module-path))))
+         ,@(maybe-propagated-inputs
+            (map (match-lambda
+                   ((name version)
+                    (go-module->guix-package-name name (strip-v-prefix version)))
+                   (name
+                    (go-module->guix-package-name name)))
+                 dependencies))
+         (home-page ,home-page)
+         (synopsis ,synopsis)
+         (description ,description)
+         (license ,license)
+        (if pin-versions?
+            dependencies+versions
+            dependencies))))))
 
 (define go-module->guix-package*
   (lambda args
@@ -699,6 +719,7 @@ (define go-module->guix-package*
 (define* (go-module-recursive-import package-name
                                      #:key (goproxy "https://proxy.golang.org")
                                      version
+                                     go-mod?
                                      pin-versions?)
 
   (recursive-import
@@ -709,6 +730,7 @@ (define* (go-module-recursive-import package-name
       (receive (package-sexp dependencies)
           (go-module->guix-package* name #:goproxy goproxy
                                     #:version version
+                                    #:go-mod? go-mod?
                                     #:pin-versions? pin-versions?)
         (values package-sexp dependencies))))
    #:guix-name go-module->guix-package-name
diff --git a/guix/scripts/import/go.scm b/guix/scripts/import/go.scm
index b90c6ac72f..a12c3a9b2f 100644
--- a/guix/scripts/import/go.scm
+++ b/guix/scripts/import/go.scm
@@ -50,6 +50,8 @@ (define (show-help)
   (display (G_ "
   -h, --help             display this help and exit"))
   (display (G_ "
+  -m, --mod              generate go-module based packages"))
+  (display (G_ "
   -r, --recursive        generate package expressions for all Go modules
                          that are not yet in Guix"))
   (display (G_ "
@@ -65,6 +67,9 @@ (define %options
                  (lambda args
                    (show-help)
                    (exit 0)))
+         (option '(#\m "mod") #f #f
+                 (lambda (opt name arg result)
+                   (alist-cons 'go-mod? #t result)))
          (option '(#\r "recursive") #f #f
                  (lambda (opt name arg result)
                    (alist-cons 'recursive #t result)))
@@ -106,6 +111,7 @@ (define (parse-options)
            (let ((arguments (list name
                                   #:goproxy (assoc-ref opts 'goproxy)
                                   #:version version
+                                  #:go-mod?  (assoc-ref opts 'go-mod?)
                                   #:pin-versions?
                                   (assoc-ref opts 'pin-versions?))))
              (if (assoc-ref opts 'recursive)
-- 
2.39.5



[Message part 3 (message/rfc822, inline)]
From: Steve George <steve <at> futurile.net>
To: J??rgen Kvalsvik <j <at> lambda.is>, sharlatanus <at> gmail.com
Cc: 74370-done <at> debbugs.gnu.org
Subject: Re: bug#74370: Module aware go build system (for Guix)
Date: Tue, 8 Apr 2025 14:49:48 +0100
I think there's a common misunderstanding that if you comment on a bug it won't actually notify the submitter (you have to email NNNN-submitter). It's because debbugs was modelled on the idea that there's an "end-user" who's only interest is the initial submission and a final nnnn-done@ email to tell them it's all solved now!

OK, I'm closing #74370. Then you can create a new one when you submit you're new and improved one. Hopefully you and Sharlatan can collaborate on this!

Futurile / Steve

On  8 Apr, J??rgen Kvalsvik wrote:
> Hi,
> 
> I don't know what happened, but as you point out I never received
> Sharlatan's emails.
> 
> Anyways, there is still interest, but the approach I proposed is not great.
> I have since (re)written the module aware build system with much better
> results. I am currently adding a bunch of packages (for my own needs) in
> order to get some experience with it and sand down some rough edges, before
> I plan to resubmit the new build system upstream.
> 
> Thanks,
> J??rgen
> 
> On 4/8/25 15:03, Steve George wrote:
> > Hi J??rgen,
> > 
> > You submitted a module aware go build system, there were some queries about it from Sharlatan as there's been a range of attempts at improving this area. Just making you aware so you can reply if you're still interested:
> > 
> > https://debbugs.gnu.org/cgi/bugreport.cgi?bug=74370
> > https://debbugs.gnu.org/cgi/bugreport.cgi?bug=74374
> > 
> > I don't think you were notified as responses have to go to NNNN-submitter for the original reporter to be send the email.
> > 
> > Thanks,
> > 
> > Futurile / Steve
> > 
> > 
> 


This bug report was last modified 44 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.