GNU bug report logs - #70923
[PATCH 00/13] Add (guix import utils) procedures.

Previous Next

Package: guix-patches;

Reported by: Herman Rimm <herman <at> rimm.ee>

Date: Mon, 13 May 2024 20:00:02 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 70923 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Mon, 13 May 2024 20:00:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Herman Rimm <herman <at> rimm.ee>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Mon, 13 May 2024 20:00:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: guix-patches <at> gnu.org
Subject: [PATCH 00/13] Add (guix import utils) procedures.
Date: Mon, 13 May 2024 21:59:13 +0200
Hello,

All but one importers (cran) now use procedures from (guix import utils)
to create the package inputs and arguments fields.  I also made the
cargo build-system compatible with the new style of inputs.

[PATCH 02/13] and [PATCH 03/13] are based on commits from [bug#49531]
which were merged into the core-updates branch in January: [1] and [2]
respectively.  The series is based on the master branch because I do not
think emitting and parsing the new style of cargo inputs is a major
change.  I can prepare a patch series for core-updates based on [1] if
needed though.

For once I remove more lines of code than I add, yay!

Cheers,
Herman

[1]: 49a85411b2af0e324e3b70839acea2720e855b32
[2]: 71ef0d2216890c29cb77c7b3e2af4ce3b629d7b8

Herman Rimm (10):
  build-system: cargo: Accept unlabeled #:cargo-inputs.
  tests: elm: Adjust to new-style package inputs.
  import: utils: Add 'maybe-upstream-inputs' procedure.
  import: pypi: Use 'maybe-list-field' procedure.
  import: elpa: Use maybe-propagated-inputs procedure.
  import: hackage: Use 'maybe-list-field' procedure.
  import: cran: Use 'maybe-list-field' procedure.
  import: cpan: Use 'maybe-upstream-inputs' procedure.
  import: egg: Use maybe-*inputs procedures.
  import: hexpm: Use (guix import utils) 'maybe-inputs' procedure.

Sarah Morgensen (3):
  import: utils: Emit new-style package inputs.
  tests: go: Adjust to new-style package inputs.
  import: crate: Emit new-style package inputs.

 guix/build-system/cargo.scm |  12 +++-
 guix/import/cpan.scm        |  22 ++-----
 guix/import/cran.scm        |  35 +++++------
 guix/import/crate.scm       |  54 ++++++----------
 guix/import/egg.scm         |  38 +++---------
 guix/import/elpa.scm        |   9 +--
 guix/import/hackage.scm     |  38 ++++--------
 guix/import/hexpm.scm       |  20 ++----
 guix/import/pypi.scm        |  20 ++----
 guix/import/utils.scm       |  67 ++++++++++++--------
 tests/crate.scm             | 119 +++++++++++++++---------------------
 tests/elm.scm               |   4 +-
 tests/go.scm                |   2 +-
 tests/hackage.scm           |  13 ++--
 14 files changed, 182 insertions(+), 271 deletions(-)


base-commit: 2793a79117d244b9e8fd48a8c3477f33f425210a
-- 
2.41.0





Information forwarded to efraim <at> flashner.co.il, guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Mon, 13 May 2024 20:09:02 GMT) Full text and rfc822 format available.

Message #8 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Subject: [PATCH 01/13] build-system: cargo: Accept unlabeled #:cargo-inputs.
Date: Mon, 13 May 2024 22:07:58 +0200
* guix/build-system/cargo.scm (crate-closure): Match unlabeled inputs.

Change-Id: Iae421281fa08d09ddd1e5d2da2864f0093d97cd1
---
 guix/build-system/cargo.scm | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/guix/build-system/cargo.scm b/guix/build-system/cargo.scm
index c029cc1dda..a918e25e7a 100644
--- a/guix/build-system/cargo.scm
+++ b/guix/build-system/cargo.scm
@@ -234,7 +234,17 @@ (define (crate-closure inputs)
        (if (null? propagated)
            (reverse result)
            (loop (reverse (concatenate propagated)) result '() #f seen)))
-      (((and input (label (? package? package))) rest ...)
+      (((? package? package) rest ...)
+       (if (and (not first?) (seen? seen package))
+           (loop rest result propagated first? seen)
+           (loop rest
+                 (cons (list (package-name package) package) result)
+                 (cons (package-cargo-inputs package)
+                       propagated)
+                 first?
+                 (vhash-consq package package seen))))
+      ;; Match inputs with explicit labels for backward compatibility.
+      (((and input (_ (? package? package))) rest ...)
        (if (and (not first?) (seen? seen package))
            (loop rest result propagated first? seen)
            (loop rest
-- 
2.41.0





Information forwarded to guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Mon, 13 May 2024 20:09:02 GMT) Full text and rfc822 format available.

Message #11 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Cc: Sarah Morgensen <iskarian <at> mgsn.dev>
Subject: [PATCH 02/13] import: utils: Emit new-style package inputs.
Date: Mon, 13 May 2024 22:07:59 +0200
From: Sarah Morgensen <iskarian <at> mgsn.dev>

* guix/import/utils.scm (package-names->package-inputs)[make-input]:
Return new-style package inputs.
(maybe-list-field): Add procedure, which wraps BODY in 'list' instead of
'quasiquote'.
(maybe-packages-field): Add procedure.
(maybe-inputs): Use maybe-packages-field.
(maybe-native-inputs): Use maybe-packages-field.
(maybe-propagated-inputs): Use maybe-packages-field.

Change-Id: I66588f4c822d507ddbaf465a268bfb71af8a7ecd
---
 guix/import/utils.scm | 58 ++++++++++++++++++++++++-------------------
 1 file changed, 33 insertions(+), 25 deletions(-)

diff --git a/guix/import/utils.scm b/guix/import/utils.scm
index 09a01cf315..1bbab916c4 100644
--- a/guix/import/utils.scm
+++ b/guix/import/utils.scm
@@ -13,6 +13,7 @@
 ;;; Copyright © 2022 Alice Brenon <alice.brenon <at> ens-lyon.fr>
 ;;; Copyright © 2022 Kyle Meyer <kyle <at> kyleam.com>
 ;;; Copyright © 2022 Philip McGrath <philip <at> philipmcgrath.com>
+;;; Copyright © 2024 Herman Rimm <herman <at> rimm.ee>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -65,6 +66,8 @@ (define-module (guix import utils)
             guix-hash-url
 
             package-names->package-inputs
+            maybe-list-field
+            maybe-packages-field
             maybe-inputs
             maybe-native-inputs
             maybe-propagated-inputs
@@ -409,41 +412,46 @@ (define* (package-names->package-inputs names #:optional (output #f))
 optional OUTPUT, tries to generate a quoted list of inputs, as suitable to
 use in an 'inputs' field of a package definition."
   (define (make-input input version)
-    (cons* input (list 'unquote (string->symbol
-                                 (if version
-                                     (string-append input "-" version)
-                                     input)))
-           (or (and output (list output))
-               '())))
+    (let ((symbol (string->symbol
+                    (if version
+                        (string-append input "-" version)
+                        input))))
+      (if output
+          (list symbol output)
+          symbol)))
 
   (map (match-lambda
          ((input version) (make-input input version))
          (input (make-input input #f)))
        names))
 
-(define* (maybe-inputs package-names #:optional (output #f)
-                       #:key (type #f))
-  "Given a list of PACKAGE-NAMES, tries to generate the 'inputs' field of a
-package definition.  TYPE can be used to specify the type of the inputs;
-either the 'native or 'propagated symbols are accepted.  Left unspecified, the
-snippet generated is for regular inputs."
-  (let ((field-name (match type
-                      ('native 'native-inputs)
-                      ('propagated 'propagated-inputs)
-                      (_ 'inputs))))
-    (match (package-names->package-inputs package-names output)
-      (()
-       '())
-      ((package-inputs ...)
-       `((,field-name (,'quasiquote ,package-inputs)))))))
+(define* (maybe-list-field type body)
+  "Generates the TYPE field of a package definition if its value, BODY,
+is a non-empty list."
+  (match body
+    (()
+     '())
+    ((? list?)
+     (list (list type (cons 'list body))))))
+
+(define* (maybe-packages-field type package-names
+                               #:optional (output #f))
+  "Given a list of PACKAGE-NAMES, tries to generate the TYPE field of a
+package definition."
+  (maybe-list-field type
+    (package-names->package-inputs package-names output)))
+
+(define* (maybe-inputs package-names #:optional (output #f))
+  "MAYBE-PACKAGES-FIELD for inputs."
+  (maybe-packages-field 'inputs package-names output))
 
 (define* (maybe-native-inputs package-names #:optional (output #f))
-  "Same as MAYBE-INPUTS, but for native inputs."
-  (maybe-inputs package-names output #:type 'native))
+  "MAYBE-PACKAGES-FIELD for native inputs."
+  (maybe-packages-field 'native-inputs package-names output))
 
 (define* (maybe-propagated-inputs package-names #:optional (output #f))
-  "Same as MAYBE-INPUTS, but for propagated inputs."
-  (maybe-inputs package-names output #:type 'propagated))
+  "MAYBE-PACKAGES-FIELD for propagated inputs."
+  (maybe-packages-field 'propagated-inputs package-names output))
 
 (define* (package->definition guix-package #:optional append-version?/string)
   "If APPEND-VERSION?/STRING is #t, append the package's major+minor version.
-- 
2.41.0





Information forwarded to cox.katherine.e+guix <at> gmail.com, sharlatanus <at> gmail.com, guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Mon, 13 May 2024 20:09:03 GMT) Full text and rfc822 format available.

Message #14 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Cc: Sarah Morgensen <iskarian <at> mgsn.dev>
Subject: [PATCH 03/13] tests: go: Adjust to new-style package inputs.
Date: Mon, 13 May 2024 22:08:00 +0200
From: Sarah Morgensen <iskarian <at> mgsn.dev>

* tests/go.scm ("go-module->guix-package"): Use new-style for
propagated-inputs.

Change-Id: Id6341bfb2d92c7f1d7fb85e46d38748584e5fabe
---
 tests/go.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/go.scm b/tests/go.scm
index d2e8846b30..f925c485c1 100644
--- a/tests/go.scm
+++ b/tests/go.scm
@@ -389,7 +389,7 @@ (define (mock-http-get testcase)
      (arguments
       (list #:import-path "github.com/go-check/check"))
      (propagated-inputs
-      `(("go-github-com-kr-pretty" ,go-github-com-kr-pretty)))
+      (list go-github-com-kr-pretty))
      (home-page "https://github.com/go-check/check")
      (synopsis "Instructions")
      (description "Package check is a rich testing extension for Go's testing \
-- 
2.41.0





Information forwarded to guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Mon, 13 May 2024 20:09:03 GMT) Full text and rfc822 format available.

Message #17 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Subject: [PATCH 04/13] tests: elm: Adjust to new-style package inputs.
Date: Mon, 13 May 2024 22:08:01 +0200
* tests/elm.scm ("elm-recursive-import \"elm-guix/demo\""): Use
the new-style for inputs and propagated-inputs.

Change-Id: Iae05b5e9f9b6a73cb2d08bb3b0f73df9004f83ac
---
 tests/elm.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/elm.scm b/tests/elm.scm
index c30623da03..2cdeab96fb 100644
--- a/tests/elm.scm
+++ b/tests/elm.scm
@@ -250,9 +250,9 @@ (define (directory-sha256 directory)
                          (base32 ,(? string? hash))))
                 (build-system elm-build-system)
                 (propagated-inputs
-                 ,'`(("elm-core" ,elm-core)))
+                 (list elm-core))
                 (inputs
-                 ,'`(("elm-json" ,elm-json)))
+                 (list elm-json))
                 (home-page
                  "https://package.elm-lang.org/packages/elm-guix/demo/3.0.0")
                 (synopsis "A test for `(guix import elm)`")
-- 
2.41.0





Information forwarded to guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Mon, 13 May 2024 20:09:04 GMT) Full text and rfc822 format available.

Message #20 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Subject: [PATCH 06/13] import: utils: Add 'maybe-upstream-inputs' procedure.
Date: Mon, 13 May 2024 22:08:03 +0200
* guix/import/utils.scm (maybe-upstream-inputs): Add procedure.

Change-Id: Ib8a80216d512c0373e55e4f27e1ef2a7c1fb854a
---
 guix/import/utils.scm | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/guix/import/utils.scm b/guix/import/utils.scm
index 1bbab916c4..98080dd0a0 100644
--- a/guix/import/utils.scm
+++ b/guix/import/utils.scm
@@ -45,6 +45,7 @@ (define-module (guix import utils)
   #:use-module (guix download)
   #:use-module (guix sets)
   #:use-module ((guix ui) #:select (fill-paragraph))
+  #:use-module (guix upstream)
   #:use-module (gnu packages)
   #:autoload   (ice-9 control) (let/ec)
   #:use-module (ice-9 match)
@@ -71,6 +72,7 @@ (define-module (guix import utils)
             maybe-inputs
             maybe-native-inputs
             maybe-propagated-inputs
+            maybe-upstream-inputs
             package->definition
 
             spdx-string->license
@@ -453,6 +455,13 @@ (define* (maybe-propagated-inputs package-names #:optional (output #f))
   "MAYBE-PACKAGES-FIELD for propagated inputs."
   (maybe-packages-field 'propagated-inputs package-names output))
 
+(define* (maybe-upstream-inputs type upstream-inputs)
+  "Given a list of UPSTREAM-NAMES, tries to generate the TYPE field of a
+package definition."
+  (maybe-list-field type
+    (map (compose string->symbol upstream-input-downstream-name)
+         upstream-inputs)))
+
 (define* (package->definition guix-package #:optional append-version?/string)
   "If APPEND-VERSION?/STRING is #t, append the package's major+minor version.
 If it is the symbol 'full, append the package's complete version.  If
-- 
2.41.0





Information forwarded to efraim <at> flashner.co.il, guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Mon, 13 May 2024 20:09:04 GMT) Full text and rfc822 format available.

Message #23 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Cc: Sarah Morgensen <iskarian <at> mgsn.dev>
Subject: [PATCH 05/13] import: crate: Emit new-style package inputs.
Date: Mon, 13 May 2024 22:08:02 +0200
From: Sarah Morgensen <iskarian <at> mgsn.dev>

* guix/import/crate.scm (maybe-cargo-inputs,
maybe-cargo-development-inputs, maybe-arguments): Delete procedures.
(make-crate-sexp): Add 'unwrap' procedure, use with maybe-packages-field
and fix indentation.
* tests/crate.scm: Adjust accordingly.

Change-Id: Ie8debd2553a338c3c623162b843e0a9827314074
---
 guix/import/crate.scm |  54 +++++++------------
 tests/crate.scm       | 119 +++++++++++++++++-------------------------
 2 files changed, 68 insertions(+), 105 deletions(-)

diff --git a/guix/import/crate.scm b/guix/import/crate.scm
index 7a25b2243c..760c5f0de4 100644
--- a/guix/import/crate.scm
+++ b/guix/import/crate.scm
@@ -7,6 +7,8 @@
 ;;; Copyright © 2023 Simon Tournier <zimon.toutoune <at> gmail.com>
 ;;; Copyright © 2023, 2024 Efraim Flashner <efraim <at> flashner.co.il>
 ;;; Copyright © 2023, 2024 David Elsing <david.elsing <at> posteo.net>
+;;; Copyright © 2021 Sarah Morgensen <iskarian <at> mgsn.dev>
+;;; Copyright © 2024 Herman Rimm <herman <at> rimm.ee>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -141,27 +143,6 @@ (define (crate-version-dependencies version)
 ;;; Converting crates to Guix packages.
 ;;;
 
-(define (maybe-cargo-inputs package-names)
-  (match (package-names->package-inputs package-names)
-    (()
-     '())
-    ((package-inputs ...)
-     `(#:cargo-inputs ,package-inputs))))
-
-(define (maybe-cargo-development-inputs package-names)
-  (match (package-names->package-inputs package-names)
-    (()
-     '())
-    ((package-inputs ...)
-     `(#:cargo-development-inputs ,package-inputs))))
-
-(define (maybe-arguments arguments)
-  (match arguments
-    (()
-     '())
-    ((args ...)
-     `((arguments (,'quasiquote ,args))))))
-
 (define (version->semver-prefix version)
   "Return the version up to and including the first non-zero part"
   (first
@@ -185,8 +166,14 @@ (define* (make-crate-sexp #:key name version cargo-inputs cargo-development-inpu
 
   (let* ((port (http-fetch (crate-uri name version)))
          (guix-name (crate-name->package-name name))
-         (cargo-inputs (format-inputs cargo-inputs))
-         (cargo-development-inputs (format-inputs cargo-development-inputs))
+         (unwrap (match-lambda
+                   ((lst) lst)
+                   (() '())))
+         (cargo-inputs (maybe-packages-field '#:cargo-inputs
+                         (format-inputs cargo-inputs)))
+         (cargo-development-inputs
+           (maybe-packages-field '#:cargo-development-inputs
+             (format-inputs cargo-development-inputs)))
          (pkg `(package
                    (name ,guix-name)
                    (version ,version)
@@ -204,12 +191,12 @@ (define* (make-crate-sexp #:key name version cargo-inputs cargo-development-inpu
                          `((properties '((crate-version-yanked? . #t))))
                          '())
                    (build-system cargo-build-system)
-                   ,@(maybe-arguments (append (if build?
-                                                 '()
-                                                 '(#:skip-build? #t))
-                                              (maybe-cargo-inputs cargo-inputs)
-                                              (maybe-cargo-development-inputs
-                                                cargo-development-inputs)))
+                   ,@(maybe-list-field 'arguments
+                       (append (if build?
+                                   '()
+                                   '(#:skip-build? #t))
+                               (unwrap cargo-inputs)
+                               (unwrap cargo-development-inputs)))
                    (home-page ,home-page)
                    (synopsis ,synopsis)
                    (description ,(beautify-description description))
@@ -218,11 +205,10 @@ (define* (make-crate-sexp #:key name version cargo-inputs cargo-development-inpu
                                (#f #f)
                                ((license) license)
                                (_ `(list ,@license)))))))
-         (close-port port)
-         (package->definition pkg
-                              (if yanked?
-                                  (string-append version "-yanked")
-                                  (version->semver-prefix version)))))
+    (close-port port)
+    (package->definition pkg (if yanked?
+                                 (string-append version "-yanked")
+                                 (version->semver-prefix version)))))
 
 (define (string->license string)
   (filter-map (lambda (license)
diff --git a/tests/crate.scm b/tests/crate.scm
index ce2f08aade..7651a5b5bb 100644
--- a/tests/crate.scm
+++ b/tests/crate.scm
@@ -5,6 +5,8 @@
 ;;; Copyright © 2020 Martin Becze <mjbecze <at> riseup.net>
 ;;; Copyright © 2023 Efraim Flashner <efraim <at> flashner.co.il>
 ;;; Copyright © 2023 David Elsing <david.elsing <at> posteo.net>
+;;; Copyright © 2021 Sarah Morgensen <iskarian <at> mgsn.dev>
+;;; Copyright © 2024 Herman Rimm <herman <at> rimm.ee>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -497,10 +499,10 @@ (define have-guile-semver?
                            (?  string? hash)))))
                       (build-system 'cargo-build-system)
                       (arguments
-                       ('quasiquote
-                        (#:skip-build? #t
+                       (list
+                         #:skip-build? #t
                          #:cargo-inputs
-                         (("rust-leaf-alice" ('unquote 'rust-leaf-alice-0.7))))))
+                         (list rust-leaf-alice-0.7)))
                       (home-page "http://example.com")
                       (synopsis "summary")
                       (description "summary")
@@ -589,7 +591,7 @@ (define have-guile-semver?
                      (?  string? hash)))))
                 (build-system cargo-build-system)
                 (arguments
-                 ('quasiquote (#:skip-build? #t)))
+                 (list #:skip-build? #t))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "summary")
@@ -608,7 +610,7 @@ (define have-guile-semver?
                     (base32
                      (?  string? hash)))))
                 (build-system cargo-build-system)
-                (arguments ('quasiquote (#:skip-build? #t)))
+                (arguments (list #:skip-build? #t))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "summary")
@@ -627,7 +629,7 @@ (define have-guile-semver?
                     (base32
                      (?  string? hash)))))
                 (build-system cargo-build-system)
-                (arguments ('quasiquote (#:skip-build? #t)))
+                (arguments (list #:skip-build? #t))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "summary")
@@ -647,10 +649,9 @@ (define have-guile-semver?
                      (?  string? hash)))))
                 (build-system cargo-build-system)
                 (arguments
-                 ('quasiquote (#:skip-build? #t
-                               #:cargo-inputs
-                               (("rust-leaf-bob"
-                                 ('unquote rust-leaf-bob-3))))))
+                 (list #:skip-build? #t
+                       #:cargo-inputs
+                       (list rust-leaf-bob-3)))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "summary")
@@ -670,14 +671,11 @@ (define have-guile-semver?
                      (?  string? hash)))))
                 (build-system cargo-build-system)
                 (arguments
-                 ('quasiquote (#:skip-build? #t
-                               #:cargo-inputs
-                               (("rust-intermediate-b"
-                                 ('unquote rust-intermediate-b-1))
-                                ("rust-leaf-alice"
-                                 ('unquote 'rust-leaf-alice-0.7))
-                                ("rust-leaf-bob"
-                                 ('unquote rust-leaf-bob-3))))))
+                 (list #:skip-build? #t
+                       #:cargo-inputs
+                       (list rust-intermediate-b-1
+                             rust-leaf-alice-0.7
+                             rust-leaf-bob-3)))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "summary")
@@ -697,18 +695,13 @@ (define have-guile-semver?
                      (?  string? hash)))))
                 (build-system cargo-build-system)
                 (arguments
-                 ('quasiquote (#:cargo-inputs
-                               (("rust-intermediate-a"
-                                 ('unquote rust-intermediate-a-1))
-                                ("rust-intermediate-b"
-                                 ('unquote rust-intermediate-b-1))
-                                ("rust-leaf-alice"
-                                 ('unquote 'rust-leaf-alice-0.7))
-                                ("rust-leaf-bob"
-                                 ('unquote rust-leaf-bob-3)))
-                               #:cargo-development-inputs
-                               (("rust-intermediate-c"
-                                 ('unquote rust-intermediate-c-1))))))
+                 (list #:cargo-inputs
+                       (list rust-intermediate-a-1
+                             rust-intermediate-b-1
+                             rust-leaf-alice-0.7
+                             rust-leaf-bob-3)
+                       #:cargo-development-inputs
+                       ((list rust-intermediate-c-1))))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "summary")
@@ -735,9 +728,8 @@ (define have-guile-semver?
                      (?  string? hash)))))
                 (build-system cargo-build-system)
                 (arguments
-                 ('quasiquote (#:cargo-development-inputs
-                               (("rust-leaf-alice"
-                                 ('unquote rust-leaf-alice-0.7))))))
+                 (list #:cargo-development-inputs
+                       (list rust-leaf-alice-0.7)))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "summary")
@@ -793,9 +785,8 @@ (define have-guile-semver?
                      (?  string? hash)))))
                 (build-system cargo-build-system)
                 (arguments
-                 ('quasiquote (#:cargo-inputs
-                               (("rust-leaf-bob"
-                                 ('unquote rust-leaf-bob-3))))))
+                 (list #:cargo-inputs
+                       (list rust-leaf-bob-3)))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "summary")
@@ -815,13 +806,10 @@ (define have-guile-semver?
                      (?  string? hash)))))
                 (build-system cargo-build-system)
                 (arguments
-                 ('quasiquote (#:cargo-inputs
-                               (("rust-intermediate-b"
-                                 ('unquote rust-intermediate-b-1))
-                                ("rust-leaf-alice"
-                                 ('unquote 'rust-leaf-alice-0.7))
-                                ("rust-leaf-bob"
-                                 ('unquote rust-leaf-bob-3))))))
+                 (list #:cargo-inputs
+                       (list rust-intermediate-b-1
+                             rust-leaf-alice-0.7
+                             rust-leaf-bob-3)))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "summary")
@@ -841,18 +829,13 @@ (define have-guile-semver?
                      (?  string? hash)))))
                 (build-system cargo-build-system)
                 (arguments
-                 ('quasiquote (#:cargo-inputs
-                               (("rust-intermediate-a"
-                                 ('unquote rust-intermediate-a-1))
-                                ("rust-intermediate-b"
-                                 ('unquote rust-intermediate-b-1))
-                                ("rust-leaf-alice"
-                                 ('unquote 'rust-leaf-alice-0.7))
-                                ("rust-leaf-bob"
-                                 ('unquote rust-leaf-bob-3)))
-                               #:cargo-development-inputs
-                               (("rust-intermediate-c"
-                                 ('unquote rust-intermediate-c-1))))))
+                 (list #:cargo-inputs
+                       (list rust-intermediate-a-1
+                             rust-intermediate-b-1
+                             rust-leaf-alice-0.7
+                             rust-leaf-bob-3)
+                       #:cargo-development-inputs
+                       (list rust-intermediate-c-1)))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "summary")
@@ -962,14 +945,11 @@ (define rust-leaf-bob-3.0.2-yanked
                  (?  string? hash)))))
             (build-system cargo-build-system)
             (arguments
-             ('quasiquote (#:cargo-inputs
-                           (("rust-leaf-bob"
-                             ('unquote 'rust-leaf-bob-3)))
-                           #:cargo-development-inputs
-                           (("rust-leaf-bob"
-                             ('unquote 'rust-leaf-bob-3.0.2-yanked))
-                            ("rust-leaf-bob"
-                             ('unquote 'rust-leaf-bob-4.0.0-yanked))))))
+             (list #:cargo-inputs
+                   (list rust-leaf-bob-3)
+                   #:cargo-development-inputs
+                   (list rust-leaf-bob-3.0.2-yanked
+                         rust-leaf-bob-4.0.0-yanked)))
             (home-page "http://example.com")
             (synopsis "summary")
             (description "summary")
@@ -1093,14 +1073,11 @@ (define rust-leaf-bob-3.0.2-yanked
                      (?  string? hash)))))
                 (build-system cargo-build-system)
                 (arguments
-                 ('quasiquote (#:cargo-inputs
-                               (("rust-leaf-bob"
-                                 ('unquote 'rust-leaf-bob-3)))
-                               #:cargo-development-inputs
-                               (("rust-leaf-bob"
-                                 ('unquote 'rust-leaf-bob-3.0.2-yanked))
-                                ("rust-leaf-bob"
-                                 ('unquote 'rust-leaf-bob-4.0.0-yanked))))))
+                 (list #:cargo-inputs
+                       (list rust-leaf-bob-3)
+                       #:cargo-development-inputs
+                       (list rust-leaf-bob-3.0.2-yanked
+                             rust-leaf-bob-4.0.0-yanked)))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "summary")
-- 
2.41.0





Information forwarded to lars <at> 6xq.net, marius <at> gnu.org, me <at> bonfacemunyoki.com, sharlatanus <at> gmail.com, tanguy <at> bioneland.org, jgart <at> dismail.de, guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Mon, 13 May 2024 20:09:05 GMT) Full text and rfc822 format available.

Message #26 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Subject: [PATCH 07/13] import: pypi: Use 'maybe-list-field' procedure.
Date: Mon, 13 May 2024 22:08:04 +0200
* guix/import/pypi.scm (maybe-inputs): Delete procedure.
(make-pypi-sexp): Use 'maybe-list-field' and 'maybe-upstream-inputs'
procedures.
---
 guix/import/pypi.scm | 20 ++++----------------
 1 file changed, 4 insertions(+), 16 deletions(-)

diff --git a/guix/import/pypi.scm b/guix/import/pypi.scm
index 6719fde330..c46f8897b9 100644
--- a/guix/import/pypi.scm
+++ b/guix/import/pypi.scm
@@ -201,18 +201,6 @@ (define (wheel-url->extracted-directory wheel-url)
     ((name version _ ...)
      (string-append name "-" version ".dist-info"))))
 
-(define (maybe-inputs package-inputs input-type)
-  "Given a list of PACKAGE-INPUTS, tries to generate the 'inputs' field of a
-package definition.  INPUT-TYPE, a symbol, is used to populate the name of
-the input field."
-  (match package-inputs
-    (()
-     '())
-    ((package-inputs ...)
-     `((,input-type (list ,@(map (compose string->symbol
-                                          upstream-input-downstream-name)
-                                 package-inputs)))))))
-
 (define %requirement-name-regexp
   ;; Regexp to match the requirement name in a requirement specification.
 
@@ -538,10 +526,10 @@ (define* (make-pypi-sexp pypi-package
                             bytevector->nix-base32-string)))))
         ,@(maybe-upstream-name name)
         (build-system pyproject-build-system)
-        ,@(maybe-inputs (upstream-source-propagated-inputs source)
-                        'propagated-inputs)
-        ,@(maybe-inputs (upstream-source-native-inputs source)
-                        'native-inputs)
+        ,@(maybe-upstream-inputs 'propagated-inputs
+            (upstream-source-propagated-inputs source))
+        ,@(maybe-upstream-inputs 'native-inputs
+            (upstream-source-native-inputs source))
         (home-page ,(project-info-home-page info))
         (synopsis ,(project-info-summary info))
         (description ,(beautify-description
-- 
2.41.0





Information forwarded to andrew <at> trop.in, cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com, guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Mon, 13 May 2024 20:09:05 GMT) Full text and rfc822 format available.

Message #29 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Subject: [PATCH 08/13] import: elpa: Use maybe-propagated-inputs procedure.
Date: Mon, 13 May 2024 22:08:05 +0200
* guix/import/elpa.scm (maybe-inputs): Delete procedure.
(elpa-package->sexp): Use maybe-propagated-inputs procedure.

Change-Id: I9b40e9d387311f5dbbb079938733bf945a1a6ee6
---
 guix/import/elpa.scm | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/guix/import/elpa.scm b/guix/import/elpa.scm
index d1855b3698..0072500155 100644
--- a/guix/import/elpa.scm
+++ b/guix/import/elpa.scm
@@ -358,13 +358,6 @@ (define* (elpa-package->sexp pkg #:optional license repo)
     (map (compose string->symbol elpa-name->package-name)
          dependencies-names))
 
-  (define (maybe-inputs input-type inputs)
-    (match inputs
-      (()
-       '())
-      ((inputs ...)
-       (list (list input-type `(list ,@inputs))))))
-
   (define melpa-source
     (melpa-recipe->origin melpa-recipe))
 
@@ -385,7 +378,7 @@ (define* (elpa-package->sexp pkg #:optional license repo)
                                 (file-hash* tarball #:recursive? #false))
                                "failed to download package")))))))
       (build-system emacs-build-system)
-      ,@(maybe-inputs 'propagated-inputs dependencies)
+      ,@(maybe-propagated-inputs dependencies)
       ,@(if melpa-source
             (melpa-recipe->maybe-arguments melpa-recipe)
             '())
-- 
2.41.0





Information forwarded to rekado <at> elephly.net, guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Mon, 13 May 2024 20:09:05 GMT) Full text and rfc822 format available.

Message #32 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Subject: [PATCH 10/13] import: cran: Use 'maybe-list-field' procedure.
Date: Mon, 13 May 2024 22:08:07 +0200
* guix/import/cran.scm (format-inputs): Delete procedure.
(maybe-inputs): Use 'maybe-list-field' procedure.

Change-Id: I5148afcebdac1f7fa0f8cce9e82e8cebb56c36c8
---
 guix/import/cran.scm | 35 +++++++++++++++--------------------
 1 file changed, 15 insertions(+), 20 deletions(-)

diff --git a/guix/import/cran.scm b/guix/import/cran.scm
index 6ae00cae96..70ee3eb9ec 100644
--- a/guix/import/cran.scm
+++ b/guix/import/cran.scm
@@ -85,21 +85,6 @@ (define-module (guix import cran)
 (define %input-style
   (make-parameter 'variable)) ; or 'specification
 
-(define (format-inputs inputs)
-  "Generate a sorted list of package inputs from a list of upstream inputs."
-  (map (lambda (input)
-         (case (%input-style)
-           ((specification)
-            `(specification->package ,(upstream-input-downstream-name input)))
-           (else
-            ((compose string->symbol
-                       upstream-input-downstream-name)
-             input))))
-       (sort inputs
-             (lambda (a b)
-               (string-ci<? (upstream-input-name a)
-                            (upstream-input-name b))))))
-
 (define (string->licenses license-string license-prefix)
   (let ((licenses
          (map string-trim-both
@@ -188,11 +173,21 @@ (define (description->alist description)
 (define* (maybe-inputs package-inputs #:optional (input-type 'inputs))
   "Given a list of PACKAGE-INPUTS, tries to generate the TYPE field of a
 package definition."
-  (match package-inputs
-    (()
-     '())
-    ((package-inputs ...)
-     `((,input-type (list ,@(format-inputs package-inputs)))))))
+  (define (format-input input)
+    (case (%input-style)
+      ((specification)
+       `(specification->package ,(upstream-input-downstream-name input)))
+      (else
+       ((compose string->symbol
+                  upstream-input-downstream-name)
+        input))))
+
+  (define (upstream-input-name<? i1 i2)
+    (string-ci<? (upstream-input-name i1)
+                 (upstream-input-name i2)))
+
+  (maybe-list-field input-type
+    (map format-input (sort package-inputs upstream-input-name<?))))
 
 (define %cran-url "https://cloud.r-project.org/web/packages/")
 (define %cran-canonical-url "https://cran.r-project.org/package=")
-- 
2.41.0





Information forwarded to lars <at> 6xq.net, guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Mon, 13 May 2024 20:09:06 GMT) Full text and rfc822 format available.

Message #35 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Subject: [PATCH 09/13] import: hackage: Use 'maybe-list-field' procedure.
Date: Mon, 13 May 2024 22:08:06 +0200
* guix/import/hackage.scm (maybe-inputs, maybe-arguments): Delete
procedures.
(hackage-module->sexp): Use 'maybe-list-field' and
'maybe-upstream-inputs' procedures.
* tests/hackage.scm: Fix whitespace and replace 'quasiquote' with
'list'.

Change-Id: I4fe39ff84c9f6a677f810d9e4fe751d762973757
---
 guix/import/hackage.scm | 38 +++++++++++---------------------------
 tests/hackage.scm       | 13 +++++++------
 2 files changed, 18 insertions(+), 33 deletions(-)

diff --git a/guix/import/hackage.scm b/guix/import/hackage.scm
index 79a51d3300..e90f3c932f 100644
--- a/guix/import/hackage.scm
+++ b/guix/import/hackage.scm
@@ -288,26 +288,6 @@ (define* (hackage-module->sexp cabal cabal-hash
                           #:include-test-dependencies?
                           include-test-dependencies?))
 
-  (define (maybe-inputs input-type inputs)
-    (match inputs
-      (()
-       '())
-      ((inputs ...)
-       (list (list input-type
-                   `(list ,@(map (compose string->symbol
-                                          upstream-input-downstream-name)
-                                 inputs)))))))
-
-  (define (maybe-arguments)
-    (match (append (if (not include-test-dependencies?)
-                       '(#:tests? #f)
-                       '())
-                   (if (not (string-null? revision))
-                       `(#:cabal-revision (,revision ,cabal-hash))
-                       '()))
-      (() '())
-      (args `((arguments (,'quasiquote ,args))))))
-
   (let ((tarball (with-store store
                    (download-to-store store source-url))))
     (values
@@ -324,13 +304,17 @@ (define* (hackage-module->sexp cabal cabal-hash
                          "failed to download tar archive")))))
         (build-system haskell-build-system)
         (properties '((upstream-name . ,name)))
-        ,@(maybe-inputs 'inputs
-                        (filter (upstream-input-type-predicate 'regular)
-                                inputs))
-        ,@(maybe-inputs 'native-inputs
-                        (filter (upstream-input-type-predicate 'native)
-                                inputs))
-        ,@(maybe-arguments)
+        ,@(maybe-upstream-inputs 'inputs
+            (filter (upstream-input-type-predicate 'regular) inputs))
+        ,@(maybe-upstream-inputs 'native-inputs
+            (filter (upstream-input-type-predicate 'native) inputs))
+        ,@(maybe-list-field 'arguments
+            (append (if (not include-test-dependencies?)
+                        '(#:tests? #f)
+                        '())
+                    (if (not (string-null? revision))
+                        `(#:cabal-revision '(,revision ,cabal-hash))
+                        '())))
         (home-page ,(cabal-package-home-page cabal))
         (synopsis ,(cabal-package-synopsis cabal))
         (description ,(beautify-description (cabal-package-description cabal)))
diff --git a/tests/hackage.scm b/tests/hackage.scm
index 403f587c41..f6d91515e2 100644
--- a/tests/hackage.scm
+++ b/tests/hackage.scm
@@ -67,7 +67,7 @@ (define test-cabal-3
   if impl(ghc>=7.2&&<7.6)
     Build-depends: ghc-b
   if impl(ghc == 7.8)
-    Build-depends: 
+    Build-depends:
       HTTP       >= 4000.2.5 && < 4000.3,
       mtl        >= 2.0      && < 3
 ")
@@ -86,7 +86,7 @@ (define test-cabal-4
   if impl(ghc>=7.2&&<7.6)
     Build-depends: ghc-b
   if impl(ghc == 7.8)
-    Build-depends: 
+    Build-depends:
       HTTP       >= 4000.2.5 && < 4000.3,
       mtl        >= 2.0      && < 3
 ")
@@ -101,7 +101,7 @@ (define test-cabal-5
 license: BSD3
 library
   if impl(ghc == 7.8)
-    Build-depends: 
+    Build-depends:
       HTTP       >= 4000.2.5 && < 4000.3,
   if impl(ghc -any)
     Build-depends: mtl        >= 2.0      && < 3
@@ -126,7 +126,7 @@ (define test-cabal-6
   if impl(ghc>=7.2&&<7.6)
     Build-depends: ghc-b
   if impl(ghc == 7.8)
-    Build-depends: 
+    Build-depends:
       HTTP       >= 4000.2.5 && < 4000.3,
       mtl        >= 2.0      && < 3
 ")
@@ -524,8 +524,9 @@ (define-package-matcher match-ghc-foo-revision
     ('properties '(quote ((upstream-name . "foo"))))
     ('inputs ('list 'ghc-http))
     ('arguments
-     ('quasiquote
-      ('#:cabal-revision
+     ('list
+      '#:cabal-revision
+      ('quote
        ("2" "0xxd88fb659f0krljidbvvmkh9ppjnx83j0nqzx8whcg4n5qbyng"))))
     ('home-page "http://test.org")
     ('synopsis (? string?))
-- 
2.41.0





Information forwarded to guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Mon, 13 May 2024 20:09:06 GMT) Full text and rfc822 format available.

Message #38 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Subject: [PATCH 12/13] import: egg: Use maybe-*inputs procedures.
Date: Mon, 13 May 2024 22:08:09 +0200
* guix/import/egg.scm (maybe-inputs): Delete procedure.
(egg-parse-dependency): Simplify procedure to return strings.
(egg->guix-package): Use maybe-*inputs procedures.

Change-Id: Ib0a3f5b6f02912c847defd02ba7675d80005279b
---
 guix/import/egg.scm | 38 ++++++++++----------------------------
 1 file changed, 10 insertions(+), 28 deletions(-)

diff --git a/guix/import/egg.scm b/guix/import/egg.scm
index e3bc158475..60e1eef156 100644
--- a/guix/import/egg.scm
+++ b/guix/import/egg.scm
@@ -229,23 +229,14 @@ (define* (egg->guix-package name version #:key (file #f) (source #f)
                           (else char)))
                       (maybe-symbol->string name)))
 
-        (define* (egg-parse-dependency name #:key (system? #f))
-          (define extract-name
-            (match-lambda
-              ((name version) name)
-              (name name)))
-
-          (define (prettify-name name)
+        (define* (egg-parse-dependency dependency #:key (system? #f))
+          (let ((name (match dependency
+                        ((name version) name)
+                        (name name))))
             (if system?
                 (prettify-system-dependency name)
-                (maybe-symbol->string name)))
-          
-          (let ((name (prettify-name (extract-name name))))
-            ;; Dependencies are sometimes specified as symbols and sometimes
-            ;; as strings
-            (string->symbol (string-append
-                             (if system? "" package-name-prefix)
-                             name))))
+                (string-append package-name-prefix
+                               (maybe-symbol->string name)))))
 
         (define egg-propagated-inputs
           (let ((dependencies (assoc-ref egg-content 'dependencies)))
@@ -277,15 +268,6 @@ (define* (egg->guix-package name version #:key (file #f) (source #f)
                               test+build-dependencies))
               (() '()))))
 
-        ;; Copied from (guix import hackage).
-        (define (maybe-inputs input-type inputs)
-          (match inputs
-            (()
-             '())
-            ((inputs ...)
-             (list (list input-type
-                         `(list ,@inputs))))))
-
         (values
          `(package
             (name ,(egg-name->guix-name name))
@@ -303,16 +285,16 @@ (define* (egg->guix-package name version #:key (file #f) (source #f)
                                    "failed to download tar archive"))))))
             (build-system chicken-build-system)
             (arguments ,(list 'quasiquote (list #:egg-name name)))
-            ,@(maybe-inputs 'native-inputs egg-native-inputs)
-            ,@(maybe-inputs 'inputs egg-inputs)
-            ,@(maybe-inputs 'propagated-inputs egg-propagated-inputs)
+            ,@(maybe-native-inputs egg-native-inputs)
+            ,@(maybe-inputs egg-inputs)
+            ,@(maybe-propagated-inputs egg-propagated-inputs)
             (home-page ,egg-home-page)
             (synopsis ,egg-synopsis)
             (description #f)
             (license ,egg-licenses))
          (filter (lambda (name)
                    (not (member name '("srfi-4"))))
-                 (map (compose guix-name->egg-name symbol->string)
+                 (map guix-name->egg-name
                       (append egg-propagated-inputs
                               egg-native-inputs)))))))
 
-- 
2.41.0





Information forwarded to guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Mon, 13 May 2024 20:09:07 GMT) Full text and rfc822 format available.

Message #41 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Subject: [PATCH 11/13] import: cpan: Use 'maybe-upstream-inputs' procedure.
Date: Mon, 13 May 2024 22:08:08 +0200
* guix/import/cpan.scm (maybe-inputs): Delete procedure.
(cpan-module->sexp): Use 'maybe-upstream-inputs' procedure.

Change-Id: I4fa99da62d81f02c2998ad96f5ea81e27df071cd
---
 guix/import/cpan.scm | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/guix/import/cpan.scm b/guix/import/cpan.scm
index b87736eef6..55c616314b 100644
--- a/guix/import/cpan.scm
+++ b/guix/import/cpan.scm
@@ -37,7 +37,8 @@ (define-module (guix import cpan)
   #:use-module (guix utils)
   #:use-module (guix base32)
   #:use-module ((guix download) #:select (download-to-store url-fetch))
-  #:use-module ((guix import utils) #:select (factorize-uri))
+  #:use-module ((guix import utils) #:select (factorize-uri
+                                              maybe-upstream-inputs))
   #:use-module (guix import json)
   #:use-module (guix packages)
   #:use-module (guix upstream)
@@ -275,15 +276,6 @@ (define (cpan-module->sexp release)
   (define version (cpan-release-version release))
   (define source-url (cpan-source-url release))
 
-  (define (maybe-inputs input-type inputs)
-    (match inputs
-      (()
-       '())
-      ((inputs ...)
-       `((,input-type (list ,@(map (compose string->symbol
-                                            upstream-input-downstream-name)
-                                   inputs)))))))
-
   (let ((tarball (with-store store
                    (download-to-store store source-url)))
         (inputs (cpan-module-inputs release)))
@@ -297,12 +289,10 @@ (define (cpan-module->sexp release)
                   (base32
                    ,(bytevector->nix-base32-string (file-sha256 tarball))))))
        (build-system perl-build-system)
-       ,@(maybe-inputs 'native-inputs
-                       (filter (upstream-input-type-predicate 'native)
-                               inputs))
-       ,@(maybe-inputs 'propagated-inputs
-                       (filter (upstream-input-type-predicate 'propagated)
-                               inputs))
+       ,@(maybe-upstream-inputs 'native-inputs
+           (filter (upstream-input-type-predicate 'native) inputs))
+       ,@(maybe-upstream-inputs 'propagated-inputs
+           (filter (upstream-input-type-predicate 'propagated) inputs))
        (home-page ,(cpan-home name))
        (synopsis ,(cpan-release-abstract release))
        (description fill-in-yourself!)
-- 
2.41.0





Information forwarded to guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Mon, 13 May 2024 20:09:07 GMT) Full text and rfc822 format available.

Message #44 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Subject: [PATCH 13/13] import: hexpm: Use (guix import utils) 'maybe-inputs'
 procedure.
Date: Mon, 13 May 2024 22:08:10 +0200
* guix/import/hexpm.scm (maybe-inputs): Delete procedure.
(dependencies->package-names): Return strings instead of symbols.
(make-hexpm-sexp): Use 'maybe-inputs' from (guix import utils).

Change-Id: Ie7a8a630a3a9d4859453d49fdee42aa560e27f17
---
 guix/import/hexpm.scm | 20 ++++----------------
 1 file changed, 4 insertions(+), 16 deletions(-)

diff --git a/guix/import/hexpm.scm b/guix/import/hexpm.scm
index 71a54ba973..af7a96efb0 100644
--- a/guix/import/hexpm.scm
+++ b/guix/import/hexpm.scm
@@ -153,26 +153,14 @@ (define (lookup-hexpm-release version*)
 ;;; Converting hex.pm packages to Guix packages.
 ;;;
 
-(define (maybe-inputs package-inputs input-type)
-  "Given a list of PACKAGE-INPUTS, tries to generate the 'inputs' field of a
-package definition.  INPUT-TYPE, a symbol, is used to populate the name of
-the input field."
-  (match package-inputs
-    (()
-     '())
-    ((package-inputs ...)
-     `((,input-type (list ,@package-inputs))))))
-
 (define (dependencies->package-names names)
-  "Given a list of hexpm package NAMES, returns a list of guix package names
-as symbols."
+  "Given a list of hexpm package NAMES, returns a list of guix package
+names."
   ;; TODO: Base name on language of dependency.
   ;; The language used for implementing the dependency is not know without
   ;; recursing the dependencies.  So for now assume more packages are based on
   ;; Erlang and prefix all dependencies with "erlang-" (the default).
-  (map string->symbol
-       (map hexpm-name->package-name
-            (sort names string-ci<?))))
+  (map hexpm-name->package-name (sort names string-ci<?)))
 
 (define* (make-hexpm-sexp #:key name version tarball-url
                           home-page synopsis description license
@@ -194,7 +182,7 @@ (define* (make-hexpm-sexp #:key name version tarball-url
                    (uri (hexpm-uri ,name version))
                    (sha256 (base32 ,(guix-hash-url temp)))))
          (build-system ,build-system)
-         ,@(maybe-inputs (dependencies->package-names dependencies) 'inputs)
+         ,@(maybe-inputs (dependencies->package-names dependencies))
          (synopsis ,synopsis)
          (description ,(beautify-description description))
          (home-page ,(match home-page
-- 
2.41.0





Information forwarded to guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Wed, 04 Sep 2024 20:36:01 GMT) Full text and rfc822 format available.

Message #47 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Subject: [PATCH v2 01/12] build-system: cargo: Accept unlabeled #:cargo-inputs.
Date: Wed,  4 Sep 2024 22:32:55 +0200
* guix/build-system/cargo.scm (crate-closure): Match unlabeled inputs.

Change-Id: Iae421281fa08d09ddd1e5d2da2864f0093d97cd1
---
 guix/build-system/cargo.scm | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/guix/build-system/cargo.scm b/guix/build-system/cargo.scm
index 658a2e525e..2e3061c0e8 100644
--- a/guix/build-system/cargo.scm
+++ b/guix/build-system/cargo.scm
@@ -6,6 +6,7 @@
 ;;; Copyright © 2019 Ivan Petkov <ivanppetkov <at> gmail.com>
 ;;; Copyright © 2020 Jakub Kądziołka <kuba <at> kadziolka.net>
 ;;; Copyright © 2021 Efraim Flashner <efraim <at> flashner.co.il>
+;;; Copyright © 2024 Herman Rimm <herman <at> rimm.ee>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -234,11 +235,14 @@ (define (seen? seen item)
        (if (null? propagated)
            (reverse result)
            (loop (reverse (concatenate propagated)) result '() #f seen)))
-      (((and input (label (? package? package))) rest ...)
+      ;; Match inputs with labels for backward compatibility.
+      (((or (_ (? package? package))
+            (? package? package))
+        rest ...)
        (if (and (not first?) (seen? seen package))
            (loop rest result propagated first? seen)
            (loop rest
-                 (cons input result)
+                 (cons package result)
                  (cons (package-cargo-inputs package)
                        propagated)
                  first?
@@ -296,8 +300,8 @@ (define (expand-crate-sources cargo-inputs cargo-development-inputs)
   something that can always be extended or reworked in the future)."
   (filter-map
     (match-lambda
-      ((label (? package? p))
-       (list label (package-source p)))
+      ((? package? p)
+       (list (package-name p) (package-source p)))
       ((label input)
        (list label input)))
     (crate-closure (append cargo-inputs cargo-development-inputs))))
-- 
2.45.2





Information forwarded to guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Wed, 04 Sep 2024 20:36:02 GMT) Full text and rfc822 format available.

Message #50 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Subject: [PATCH v2 02/12] import: utils: Emit new-style inputs from
 maybe-*inputs procedures.
Date: Wed,  4 Sep 2024 22:32:56 +0200
* guix/import/utils.scm (package-names->package-inputs)[make-input]:
Refactor.
(maybe-list-field): Add procedure, which wraps BODY in 'list' instead of
'quasiquote'.
(maybe-packages-field): Add procedure.
(maybe-inputs, maybe-native-inputs, maybe-propagated-inputs): Use
maybe-packages-field.

Change-Id: I66588f4c822d507ddbaf465a268bfb71af8a7ecd
---
 guix/import/utils.scm | 54 +++++++++++++++++++++++++------------------
 1 file changed, 31 insertions(+), 23 deletions(-)

diff --git a/guix/import/utils.scm b/guix/import/utils.scm
index b7756fcc40..75bef1e9c7 100644
--- a/guix/import/utils.scm
+++ b/guix/import/utils.scm
@@ -13,6 +13,7 @@
 ;;; Copyright © 2022 Alice Brenon <alice.brenon <at> ens-lyon.fr>
 ;;; Copyright © 2022 Kyle Meyer <kyle <at> kyleam.com>
 ;;; Copyright © 2022 Philip McGrath <philip <at> philipmcgrath.com>
+;;; Copyright © 2024 Herman Rimm <herman <at> rimm.ee>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -65,6 +66,8 @@ (define-module (guix import utils)
             guix-hash-url
 
             package-names->package-inputs
+            maybe-list-field
+            maybe-packages-field
             maybe-inputs
             maybe-native-inputs
             maybe-propagated-inputs
@@ -418,39 +421,44 @@ (define* (package-names->package-inputs names #:optional (output #f))
 optional OUTPUT, tries to generate a quoted list of inputs, as suitable to
 use in an 'inputs' field of a package definition."
   (define (make-input input version)
-    (let ((name (if version (string-append input "-" version) input)))
-      (if output
-          (list (string->symbol name) output)
-          (string->symbol name))))
+    (let ((symbol (string->symbol
+                    (if version
+                        (string-append input "-" version)
+                        input))))
+      (if output (list symbol output) symbol)))
 
   (map (match-lambda
          ((input version) (make-input input version))
          (input (make-input input #f)))
        names))
 
-(define* (maybe-inputs package-names #:optional (output #f)
-                       #:key (type #f))
-  "Given a list of PACKAGE-NAMES, tries to generate the 'inputs' field of a
-package definition.  TYPE can be used to specify the type of the inputs;
-either the 'native or 'propagated symbols are accepted.  Left unspecified, the
-snippet generated is for regular inputs."
-  (let ((field-name (match type
-                      ('native 'native-inputs)
-                      ('propagated 'propagated-inputs)
-                      (_ 'inputs))))
-    (match (package-names->package-inputs package-names output)
-      (()
-       '())
-      ((package-inputs ...)
-       `((,field-name (list ,@package-inputs)))))))
+(define* (maybe-list-field type body)
+  "Generates the TYPE field of a package definition if its value, BODY,
+is a non-empty list."
+  (match body
+    (()
+     '())
+    ((? list?)
+     (list (list type (cons 'list body))))))
+
+(define* (maybe-packages-field type package-names
+                               #:optional (output #f))
+  "Given a list of PACKAGE-NAMES, tries to generate the TYPE field of a
+package definition."
+  (maybe-list-field type
+    (package-names->package-inputs package-names output)))
+
+(define* (maybe-inputs package-names #:optional (output #f))
+  "MAYBE-PACKAGES-FIELD for inputs."
+  (maybe-packages-field 'inputs package-names output))
 
 (define* (maybe-native-inputs package-names #:optional (output #f))
-  "Same as MAYBE-INPUTS, but for native inputs."
-  (maybe-inputs package-names output #:type 'native))
+  "MAYBE-PACKAGES-FIELD for native inputs."
+  (maybe-packages-field 'native-inputs package-names output))
 
 (define* (maybe-propagated-inputs package-names #:optional (output #f))
-  "Same as MAYBE-INPUTS, but for propagated inputs."
-  (maybe-inputs package-names output #:type 'propagated))
+  "MAYBE-PACKAGES-FIELD for propagated inputs."
+  (maybe-packages-field 'propagated-inputs package-names output))
 
 (define* (package->definition guix-package #:optional append-version?/string)
   "If APPEND-VERSION?/STRING is #t, append the package's major+minor version.
-- 
2.45.2





Information forwarded to guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Wed, 04 Sep 2024 20:36:02 GMT) Full text and rfc822 format available.

Message #53 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Subject: [PATCH v2 03/12] tests: elm: Adjust to new-style package inputs.
Date: Wed,  4 Sep 2024 22:32:57 +0200
* tests/elm.scm (elm-recursive-import "elm-guix/demo"): Use
the new-style for inputs and propagated-inputs.

Change-Id: Iae05b5e9f9b6a73cb2d08bb3b0f73df9004f83ac
---
 tests/elm.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/elm.scm b/tests/elm.scm
index 48d3eb4b01..7de2168665 100644
--- a/tests/elm.scm
+++ b/tests/elm.scm
@@ -250,9 +250,9 @@ (define elm-guix-demo-dir
                          (base32 ,(? string? hash))))
                 (build-system elm-build-system)
                 (propagated-inputs
-                 ,'`(("elm-core" ,elm-core)))
+                 (list elm-core))
                 (inputs
-                 ,'`(("elm-json" ,elm-json)))
+                 (list elm-json))
                 (home-page
                  "https://package.elm-lang.org/packages/elm-guix/demo/3.0.0")
                 (synopsis "A test for `(guix import elm)`")
-- 
2.45.2





Information forwarded to guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Wed, 04 Sep 2024 20:36:03 GMT) Full text and rfc822 format available.

Message #56 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Subject: [PATCH v2 04/12] import: crate: Use (guix import utils) procedures.
Date: Wed,  4 Sep 2024 22:32:58 +0200
* guix/import/crate.scm (maybe-cargo-inputs,
maybe-cargo-development-inputs, maybe-arguments): Delete procedures.
(make-crate-sexp): Add 'unwrap' procedure, use with maybe-packages-field
and fix indentation.
* tests/crate.scm: Replace quasiquotes with list procedures.
---
 guix/import/crate.scm | 53 +++++++++---------------
 tests/crate.scm       | 94 +++++++++++++++++++++----------------------
 2 files changed, 66 insertions(+), 81 deletions(-)

diff --git a/guix/import/crate.scm b/guix/import/crate.scm
index 263c2a8b16..e451ebee68 100644
--- a/guix/import/crate.scm
+++ b/guix/import/crate.scm
@@ -8,6 +8,7 @@
 ;;; Copyright © 2023 Simon Tournier <zimon.toutoune <at> gmail.com>
 ;;; Copyright © 2023, 2024 Efraim Flashner <efraim <at> flashner.co.il>
 ;;; Copyright © 2023, 2024 David Elsing <david.elsing <at> posteo.net>
+;;; Copyright © 2024 Herman Rimm <herman <at> rimm.ee>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -159,27 +160,6 @@ (define (make-input input version)
          (input (make-input input #f)))
        names))
 
-(define (maybe-cargo-inputs package-names)
-  (match (package-names->package-inputs package-names)
-    (()
-     '())
-    ((package-inputs ...)
-     `(#:cargo-inputs (,'unquote (list ,@package-inputs))))))
-
-(define (maybe-cargo-development-inputs package-names)
-  (match (package-names->package-inputs package-names)
-    (()
-     '())
-    ((package-inputs ...)
-     `(#:cargo-development-inputs (,'unquote (list ,@package-inputs))))))
-
-(define (maybe-arguments arguments)
-  (match arguments
-    (()
-     '())
-    ((args ...)
-     `((arguments (,'quasiquote ,args))))))
-
 (define (version->semver-prefix version)
   "Return the version up to and including the first non-zero part"
   (first
@@ -203,8 +183,14 @@ (define (format-inputs inputs)
 
   (let* ((port (http-fetch (crate-uri name version)))
          (guix-name (crate-name->package-name name))
-         (cargo-inputs (format-inputs cargo-inputs))
-         (cargo-development-inputs (format-inputs cargo-development-inputs))
+         (unwrap (match-lambda
+                   ((lst) lst)
+                   (() '())))
+         (cargo-inputs (maybe-packages-field '#:cargo-inputs
+                         (format-inputs cargo-inputs)))
+         (cargo-development-inputs
+           (maybe-packages-field '#:cargo-development-inputs
+             (format-inputs cargo-development-inputs)))
          (description (beautify-description description))
          (pkg `(package
                    (name ,guix-name)
@@ -223,12 +209,12 @@ (define (format-inputs inputs)
                          `((properties '((crate-version-yanked? . #t))))
                          '())
                    (build-system cargo-build-system)
-                   ,@(maybe-arguments (append (if build?
-                                                 '()
-                                                 '(#:skip-build? #t))
-                                              (maybe-cargo-inputs cargo-inputs)
-                                              (maybe-cargo-development-inputs
-                                                cargo-development-inputs)))
+                   ,@(maybe-list-field 'arguments
+                       (append (if build?
+                                   '()
+                                   '(#:skip-build? #t))
+                               (unwrap cargo-inputs)
+                               (unwrap cargo-development-inputs)))
                    (home-page ,home-page)
                    (synopsis ,(beautify-synopsis synopsis))
                    (description ,(if (string-prefix? "This" description)
@@ -240,11 +226,10 @@ (define (format-inputs inputs)
                                (#f #f)
                                ((license) license)
                                (_ `(list ,@license)))))))
-         (close-port port)
-         (package->definition pkg
-                              (if yanked?
-                                  (string-append version "-yanked")
-                                  (version->semver-prefix version)))))
+    (close-port port)
+    (package->definition pkg (if yanked?
+                                 (string-append version "-yanked")
+                                 (version->semver-prefix version)))))
 
 (define (string->license string)
   (filter-map (lambda (license)
diff --git a/tests/crate.scm b/tests/crate.scm
index 63643c2728..95c93712a9 100644
--- a/tests/crate.scm
+++ b/tests/crate.scm
@@ -6,6 +6,7 @@
 ;;; Copyright © 2021 Sarah Morgensen <iskarian <at> mgsn.dev>
 ;;; Copyright © 2023 Efraim Flashner <efraim <at> flashner.co.il>
 ;;; Copyright © 2023 David Elsing <david.elsing <at> posteo.net>
+;;; Copyright © 2024 Herman Rimm <herman <at> rimm.ee>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -498,10 +499,10 @@ (define have-guile-semver?
                            (?  string? hash)))))
                       (build-system 'cargo-build-system)
                       (arguments
-                       ('quasiquote
-                        (#:skip-build? #t
+                       (list
+                         #:skip-build? #t
                          #:cargo-inputs
-                         ('unquote (list rust-leaf-alice-0.7)))))
+                         (list rust-leaf-alice-0.7)))
                       (home-page "http://example.com")
                       (synopsis "summary")
                       (description "This package provides summary.")
@@ -590,7 +591,7 @@ (define have-guile-semver?
                      (?  string? hash)))))
                 (build-system cargo-build-system)
                 (arguments
-                 ('quasiquote (#:skip-build? #t)))
+                 (list #:skip-build? #t))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "This package provides summary.")
@@ -609,7 +610,7 @@ (define-public 'rust-leaf-alice-0.7
                     (base32
                      (? string? hash)))))
                 (build-system cargo-build-system)
-                (arguments ('quasiquote (#:skip-build? #t)))
+                (arguments (list #:skip-build? #t))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "This package provides summary.")
@@ -628,7 +629,7 @@ (define-public 'rust-leaf-bob-3
                     (base32
                      (?  string? hash)))))
                 (build-system cargo-build-system)
-                (arguments ('quasiquote (#:skip-build? #t)))
+                (arguments (list #:skip-build? #t))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "This package provides summary.")
@@ -648,9 +649,9 @@ (define-public 'rust-intermediate-b-1
                      (?  string? hash)))))
                 (build-system cargo-build-system)
                 (arguments
-                 ('quasiquote (#:skip-build? #t
-                               #:cargo-inputs
-                               ('unquote (list rust-leaf-bob-3)))))
+                 (list #:skip-build? #t
+                       #:cargo-inputs
+                       (list rust-leaf-bob-3)))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "This package provides summary.")
@@ -670,11 +671,11 @@ (define-public 'rust-intermediate-a-1
                      (?  string? hash)))))
                 (build-system cargo-build-system)
                 (arguments
-                 ('quasiquote (#:skip-build? #t
-                               #:cargo-inputs
-                               ('unquote (list rust-intermediate-b-1
-                                               rust-leaf-alice-0.7
-                                               rust-leaf-bob-3)))))
+                 (list #:skip-build? #t
+                       #:cargo-inputs
+                       (list rust-intermediate-b-1
+                             rust-leaf-alice-0.7
+                             rust-leaf-bob-3)))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "This package provides summary.")
@@ -694,13 +695,13 @@ (define-public 'rust-root-1
                      (?  string? hash)))))
                 (build-system cargo-build-system)
                 (arguments
-                 ('quasiquote (#:cargo-inputs
-                               ('unquote (list rust-intermediate-a-1
-                                               rust-intermediate-b-1
-                                               rust-leaf-alice-0.7
-                                               rust-leaf-bob-3))
-                               #:cargo-development-inputs
-                               ('unquote (list rust-intermediate-c-1)))))
+                 (list #:cargo-inputs
+                       (list rust-intermediate-a-1
+                             rust-intermediate-b-1
+                             rust-leaf-alice-0.7
+                             rust-leaf-bob-3)
+                       #:cargo-development-inputs
+                       ((list rust-intermediate-c-1))))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "This package provides summary.")
@@ -727,8 +728,8 @@ (define-public 'rust-root-1
                      (?  string? hash)))))
                 (build-system cargo-build-system)
                 (arguments
-                 ('quasiquote (#:cargo-development-inputs
-                               ('unquote (list rust-leaf-alice-0.7)))))
+                 (list #:cargo-development-inputs
+                       (list rust-leaf-alice-0.7)))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "This package provides summary.")
@@ -784,9 +785,8 @@ (define-public 'rust-intermediate-b-1
                      (?  string? hash)))))
                 (build-system cargo-build-system)
                 (arguments
-                 ('quasiquote (#:cargo-inputs
-                               (("rust-leaf-bob"
-                                 ('unquote rust-leaf-bob-3))))))
+                 (list #:cargo-inputs
+                       (list rust-leaf-bob-3)))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "This package provides summary.")
@@ -806,10 +806,10 @@ (define-public 'rust-intermediate-a-1
                      (?  string? hash)))))
                 (build-system cargo-build-system)
                 (arguments
-                 ('quasiquote (#:cargo-inputs
-                               ('unquote (list rust-intermediate-b-1
-                                               rust-leaf-alice-0.7
-                                               rust-leaf-bob-3)))))
+                 (list #:cargo-inputs
+                       (list rust-intermediate-b-1
+                             rust-leaf-alice-0.7
+                             rust-leaf-bob-3)))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "This package provides summary.")
@@ -829,13 +829,13 @@ (define-public 'rust-root-1
                      (?  string? hash)))))
                 (build-system cargo-build-system)
                 (arguments
-                 ('quasiquote (#:cargo-inputs
-                               ('unquote (list rust-intermediate-a-1
-                                               rust-intermediate-b-1
-                                               rust-leaf-alice-0.7
-                                               rust-leaf-bob-3))
-                               #:cargo-development-inputs
-                               ('unquote (list rust-intermediate-c-1)))))
+                 (list #:cargo-inputs
+                       (list rust-intermediate-a-1
+                             rust-intermediate-b-1
+                             rust-leaf-alice-0.7
+                             rust-leaf-bob-3)
+                       #:cargo-development-inputs
+                       (list rust-intermediate-c-1)))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "This package provides summary.")
@@ -945,11 +945,11 @@ (define rust-leaf-bob-3.0.2-yanked
                  (?  string? hash)))))
             (build-system cargo-build-system)
             (arguments
-             ('quasiquote (#:cargo-inputs
-                           ('unquote (list rust-leaf-bob-3))
-                           #:cargo-development-inputs
-                           ('unquote (list rust-leaf-bob-3.0.2-yanked
-                                           rust-leaf-bob-4.0.0-yanked)))))
+             (list #:cargo-inputs
+                   (list rust-leaf-bob-3)
+                   #:cargo-development-inputs
+                   (list rust-leaf-bob-3.0.2-yanked
+                         rust-leaf-bob-4.0.0-yanked)))
             (home-page "http://example.com")
             (synopsis "summary")
             (description "This package provides summary.")
@@ -1073,11 +1073,11 @@ (define-public 'rust-bar-1
                      (?  string? hash)))))
                 (build-system cargo-build-system)
                 (arguments
-                 ('quasiquote (#:cargo-inputs
-                               ('unquote (list rust-leaf-bob-3))
-                               #:cargo-development-inputs
-                               ('unquote (list rust-leaf-bob-3.0.2-yanked
-                                               rust-leaf-bob-4.0.0-yanked)))))
+                 (list #:cargo-inputs
+                       (list rust-leaf-bob-3)
+                       #:cargo-development-inputs
+                       (list rust-leaf-bob-3.0.2-yanked
+                             rust-leaf-bob-4.0.0-yanked)))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "This package provides summary.")
-- 
2.45.2





Information forwarded to guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Wed, 04 Sep 2024 20:36:03 GMT) Full text and rfc822 format available.

Message #59 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Subject: [PATCH v2 05/12] import: utils: Add maybe-upstream-inputs.
Date: Wed,  4 Sep 2024 22:32:59 +0200
* guix/import/utils.scm (maybe-upstream-inputs): Add procedure.

Change-Id: Ib8a80216d512c0373e55e4f27e1ef2a7c1fb854a
---
 guix/import/utils.scm | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/guix/import/utils.scm b/guix/import/utils.scm
index 75bef1e9c7..152ae07a92 100644
--- a/guix/import/utils.scm
+++ b/guix/import/utils.scm
@@ -45,6 +45,7 @@ (define-module (guix import utils)
   #:use-module (guix download)
   #:use-module (guix sets)
   #:use-module ((guix ui) #:select (fill-paragraph))
+  #:use-module (guix upstream)
   #:use-module (gnu packages)
   #:autoload   (ice-9 control) (let/ec)
   #:use-module (ice-9 match)
@@ -71,6 +72,7 @@ (define-module (guix import utils)
             maybe-inputs
             maybe-native-inputs
             maybe-propagated-inputs
+            maybe-upstream-inputs
             package->definition
 
             spdx-string->license
@@ -460,6 +462,13 @@ (define* (maybe-propagated-inputs package-names #:optional (output #f))
   "MAYBE-PACKAGES-FIELD for propagated inputs."
   (maybe-packages-field 'propagated-inputs package-names output))
 
+(define* (maybe-upstream-inputs type upstream-inputs)
+  "Given a list of UPSTREAM-NAMES, tries to generate the TYPE field of a
+package definition."
+  (maybe-list-field type
+    (map (compose string->symbol upstream-input-downstream-name)
+         upstream-inputs)))
+
 (define* (package->definition guix-package #:optional append-version?/string)
   "If APPEND-VERSION?/STRING is #t, append the package's major+minor version.
 If it is the symbol 'full, append the package's complete version.  If
-- 
2.45.2





Information forwarded to guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Wed, 04 Sep 2024 20:36:04 GMT) Full text and rfc822 format available.

Message #62 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Subject: [PATCH v2 06/12] import: pypi: Use maybe-upstream-inputs.
Date: Wed,  4 Sep 2024 22:33:00 +0200
* guix/import/pypi.scm (maybe-inputs): Delete procedure.
(make-pypi-sexp): Use maybe-upstream-inputs procedure.
---
 guix/import/pypi.scm | 21 +++++----------------
 1 file changed, 5 insertions(+), 16 deletions(-)

diff --git a/guix/import/pypi.scm b/guix/import/pypi.scm
index 7b9f54a200..a98fdfa604 100644
--- a/guix/import/pypi.scm
+++ b/guix/import/pypi.scm
@@ -14,6 +14,7 @@
 ;;; Copyright © 2022 Vivien Kraus <vivien <at> planete-kraus.eu>
 ;;; Copyright © 2021 Simon Tournier <zimon.toutoune <at> gmail.com>
 ;;; Copyright © 2022 Hartmut Goebel <h.goebel <at> crazy-compilers.com>
+;;; Copyright © 2024 Herman Rimm <herman <at> rimm.ee>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -201,18 +202,6 @@ (define (wheel-url->extracted-directory wheel-url)
     ((name version _ ...)
      (string-append name "-" version ".dist-info"))))
 
-(define (maybe-inputs package-inputs input-type)
-  "Given a list of PACKAGE-INPUTS, tries to generate the 'inputs' field of a
-package definition.  INPUT-TYPE, a symbol, is used to populate the name of
-the input field."
-  (match package-inputs
-    (()
-     '())
-    ((package-inputs ...)
-     `((,input-type (list ,@(map (compose string->symbol
-                                          upstream-input-downstream-name)
-                                 package-inputs)))))))
-
 (define %requirement-name-regexp
   ;; Regexp to match the requirement name in a requirement specification.
 
@@ -538,10 +527,10 @@ (define (maybe-upstream-name name)
                             bytevector->nix-base32-string)))))
         ,@(maybe-upstream-name name)
         (build-system pyproject-build-system)
-        ,@(maybe-inputs (upstream-source-propagated-inputs source)
-                        'propagated-inputs)
-        ,@(maybe-inputs (upstream-source-native-inputs source)
-                        'native-inputs)
+        ,@(maybe-upstream-inputs 'propagated-inputs
+            (upstream-source-propagated-inputs source))
+        ,@(maybe-upstream-inputs 'native-inputs
+            (upstream-source-native-inputs source))
         (home-page ,(project-info-home-page info))
         (synopsis ,(project-info-summary info))
         (description ,(and=> (non-empty-string-or-false
-- 
2.45.2





Information forwarded to guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Wed, 04 Sep 2024 20:36:04 GMT) Full text and rfc822 format available.

Message #65 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Subject: [PATCH v2 07/12] import: elpa: Use maybe-propagated-inputse.
Date: Wed,  4 Sep 2024 22:33:01 +0200
* guix/import/elpa.scm (maybe-inputs): Delete procedure.
(elpa-package->sexp): Use maybe-propagated-inputs procedure.

Change-Id: I9b40e9d387311f5dbbb079938733bf945a1a6ee6
---
 guix/import/elpa.scm | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/guix/import/elpa.scm b/guix/import/elpa.scm
index 46b6dc98a2..9ade189a8a 100644
--- a/guix/import/elpa.scm
+++ b/guix/import/elpa.scm
@@ -359,13 +359,6 @@ (define dependencies
     (map (compose string->symbol elpa-name->package-name)
          dependencies-names))
 
-  (define (maybe-inputs input-type inputs)
-    (match inputs
-      (()
-       '())
-      ((inputs ...)
-       (list (list input-type `(list ,@inputs))))))
-
   (define melpa-source
     (melpa-recipe->origin melpa-recipe))
 
@@ -386,7 +379,7 @@ (define melpa-source
                                 (file-hash* tarball #:recursive? #false))
                                "failed to download package")))))))
       (build-system emacs-build-system)
-      ,@(maybe-inputs 'propagated-inputs dependencies)
+      ,@(maybe-propagated-inputs dependencies)
       ,@(if melpa-source
             (melpa-recipe->maybe-arguments melpa-recipe)
             '())
-- 
2.45.2





Information forwarded to guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Wed, 04 Sep 2024 20:36:05 GMT) Full text and rfc822 format available.

Message #68 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Subject: [PATCH v2 08/12] import: hackage: Use maybe-list-field.
Date: Wed,  4 Sep 2024 22:33:02 +0200
* guix/import/hackage.scm (maybe-inputs, maybe-arguments): Delete
procedures.
(hackage-module->sexp): Use maybe-list-field and maybe-upstream-inputs
procedures.
* tests/hackage.scm: Fix whitespace and replace quasiquote with list.

Change-Id: I4fe39ff84c9f6a677f810d9e4fe751d762973757
---
 guix/import/hackage.scm | 39 ++++++++++++---------------------------
 tests/hackage.scm       | 13 +++++++------
 2 files changed, 19 insertions(+), 33 deletions(-)

diff --git a/guix/import/hackage.scm b/guix/import/hackage.scm
index 79a51d3300..bd3bed146e 100644
--- a/guix/import/hackage.scm
+++ b/guix/import/hackage.scm
@@ -9,6 +9,7 @@
 ;;; Copyright © 2019 Simon Tournier <zimon.toutoune <at> gmail.com>
 ;;; Copyright © 2022 Hartmut Goebel <h.goebel <at> crazy-compilers.com>
 ;;; Copyright © 2023-2024 Ludovic Courtès <ludo <at> gnu.org>
+;;; Copyright © 2024 Herman Rimm <herman <at> rimm.ee>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -288,26 +289,6 @@ (define inputs
                           #:include-test-dependencies?
                           include-test-dependencies?))
 
-  (define (maybe-inputs input-type inputs)
-    (match inputs
-      (()
-       '())
-      ((inputs ...)
-       (list (list input-type
-                   `(list ,@(map (compose string->symbol
-                                          upstream-input-downstream-name)
-                                 inputs)))))))
-
-  (define (maybe-arguments)
-    (match (append (if (not include-test-dependencies?)
-                       '(#:tests? #f)
-                       '())
-                   (if (not (string-null? revision))
-                       `(#:cabal-revision (,revision ,cabal-hash))
-                       '()))
-      (() '())
-      (args `((arguments (,'quasiquote ,args))))))
-
   (let ((tarball (with-store store
                    (download-to-store store source-url))))
     (values
@@ -324,13 +305,17 @@ (define (maybe-arguments)
                          "failed to download tar archive")))))
         (build-system haskell-build-system)
         (properties '((upstream-name . ,name)))
-        ,@(maybe-inputs 'inputs
-                        (filter (upstream-input-type-predicate 'regular)
-                                inputs))
-        ,@(maybe-inputs 'native-inputs
-                        (filter (upstream-input-type-predicate 'native)
-                                inputs))
-        ,@(maybe-arguments)
+        ,@(maybe-upstream-inputs 'inputs
+            (filter (upstream-input-type-predicate 'regular) inputs))
+        ,@(maybe-upstream-inputs 'native-inputs
+            (filter (upstream-input-type-predicate 'native) inputs))
+        ,@(maybe-list-field 'arguments
+            (append (if (not include-test-dependencies?)
+                        '(#:tests? #f)
+                        '())
+                    (if (not (string-null? revision))
+                        `(#:cabal-revision '(,revision ,cabal-hash))
+                        '())))
         (home-page ,(cabal-package-home-page cabal))
         (synopsis ,(cabal-package-synopsis cabal))
         (description ,(beautify-description (cabal-package-description cabal)))
diff --git a/tests/hackage.scm b/tests/hackage.scm
index 403f587c41..f6d91515e2 100644
--- a/tests/hackage.scm
+++ b/tests/hackage.scm
@@ -67,7 +67,7 @@ (define test-cabal-3
   if impl(ghc>=7.2&&<7.6)
     Build-depends: ghc-b
   if impl(ghc == 7.8)
-    Build-depends: 
+    Build-depends:
       HTTP       >= 4000.2.5 && < 4000.3,
       mtl        >= 2.0      && < 3
 ")
@@ -86,7 +86,7 @@ (define test-cabal-4
   if impl(ghc>=7.2&&<7.6)
     Build-depends: ghc-b
   if impl(ghc == 7.8)
-    Build-depends: 
+    Build-depends:
       HTTP       >= 4000.2.5 && < 4000.3,
       mtl        >= 2.0      && < 3
 ")
@@ -101,7 +101,7 @@ (define test-cabal-5
 license: BSD3
 library
   if impl(ghc == 7.8)
-    Build-depends: 
+    Build-depends:
       HTTP       >= 4000.2.5 && < 4000.3,
   if impl(ghc -any)
     Build-depends: mtl        >= 2.0      && < 3
@@ -126,7 +126,7 @@ (define test-cabal-6
   if impl(ghc>=7.2&&<7.6)
     Build-depends: ghc-b
   if impl(ghc == 7.8)
-    Build-depends: 
+    Build-depends:
       HTTP       >= 4000.2.5 && < 4000.3,
       mtl        >= 2.0      && < 3
 ")
@@ -524,8 +524,9 @@ (define-package-matcher match-ghc-foo-revision
     ('properties '(quote ((upstream-name . "foo"))))
     ('inputs ('list 'ghc-http))
     ('arguments
-     ('quasiquote
-      ('#:cabal-revision
+     ('list
+      '#:cabal-revision
+      ('quote
        ("2" "0xxd88fb659f0krljidbvvmkh9ppjnx83j0nqzx8whcg4n5qbyng"))))
     ('home-page "http://test.org")
     ('synopsis (? string?))
-- 
2.45.2





Information forwarded to guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Wed, 04 Sep 2024 20:36:05 GMT) Full text and rfc822 format available.

Message #71 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Subject: [PATCH v2 09/12] import: cran: Refactor format-inputs and use
 maybe-list-field.
Date: Wed,  4 Sep 2024 22:33:03 +0200
* guix/import/cran.scm (format-inputs): Split and move procedure ...
(maybe-inputs): ... to here, and use maybe-list-field procedure.

Change-Id: I5148afcebdac1f7fa0f8cce9e82e8cebb56c36c8
---
 guix/import/cran.scm | 36 ++++++++++++++++--------------------
 1 file changed, 16 insertions(+), 20 deletions(-)

diff --git a/guix/import/cran.scm b/guix/import/cran.scm
index 6ae00cae96..bdac059053 100644
--- a/guix/import/cran.scm
+++ b/guix/import/cran.scm
@@ -6,6 +6,7 @@
 ;;; Copyright © 2021 Sarah Morgensen <iskarian <at> mgsn.dev>
 ;;; Copyright © 2021 Simon Tournier <zimon.toutoune <at> gmail.com>
 ;;; Copyright © 2022 Hartmut Goebel <h.goebel <at> crazy-compilers.com>
+;;; Copyright © 2024 Herman Rimm <herman <at> rimm.ee>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -85,21 +86,6 @@ (define-module (guix import cran)
 (define %input-style
   (make-parameter 'variable)) ; or 'specification
 
-(define (format-inputs inputs)
-  "Generate a sorted list of package inputs from a list of upstream inputs."
-  (map (lambda (input)
-         (case (%input-style)
-           ((specification)
-            `(specification->package ,(upstream-input-downstream-name input)))
-           (else
-            ((compose string->symbol
-                       upstream-input-downstream-name)
-             input))))
-       (sort inputs
-             (lambda (a b)
-               (string-ci<? (upstream-input-name a)
-                            (upstream-input-name b))))))
-
 (define (string->licenses license-string license-prefix)
   (let ((licenses
          (map string-trim-both
@@ -188,11 +174,21 @@ (define (description->alist description)
 (define* (maybe-inputs package-inputs #:optional (input-type 'inputs))
   "Given a list of PACKAGE-INPUTS, tries to generate the TYPE field of a
 package definition."
-  (match package-inputs
-    (()
-     '())
-    ((package-inputs ...)
-     `((,input-type (list ,@(format-inputs package-inputs)))))))
+  (define (format-input input)
+    (case (%input-style)
+      ((specification)
+       `(specification->package ,(upstream-input-downstream-name input)))
+      (else
+       ((compose string->symbol
+                  upstream-input-downstream-name)
+        input))))
+
+  (define (upstream-input-name<? i1 i2)
+    (string-ci<? (upstream-input-name i1)
+                 (upstream-input-name i2)))
+
+  (maybe-list-field input-type
+    (map format-input (sort package-inputs upstream-input-name<?))))
 
 (define %cran-url "https://cloud.r-project.org/web/packages/")
 (define %cran-canonical-url "https://cran.r-project.org/package=")
-- 
2.45.2





Information forwarded to guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Wed, 04 Sep 2024 20:36:06 GMT) Full text and rfc822 format available.

Message #74 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Subject: [PATCH v2 10/12] import: cpan: Use maybe-upstream-inputs.
Date: Wed,  4 Sep 2024 22:33:04 +0200
* guix/import/cpan.scm (maybe-inputs): Delete procedure.
(cpan-module->sexp): Use maybe-upstream-inputs procedure.

Change-Id: I4fa99da62d81f02c2998ad96f5ea81e27df071cd
---
 guix/import/cpan.scm | 23 +++++++----------------
 1 file changed, 7 insertions(+), 16 deletions(-)

diff --git a/guix/import/cpan.scm b/guix/import/cpan.scm
index b87736eef6..611ea63eba 100644
--- a/guix/import/cpan.scm
+++ b/guix/import/cpan.scm
@@ -5,6 +5,7 @@
 ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me <at> tobias.gr>
 ;;; Copyright © 2020, 2021, 2023 Ludovic Courtès <ludo <at> gnu.org>
 ;;; Copyright © 2022 Hartmut Goebel <h.goebel <at> crazy-compilers.com>
+;;; Copyright © 2024 Herman Rimm <herman <at> rimm.ee>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -37,7 +38,8 @@ (define-module (guix import cpan)
   #:use-module (guix utils)
   #:use-module (guix base32)
   #:use-module ((guix download) #:select (download-to-store url-fetch))
-  #:use-module ((guix import utils) #:select (factorize-uri))
+  #:use-module ((guix import utils) #:select (factorize-uri
+                                              maybe-upstream-inputs))
   #:use-module (guix import json)
   #:use-module (guix packages)
   #:use-module (guix upstream)
@@ -275,15 +277,6 @@ (define name
   (define version (cpan-release-version release))
   (define source-url (cpan-source-url release))
 
-  (define (maybe-inputs input-type inputs)
-    (match inputs
-      (()
-       '())
-      ((inputs ...)
-       `((,input-type (list ,@(map (compose string->symbol
-                                            upstream-input-downstream-name)
-                                   inputs)))))))
-
   (let ((tarball (with-store store
                    (download-to-store store source-url)))
         (inputs (cpan-module-inputs release)))
@@ -297,12 +290,10 @@ (define (maybe-inputs input-type inputs)
                   (base32
                    ,(bytevector->nix-base32-string (file-sha256 tarball))))))
        (build-system perl-build-system)
-       ,@(maybe-inputs 'native-inputs
-                       (filter (upstream-input-type-predicate 'native)
-                               inputs))
-       ,@(maybe-inputs 'propagated-inputs
-                       (filter (upstream-input-type-predicate 'propagated)
-                               inputs))
+       ,@(maybe-upstream-inputs 'native-inputs
+           (filter (upstream-input-type-predicate 'native) inputs))
+       ,@(maybe-upstream-inputs 'propagated-inputs
+           (filter (upstream-input-type-predicate 'propagated) inputs))
        (home-page ,(cpan-home name))
        (synopsis ,(cpan-release-abstract release))
        (description fill-in-yourself!)
-- 
2.45.2





Information forwarded to guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Wed, 04 Sep 2024 20:36:06 GMT) Full text and rfc822 format available.

Message #77 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Subject: [PATCH v2 11/12] import: egg: Use maybe-*inputs procedures.
Date: Wed,  4 Sep 2024 22:33:05 +0200
* guix/import/egg.scm (maybe-inputs): Delete procedure.
(egg-parse-dependency): Simplify procedure to return strings.
(egg->guix-package): Use maybe-*inputs procedures.

Change-Id: Ib0a3f5b6f02912c847defd02ba7675d80005279b
---
 guix/import/egg.scm | 39 +++++++++++----------------------------
 1 file changed, 11 insertions(+), 28 deletions(-)

diff --git a/guix/import/egg.scm b/guix/import/egg.scm
index e3bc158475..97d09a7c9d 100644
--- a/guix/import/egg.scm
+++ b/guix/import/egg.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2021 Tobias Geerinckx-Rice <me <at> tobias.gr>
 ;;; Copyright © 2021 Sarah Morgensen <iskarian <at> mgsn.dev>
 ;;; Copyright © 2022 Hartmut Goebel <h.goebel <at> crazy-compilers.com>
+;;; Copyright © 2024 Herman Rimm <herman <at> rimm.ee>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -229,23 +230,14 @@ (define (prettify-system-dependency name)
                           (else char)))
                       (maybe-symbol->string name)))
 
-        (define* (egg-parse-dependency name #:key (system? #f))
-          (define extract-name
-            (match-lambda
-              ((name version) name)
-              (name name)))
-
-          (define (prettify-name name)
+        (define* (egg-parse-dependency dependency #:key (system? #f))
+          (let ((name (match dependency
+                        ((name version) name)
+                        (name name))))
             (if system?
                 (prettify-system-dependency name)
-                (maybe-symbol->string name)))
-          
-          (let ((name (prettify-name (extract-name name))))
-            ;; Dependencies are sometimes specified as symbols and sometimes
-            ;; as strings
-            (string->symbol (string-append
-                             (if system? "" package-name-prefix)
-                             name))))
+                (string-append package-name-prefix
+                               (maybe-symbol->string name)))))
 
         (define egg-propagated-inputs
           (let ((dependencies (assoc-ref egg-content 'dependencies)))
@@ -277,15 +269,6 @@ (define egg-native-inputs
                               test+build-dependencies))
               (() '()))))
 
-        ;; Copied from (guix import hackage).
-        (define (maybe-inputs input-type inputs)
-          (match inputs
-            (()
-             '())
-            ((inputs ...)
-             (list (list input-type
-                         `(list ,@inputs))))))
-
         (values
          `(package
             (name ,(egg-name->guix-name name))
@@ -303,16 +286,16 @@ (define (maybe-inputs input-type inputs)
                                    "failed to download tar archive"))))))
             (build-system chicken-build-system)
             (arguments ,(list 'quasiquote (list #:egg-name name)))
-            ,@(maybe-inputs 'native-inputs egg-native-inputs)
-            ,@(maybe-inputs 'inputs egg-inputs)
-            ,@(maybe-inputs 'propagated-inputs egg-propagated-inputs)
+            ,@(maybe-native-inputs egg-native-inputs)
+            ,@(maybe-inputs egg-inputs)
+            ,@(maybe-propagated-inputs egg-propagated-inputs)
             (home-page ,egg-home-page)
             (synopsis ,egg-synopsis)
             (description #f)
             (license ,egg-licenses))
          (filter (lambda (name)
                    (not (member name '("srfi-4"))))
-                 (map (compose guix-name->egg-name symbol->string)
+                 (map guix-name->egg-name
                       (append egg-propagated-inputs
                               egg-native-inputs)))))))
 
-- 
2.45.2





Information forwarded to guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Wed, 04 Sep 2024 20:36:07 GMT) Full text and rfc822 format available.

Message #80 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Subject: [PATCH v2 12/12] import: hexpm: Use maybe-inputs.
Date: Wed,  4 Sep 2024 22:33:06 +0200
* guix/import/hexpm.scm (maybe-inputs): Delete procedure.
(dependencies->package-names): Adjust description and return strings.
(make-hexpm-sexp): Use maybe-inputs procedure.

Change-Id: Ie7a8a630a3a9d4859453d49fdee42aa560e27f17
---
 guix/import/hexpm.scm | 29 +++++++++--------------------
 1 file changed, 9 insertions(+), 20 deletions(-)

diff --git a/guix/import/hexpm.scm b/guix/import/hexpm.scm
index 71a54ba973..aa857facbc 100644
--- a/guix/import/hexpm.scm
+++ b/guix/import/hexpm.scm
@@ -5,6 +5,7 @@
 ;;; Copyright © 2019 Martin Becze <mjbecze <at> riseup.net>
 ;;; Copyright © 2019 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
 ;;; Copyright © 2020-2022 Hartmut Goebel <h.goebel <at> crazy-compilers.com>
+;;; Copyright © 2024 Herman Rimm <herman <at> rimm.ee>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -153,26 +154,14 @@ (define (lookup-hexpm-release version*)
 ;;; Converting hex.pm packages to Guix packages.
 ;;;
 
-(define (maybe-inputs package-inputs input-type)
-  "Given a list of PACKAGE-INPUTS, tries to generate the 'inputs' field of a
-package definition.  INPUT-TYPE, a symbol, is used to populate the name of
-the input field."
-  (match package-inputs
-    (()
-     '())
-    ((package-inputs ...)
-     `((,input-type (list ,@package-inputs))))))
-
 (define (dependencies->package-names names)
-  "Given a list of hexpm package NAMES, returns a list of guix package names
-as symbols."
-  ;; TODO: Base name on language of dependency.
-  ;; The language used for implementing the dependency is not know without
-  ;; recursing the dependencies.  So for now assume more packages are based on
-  ;; Erlang and prefix all dependencies with "erlang-" (the default).
-  (map string->symbol
-       (map hexpm-name->package-name
-            (sort names string-ci<?))))
+  "Given NAMES, a list of hexpm dependencies, return a list of guix
+package names."
+  ;; TODO: Base name on the programming language of the dependency.
+  ;; The language used for implementing the dependency can only be known
+  ;; by traversing the dependencies.  So for now assume packages are
+  ;; based on Erlang, and prefix dependencies with "erlang-" by default.
+  (map hexpm-name->package-name (sort names string-ci<?)))
 
 (define* (make-hexpm-sexp #:key name version tarball-url
                           home-page synopsis description license
@@ -194,7 +183,7 @@ (define* (make-hexpm-sexp #:key name version tarball-url
                    (uri (hexpm-uri ,name version))
                    (sha256 (base32 ,(guix-hash-url temp)))))
          (build-system ,build-system)
-         ,@(maybe-inputs (dependencies->package-names dependencies) 'inputs)
+         ,@(maybe-inputs (dependencies->package-names dependencies))
          (synopsis ,synopsis)
          (description ,(beautify-description description))
          (home-page ,(match home-page
-- 
2.45.2





Information forwarded to guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Tue, 24 Sep 2024 20:22:02 GMT) Full text and rfc822 format available.

Message #83 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Subject: [PATCH v3 00/11] Add (guix import utils) procedures.
Date: Tue, 24 Sep 2024 22:13:06 +0200
Hello,

The fix for #72939 reverts the commit for which I had provided a
modified version in the first revision of this series.  It does not
introduce the bug in #72939.  Also, revision v2 of this series would
have fixed that bug.  I assume that unfortunately, once again, I had not
CC'ed any maintainers the second revision.  Now, I have created a third
revision, two patches fewer than the first.  One commit had adjusted
tests/go.scm to the new-style inputs, which a remaining commit from the
same series as the reverted commit does instead.  The other commit fixed
tests/elm.scm, but now 7979001c58fcadd98bae09781c495f0a462d6e04 does
that instead.  Hopefully this revision does get reviewed, or (re)starts
some discussion.

Cheers,
Herman

Herman Rimm (9):
  build-system: cargo: Accept unlabeled #:cargo-inputs.
  import: utils: Add 'maybe-upstream-inputs' procedure.
  import: pypi: Use 'maybe-list-field' procedure.
  import: elpa: Use maybe-propagated-inputs procedure.
  import: hackage: Use 'maybe-list-field' procedure.
  import: cran: Use 'maybe-list-field' procedure.
  import: cpan: Use 'maybe-upstream-inputs' procedure.
  import: egg: Use maybe-*inputs procedures.
  import: hexpm: Use (guix import utils) 'maybe-inputs' procedure.

Sarah Morgensen (2):
  import: utils: Emit new-style package inputs.
  import: crate: Emit new-style package inputs.

 guix/build-system/cargo.scm |  12 ++--
 guix/import/cpan.scm        |  23 +++----
 guix/import/cran.scm        |  36 +++++------
 guix/import/crate.scm       |  51 ++++++----------
 guix/import/egg.scm         |  39 ++++--------
 guix/import/elpa.scm        |   9 +--
 guix/import/hackage.scm     |  39 ++++--------
 guix/import/hexpm.scm       |  29 +++------
 guix/import/pypi.scm        |  21 ++-----
 guix/import/utils.scm       |  61 +++++++++++-------
 tests/crate.scm             | 119 +++++++++++++++---------------------
 tests/hackage.scm           |  13 ++--
 12 files changed, 180 insertions(+), 272 deletions(-)


base-commit: 3ac69c1a757430d6dfdd37eb948ba1d6967967cc
-- 
2.45.2





Information forwarded to efraim <at> flashner.co.il, guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Tue, 24 Sep 2024 20:22:03 GMT) Full text and rfc822 format available.

Message #86 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Subject: [PATCH v3 01/11] build-system: cargo: Accept unlabeled #:cargo-inputs.
Date: Tue, 24 Sep 2024 22:13:07 +0200
* guix/build-system/cargo.scm (crate-closure): Match unlabeled inputs.

Change-Id: Iae421281fa08d09ddd1e5d2da2864f0093d97cd1
---
 guix/build-system/cargo.scm | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/guix/build-system/cargo.scm b/guix/build-system/cargo.scm
index 658a2e525e..2e3061c0e8 100644
--- a/guix/build-system/cargo.scm
+++ b/guix/build-system/cargo.scm
@@ -6,6 +6,7 @@
 ;;; Copyright © 2019 Ivan Petkov <ivanppetkov <at> gmail.com>
 ;;; Copyright © 2020 Jakub Kądziołka <kuba <at> kadziolka.net>
 ;;; Copyright © 2021 Efraim Flashner <efraim <at> flashner.co.il>
+;;; Copyright © 2024 Herman Rimm <herman <at> rimm.ee>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -234,11 +235,14 @@ (define (crate-closure inputs)
        (if (null? propagated)
            (reverse result)
            (loop (reverse (concatenate propagated)) result '() #f seen)))
-      (((and input (label (? package? package))) rest ...)
+      ;; Match inputs with labels for backward compatibility.
+      (((or (_ (? package? package))
+            (? package? package))
+        rest ...)
        (if (and (not first?) (seen? seen package))
            (loop rest result propagated first? seen)
            (loop rest
-                 (cons input result)
+                 (cons package result)
                  (cons (package-cargo-inputs package)
                        propagated)
                  first?
@@ -296,8 +300,8 @@ (define (expand-crate-sources cargo-inputs cargo-development-inputs)
   something that can always be extended or reworked in the future)."
   (filter-map
     (match-lambda
-      ((label (? package? p))
-       (list label (package-source p)))
+      ((? package? p)
+       (list (package-name p) (package-source p)))
       ((label input)
        (list label input)))
     (crate-closure (append cargo-inputs cargo-development-inputs))))
-- 
2.45.2





Information forwarded to efraim <at> flashner.co.il, guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Tue, 24 Sep 2024 20:22:03 GMT) Full text and rfc822 format available.

Message #89 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Cc: Sarah Morgensen <iskarian <at> mgsn.dev>
Subject: [PATCH v3 03/11] import: crate: Emit new-style package inputs.
Date: Tue, 24 Sep 2024 22:13:09 +0200
From: Sarah Morgensen <iskarian <at> mgsn.dev>

* guix/import/crate.scm (maybe-cargo-inputs,
maybe-cargo-development-inputs, maybe-arguments): Delete procedures.
(make-crate-sexp): Add 'unwrap' procedure, use with maybe-packages-field
and fix indentation.
* tests/crate.scm: Adjust accordingly.

Change-Id: Ie8debd2553a338c3c623162b843e0a9827314074
---
 guix/import/crate.scm |  51 ++++++------------
 tests/crate.scm       | 119 +++++++++++++++++-------------------------
 2 files changed, 65 insertions(+), 105 deletions(-)

diff --git a/guix/import/crate.scm b/guix/import/crate.scm
index 84c178ea3e..5110e6124f 100644
--- a/guix/import/crate.scm
+++ b/guix/import/crate.scm
@@ -7,6 +7,7 @@
 ;;; Copyright © 2023 Simon Tournier <zimon.toutoune <at> gmail.com>
 ;;; Copyright © 2023, 2024 Efraim Flashner <efraim <at> flashner.co.il>
 ;;; Copyright © 2023, 2024 David Elsing <david.elsing <at> posteo.net>
+;;; Copyright © 2024 Herman Rimm <herman <at> rimm.ee>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -158,27 +159,6 @@ (define* (package-names->package-inputs names #:optional (output #f))
          (input (make-input input #f)))
        names))
 
-(define (maybe-cargo-inputs package-names)
-  (match (package-names->package-inputs package-names)
-    (()
-     '())
-    ((package-inputs ...)
-     `(#:cargo-inputs ,package-inputs))))
-
-(define (maybe-cargo-development-inputs package-names)
-  (match (package-names->package-inputs package-names)
-    (()
-     '())
-    ((package-inputs ...)
-     `(#:cargo-development-inputs ,package-inputs))))
-
-(define (maybe-arguments arguments)
-  (match arguments
-    (()
-     '())
-    ((args ...)
-     `((arguments (,'quasiquote ,args))))))
-
 (define (version->semver-prefix version)
   "Return the version up to and including the first non-zero part"
   (first
@@ -202,8 +182,14 @@ (define* (make-crate-sexp #:key name version cargo-inputs cargo-development-inpu
 
   (let* ((port (http-fetch (crate-uri name version)))
          (guix-name (crate-name->package-name name))
-         (cargo-inputs (format-inputs cargo-inputs))
-         (cargo-development-inputs (format-inputs cargo-development-inputs))
+         (unwrap (match-lambda
+                   ((lst) lst)
+                   (() '())))
+         (cargo-inputs (maybe-packages-field '#:cargo-inputs
+                         (format-inputs cargo-inputs)))
+         (cargo-development-inputs
+           (maybe-packages-field '#:cargo-development-inputs
+             (format-inputs cargo-development-inputs)))
          (description (beautify-description description))
          (pkg `(package
                    (name ,guix-name)
@@ -222,12 +208,10 @@ (define* (make-crate-sexp #:key name version cargo-inputs cargo-development-inpu
                          `((properties '((crate-version-yanked? . #t))))
                          '())
                    (build-system cargo-build-system)
-                   ,@(maybe-arguments (append (if build?
-                                                 '()
-                                                 '(#:skip-build? #t))
-                                              (maybe-cargo-inputs cargo-inputs)
-                                              (maybe-cargo-development-inputs
-                                                cargo-development-inputs)))
+                   ,@(maybe-list-field 'arguments
+                       (append (if build? '() '(#:skip-build? #t))
+                               (unwrap cargo-inputs)
+                               (unwrap cargo-development-inputs)))
                    (home-page ,home-page)
                    (synopsis ,(beautify-synopsis synopsis))
                    (description ,(if (string-prefix? "This" description)
@@ -239,11 +223,10 @@ (define* (make-crate-sexp #:key name version cargo-inputs cargo-development-inpu
                                (#f #f)
                                ((license) license)
                                (_ `(list ,@license)))))))
-         (close-port port)
-         (package->definition pkg
-                              (if yanked?
-                                  (string-append version "-yanked")
-                                  (version->semver-prefix version)))))
+    (close-port port)
+    (package->definition pkg (if yanked?
+                                 (string-append version "-yanked")
+                                 (version->semver-prefix version)))))
 
 (define (string->license string)
   (filter-map (lambda (license)
diff --git a/tests/crate.scm b/tests/crate.scm
index 5b4ad08c3c..8e3da2e72c 100644
--- a/tests/crate.scm
+++ b/tests/crate.scm
@@ -5,6 +5,8 @@
 ;;; Copyright © 2020 Martin Becze <mjbecze <at> riseup.net>
 ;;; Copyright © 2023 Efraim Flashner <efraim <at> flashner.co.il>
 ;;; Copyright © 2023 David Elsing <david.elsing <at> posteo.net>
+;;; Copyright © 2021 Sarah Morgensen <iskarian <at> mgsn.dev>
+;;; Copyright © 2024 Herman Rimm <herman <at> rimm.ee>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -497,10 +499,10 @@ (define have-guile-semver?
                            (?  string? hash)))))
                       (build-system 'cargo-build-system)
                       (arguments
-                       ('quasiquote
-                        (#:skip-build? #t
+                       (list
+                         #:skip-build? #t
                          #:cargo-inputs
-                         (("rust-leaf-alice" ('unquote 'rust-leaf-alice-0.7))))))
+                         (list rust-leaf-alice-0.7)))
                       (home-page "http://example.com")
                       (synopsis "summary")
                       (description "This package provides summary.")
@@ -589,7 +591,7 @@ (define have-guile-semver?
                      (?  string? hash)))))
                 (build-system cargo-build-system)
                 (arguments
-                 ('quasiquote (#:skip-build? #t)))
+                 (list #:skip-build? #t))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "This package provides summary.")
@@ -608,7 +610,7 @@ (define have-guile-semver?
                     (base32
                      (?  string? hash)))))
                 (build-system cargo-build-system)
-                (arguments ('quasiquote (#:skip-build? #t)))
+                (arguments (list #:skip-build? #t))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "This package provides summary.")
@@ -627,7 +629,7 @@ (define have-guile-semver?
                     (base32
                      (?  string? hash)))))
                 (build-system cargo-build-system)
-                (arguments ('quasiquote (#:skip-build? #t)))
+                (arguments (list #:skip-build? #t))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "This package provides summary.")
@@ -647,10 +649,9 @@ (define have-guile-semver?
                      (?  string? hash)))))
                 (build-system cargo-build-system)
                 (arguments
-                 ('quasiquote (#:skip-build? #t
-                               #:cargo-inputs
-                               (("rust-leaf-bob"
-                                 ('unquote rust-leaf-bob-3))))))
+                 (list #:skip-build? #t
+                       #:cargo-inputs
+                       (list rust-leaf-bob-3)))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "This package provides summary.")
@@ -670,14 +671,11 @@ (define have-guile-semver?
                      (?  string? hash)))))
                 (build-system cargo-build-system)
                 (arguments
-                 ('quasiquote (#:skip-build? #t
-                               #:cargo-inputs
-                               (("rust-intermediate-b"
-                                 ('unquote rust-intermediate-b-1))
-                                ("rust-leaf-alice"
-                                 ('unquote 'rust-leaf-alice-0.7))
-                                ("rust-leaf-bob"
-                                 ('unquote rust-leaf-bob-3))))))
+                 (list #:skip-build? #t
+                       #:cargo-inputs
+                       (list rust-intermediate-b-1
+                             rust-leaf-alice-0.7
+                             rust-leaf-bob-3)))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "This package provides summary.")
@@ -697,18 +695,13 @@ (define have-guile-semver?
                      (?  string? hash)))))
                 (build-system cargo-build-system)
                 (arguments
-                 ('quasiquote (#:cargo-inputs
-                               (("rust-intermediate-a"
-                                 ('unquote rust-intermediate-a-1))
-                                ("rust-intermediate-b"
-                                 ('unquote rust-intermediate-b-1))
-                                ("rust-leaf-alice"
-                                 ('unquote 'rust-leaf-alice-0.7))
-                                ("rust-leaf-bob"
-                                 ('unquote rust-leaf-bob-3)))
-                               #:cargo-development-inputs
-                               (("rust-intermediate-c"
-                                 ('unquote rust-intermediate-c-1))))))
+                 (list #:cargo-inputs
+                       (list rust-intermediate-a-1
+                             rust-intermediate-b-1
+                             rust-leaf-alice-0.7
+                             rust-leaf-bob-3)
+                       #:cargo-development-inputs
+                       ((list rust-intermediate-c-1))))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "This package provides summary.")
@@ -735,9 +728,8 @@ (define have-guile-semver?
                      (?  string? hash)))))
                 (build-system cargo-build-system)
                 (arguments
-                 ('quasiquote (#:cargo-development-inputs
-                               (("rust-leaf-alice"
-                                 ('unquote rust-leaf-alice-0.7))))))
+                 (list #:cargo-development-inputs
+                       (list rust-leaf-alice-0.7)))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "This package provides summary.")
@@ -793,9 +785,8 @@ (define have-guile-semver?
                      (?  string? hash)))))
                 (build-system cargo-build-system)
                 (arguments
-                 ('quasiquote (#:cargo-inputs
-                               (("rust-leaf-bob"
-                                 ('unquote rust-leaf-bob-3))))))
+                 (list #:cargo-inputs
+                       (list rust-leaf-bob-3)))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "This package provides summary.")
@@ -815,13 +806,10 @@ (define have-guile-semver?
                      (?  string? hash)))))
                 (build-system cargo-build-system)
                 (arguments
-                 ('quasiquote (#:cargo-inputs
-                               (("rust-intermediate-b"
-                                 ('unquote rust-intermediate-b-1))
-                                ("rust-leaf-alice"
-                                 ('unquote 'rust-leaf-alice-0.7))
-                                ("rust-leaf-bob"
-                                 ('unquote rust-leaf-bob-3))))))
+                 (list #:cargo-inputs
+                       (list rust-intermediate-b-1
+                             rust-leaf-alice-0.7
+                             rust-leaf-bob-3)))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "This package provides summary.")
@@ -841,18 +829,13 @@ (define have-guile-semver?
                      (?  string? hash)))))
                 (build-system cargo-build-system)
                 (arguments
-                 ('quasiquote (#:cargo-inputs
-                               (("rust-intermediate-a"
-                                 ('unquote rust-intermediate-a-1))
-                                ("rust-intermediate-b"
-                                 ('unquote rust-intermediate-b-1))
-                                ("rust-leaf-alice"
-                                 ('unquote 'rust-leaf-alice-0.7))
-                                ("rust-leaf-bob"
-                                 ('unquote rust-leaf-bob-3)))
-                               #:cargo-development-inputs
-                               (("rust-intermediate-c"
-                                 ('unquote rust-intermediate-c-1))))))
+                 (list #:cargo-inputs
+                       (list rust-intermediate-a-1
+                             rust-intermediate-b-1
+                             rust-leaf-alice-0.7
+                             rust-leaf-bob-3)
+                       #:cargo-development-inputs
+                       (list rust-intermediate-c-1)))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "This package provides summary.")
@@ -962,14 +945,11 @@ (define rust-leaf-bob-3.0.2-yanked
                  (?  string? hash)))))
             (build-system cargo-build-system)
             (arguments
-             ('quasiquote (#:cargo-inputs
-                           (("rust-leaf-bob"
-                             ('unquote 'rust-leaf-bob-3)))
-                           #:cargo-development-inputs
-                           (("rust-leaf-bob"
-                             ('unquote 'rust-leaf-bob-3.0.2-yanked))
-                            ("rust-leaf-bob"
-                             ('unquote 'rust-leaf-bob-4.0.0-yanked))))))
+             (list #:cargo-inputs
+                   (list rust-leaf-bob-3)
+                   #:cargo-development-inputs
+                   (list rust-leaf-bob-3.0.2-yanked
+                         rust-leaf-bob-4.0.0-yanked)))
             (home-page "http://example.com")
             (synopsis "summary")
             (description "This package provides summary.")
@@ -1093,14 +1073,11 @@ (define rust-leaf-bob-3.0.2-yanked
                      (?  string? hash)))))
                 (build-system cargo-build-system)
                 (arguments
-                 ('quasiquote (#:cargo-inputs
-                               (("rust-leaf-bob"
-                                 ('unquote 'rust-leaf-bob-3)))
-                               #:cargo-development-inputs
-                               (("rust-leaf-bob"
-                                 ('unquote 'rust-leaf-bob-3.0.2-yanked))
-                                ("rust-leaf-bob"
-                                 ('unquote 'rust-leaf-bob-4.0.0-yanked))))))
+                 (list #:cargo-inputs
+                       (list rust-leaf-bob-3)
+                       #:cargo-development-inputs
+                       (list rust-leaf-bob-3.0.2-yanked
+                             rust-leaf-bob-4.0.0-yanked)))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "This package provides summary.")
-- 
2.45.2





Information forwarded to guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Tue, 24 Sep 2024 20:22:04 GMT) Full text and rfc822 format available.

Message #92 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Cc: Sarah Morgensen <iskarian <at> mgsn.dev>
Subject: [PATCH v3 02/11] import: utils: Emit new-style package inputs.
Date: Tue, 24 Sep 2024 22:13:08 +0200
From: Sarah Morgensen <iskarian <at> mgsn.dev>

* guix/import/utils.scm (package-names->package-inputs)[make-input]:
Return new-style package inputs.
(maybe-list-field): Add procedure, which wraps BODY in 'list' instead of
'quasiquote'.
(maybe-packages-field): Add procedure.
(maybe-inputs): Use maybe-packages-field.
(maybe-native-inputs): Use maybe-packages-field.
(maybe-propagated-inputs): Use maybe-packages-field.

Change-Id: I66588f4c822d507ddbaf465a268bfb71af8a7ecd
---
 guix/import/utils.scm | 52 +++++++++++++++++++++++++------------------
 1 file changed, 30 insertions(+), 22 deletions(-)

diff --git a/guix/import/utils.scm b/guix/import/utils.scm
index b7756fcc40..88a1db4a88 100644
--- a/guix/import/utils.scm
+++ b/guix/import/utils.scm
@@ -13,6 +13,7 @@
 ;;; Copyright © 2022 Alice Brenon <alice.brenon <at> ens-lyon.fr>
 ;;; Copyright © 2022 Kyle Meyer <kyle <at> kyleam.com>
 ;;; Copyright © 2022 Philip McGrath <philip <at> philipmcgrath.com>
+;;; Copyright © 2024 Herman Rimm <herman <at> rimm.ee>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -65,6 +66,8 @@ (define-module (guix import utils)
             guix-hash-url
 
             package-names->package-inputs
+            maybe-list-field
+            maybe-packages-field
             maybe-inputs
             maybe-native-inputs
             maybe-propagated-inputs
@@ -418,39 +421,44 @@ (define* (package-names->package-inputs names #:optional (output #f))
 optional OUTPUT, tries to generate a quoted list of inputs, as suitable to
 use in an 'inputs' field of a package definition."
   (define (make-input input version)
-    (let ((name (if version (string-append input "-" version) input)))
+    (let ((symbol (string->symbol
+                    (if version
+                        (string-append input "-" version)
+                        input))))
       (if output
-          (list (string->symbol name) output)
-          (string->symbol name))))
+          (list symbol output)
+          symbol)))
 
   (map (match-lambda
          ((input version) (make-input input version))
          (input (make-input input #f)))
        names))
 
-(define* (maybe-inputs package-names #:optional (output #f)
-                       #:key (type #f))
-  "Given a list of PACKAGE-NAMES, tries to generate the 'inputs' field of a
-package definition.  TYPE can be used to specify the type of the inputs;
-either the 'native or 'propagated symbols are accepted.  Left unspecified, the
-snippet generated is for regular inputs."
-  (let ((field-name (match type
-                      ('native 'native-inputs)
-                      ('propagated 'propagated-inputs)
-                      (_ 'inputs))))
-    (match (package-names->package-inputs package-names output)
-      (()
-       '())
-      ((package-inputs ...)
-       `((,field-name (list ,@package-inputs)))))))
+(define* (maybe-list-field type body)
+  "Generates the TYPE field of a package definition if its value, BODY,
+is a non-empty list."
+  (match body
+    (() '())
+    ((? list?) (list (list type (cons 'list body))))))
+
+(define* (maybe-packages-field type package-names
+                               #:optional (output #f))
+  "Given a list of PACKAGE-NAMES, tries to generate the TYPE field of a
+package definition."
+  (maybe-list-field type
+    (package-names->package-inputs package-names output)))
+
+(define* (maybe-inputs package-names #:optional (output #f))
+  "MAYBE-PACKAGES-FIELD for inputs."
+  (maybe-packages-field 'inputs package-names output))
 
 (define* (maybe-native-inputs package-names #:optional (output #f))
-  "Same as MAYBE-INPUTS, but for native inputs."
-  (maybe-inputs package-names output #:type 'native))
+  "MAYBE-PACKAGES-FIELD for native inputs."
+  (maybe-packages-field 'native-inputs package-names output))
 
 (define* (maybe-propagated-inputs package-names #:optional (output #f))
-  "Same as MAYBE-INPUTS, but for propagated inputs."
-  (maybe-inputs package-names output #:type 'propagated))
+  "MAYBE-PACKAGES-FIELD for propagated inputs."
+  (maybe-packages-field 'propagated-inputs package-names output))
 
 (define* (package->definition guix-package #:optional append-version?/string)
   "If APPEND-VERSION?/STRING is #t, append the package's major+minor version.
-- 
2.45.2





Information forwarded to guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Tue, 24 Sep 2024 20:22:04 GMT) Full text and rfc822 format available.

Message #95 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Subject: [PATCH v3 04/11] import: utils: Add 'maybe-upstream-inputs' procedure.
Date: Tue, 24 Sep 2024 22:13:10 +0200
* guix/import/utils.scm (maybe-upstream-inputs): Add procedure.

Change-Id: Ib8a80216d512c0373e55e4f27e1ef2a7c1fb854a
---
 guix/import/utils.scm | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/guix/import/utils.scm b/guix/import/utils.scm
index 88a1db4a88..6d62b64433 100644
--- a/guix/import/utils.scm
+++ b/guix/import/utils.scm
@@ -45,6 +45,7 @@ (define-module (guix import utils)
   #:use-module (guix download)
   #:use-module (guix sets)
   #:use-module ((guix ui) #:select (fill-paragraph))
+  #:use-module (guix upstream)
   #:use-module (gnu packages)
   #:autoload   (ice-9 control) (let/ec)
   #:use-module (ice-9 match)
@@ -71,6 +72,7 @@ (define-module (guix import utils)
             maybe-inputs
             maybe-native-inputs
             maybe-propagated-inputs
+            maybe-upstream-inputs
             package->definition
 
             spdx-string->license
@@ -460,6 +462,13 @@ (define* (maybe-propagated-inputs package-names #:optional (output #f))
   "MAYBE-PACKAGES-FIELD for propagated inputs."
   (maybe-packages-field 'propagated-inputs package-names output))
 
+(define* (maybe-upstream-inputs type upstream-inputs)
+  "Given a list of UPSTREAM-NAMES, tries to generate the TYPE field of a
+package definition."
+  (maybe-list-field type
+    (map (compose string->symbol upstream-input-downstream-name)
+         upstream-inputs)))
+
 (define* (package->definition guix-package #:optional append-version?/string)
   "If APPEND-VERSION?/STRING is #t, append the package's major+minor version.
 If it is the symbol 'full, append the package's complete version.  If
-- 
2.45.2





Information forwarded to lars <at> 6xq.net, marius <at> gnu.org, me <at> bonfacemunyoki.com, sharlatanus <at> gmail.com, tanguy <at> bioneland.org, jgart <at> dismail.de, guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Tue, 24 Sep 2024 20:22:05 GMT) Full text and rfc822 format available.

Message #98 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Subject: [PATCH v3 05/11] import: pypi: Use 'maybe-list-field' procedure.
Date: Tue, 24 Sep 2024 22:13:11 +0200
* guix/import/pypi.scm (maybe-inputs): Delete procedure.
(make-pypi-sexp): Use 'maybe-list-field' and 'maybe-upstream-inputs'
procedures.
---
 guix/import/pypi.scm | 21 +++++----------------
 1 file changed, 5 insertions(+), 16 deletions(-)

diff --git a/guix/import/pypi.scm b/guix/import/pypi.scm
index 7b9f54a200..a98fdfa604 100644
--- a/guix/import/pypi.scm
+++ b/guix/import/pypi.scm
@@ -14,6 +14,7 @@
 ;;; Copyright © 2022 Vivien Kraus <vivien <at> planete-kraus.eu>
 ;;; Copyright © 2021 Simon Tournier <zimon.toutoune <at> gmail.com>
 ;;; Copyright © 2022 Hartmut Goebel <h.goebel <at> crazy-compilers.com>
+;;; Copyright © 2024 Herman Rimm <herman <at> rimm.ee>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -201,18 +202,6 @@ (define (wheel-url->extracted-directory wheel-url)
     ((name version _ ...)
      (string-append name "-" version ".dist-info"))))
 
-(define (maybe-inputs package-inputs input-type)
-  "Given a list of PACKAGE-INPUTS, tries to generate the 'inputs' field of a
-package definition.  INPUT-TYPE, a symbol, is used to populate the name of
-the input field."
-  (match package-inputs
-    (()
-     '())
-    ((package-inputs ...)
-     `((,input-type (list ,@(map (compose string->symbol
-                                          upstream-input-downstream-name)
-                                 package-inputs)))))))
-
 (define %requirement-name-regexp
   ;; Regexp to match the requirement name in a requirement specification.
 
@@ -538,10 +527,10 @@ (define* (make-pypi-sexp pypi-package
                             bytevector->nix-base32-string)))))
         ,@(maybe-upstream-name name)
         (build-system pyproject-build-system)
-        ,@(maybe-inputs (upstream-source-propagated-inputs source)
-                        'propagated-inputs)
-        ,@(maybe-inputs (upstream-source-native-inputs source)
-                        'native-inputs)
+        ,@(maybe-upstream-inputs 'propagated-inputs
+            (upstream-source-propagated-inputs source))
+        ,@(maybe-upstream-inputs 'native-inputs
+            (upstream-source-native-inputs source))
         (home-page ,(project-info-home-page info))
         (synopsis ,(project-info-summary info))
         (description ,(and=> (non-empty-string-or-false
-- 
2.45.2





Information forwarded to andrew <at> trop.in, cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com, guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Tue, 24 Sep 2024 20:22:05 GMT) Full text and rfc822 format available.

Message #101 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Subject: [PATCH v3 06/11] import: elpa: Use maybe-propagated-inputs procedure.
Date: Tue, 24 Sep 2024 22:13:12 +0200
* guix/import/elpa.scm (maybe-inputs): Delete procedure.
(elpa-package->sexp): Use maybe-propagated-inputs procedure.

Change-Id: I9b40e9d387311f5dbbb079938733bf945a1a6ee6
---
 guix/import/elpa.scm | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/guix/import/elpa.scm b/guix/import/elpa.scm
index 46b6dc98a2..9ade189a8a 100644
--- a/guix/import/elpa.scm
+++ b/guix/import/elpa.scm
@@ -359,13 +359,6 @@ (define* (elpa-package->sexp pkg #:optional license repo)
     (map (compose string->symbol elpa-name->package-name)
          dependencies-names))
 
-  (define (maybe-inputs input-type inputs)
-    (match inputs
-      (()
-       '())
-      ((inputs ...)
-       (list (list input-type `(list ,@inputs))))))
-
   (define melpa-source
     (melpa-recipe->origin melpa-recipe))
 
@@ -386,7 +379,7 @@ (define* (elpa-package->sexp pkg #:optional license repo)
                                 (file-hash* tarball #:recursive? #false))
                                "failed to download package")))))))
       (build-system emacs-build-system)
-      ,@(maybe-inputs 'propagated-inputs dependencies)
+      ,@(maybe-propagated-inputs dependencies)
       ,@(if melpa-source
             (melpa-recipe->maybe-arguments melpa-recipe)
             '())
-- 
2.45.2





Information forwarded to laurent.gatto <at> gmail.com, rekado <at> elephly.net, zimon.toutoune <at> gmail.com, guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Tue, 24 Sep 2024 20:22:06 GMT) Full text and rfc822 format available.

Message #104 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Subject: [PATCH v3 08/11] import: cran: Use 'maybe-list-field' procedure.
Date: Tue, 24 Sep 2024 22:13:14 +0200
* guix/import/cran.scm (format-inputs): Delete procedure.
(maybe-inputs): Use 'maybe-list-field' procedure.

Change-Id: I5148afcebdac1f7fa0f8cce9e82e8cebb56c36c8
---
 guix/import/cran.scm | 36 ++++++++++++++++--------------------
 1 file changed, 16 insertions(+), 20 deletions(-)

diff --git a/guix/import/cran.scm b/guix/import/cran.scm
index 6ae00cae96..bdac059053 100644
--- a/guix/import/cran.scm
+++ b/guix/import/cran.scm
@@ -6,6 +6,7 @@
 ;;; Copyright © 2021 Sarah Morgensen <iskarian <at> mgsn.dev>
 ;;; Copyright © 2021 Simon Tournier <zimon.toutoune <at> gmail.com>
 ;;; Copyright © 2022 Hartmut Goebel <h.goebel <at> crazy-compilers.com>
+;;; Copyright © 2024 Herman Rimm <herman <at> rimm.ee>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -85,21 +86,6 @@ (define-module (guix import cran)
 (define %input-style
   (make-parameter 'variable)) ; or 'specification
 
-(define (format-inputs inputs)
-  "Generate a sorted list of package inputs from a list of upstream inputs."
-  (map (lambda (input)
-         (case (%input-style)
-           ((specification)
-            `(specification->package ,(upstream-input-downstream-name input)))
-           (else
-            ((compose string->symbol
-                       upstream-input-downstream-name)
-             input))))
-       (sort inputs
-             (lambda (a b)
-               (string-ci<? (upstream-input-name a)
-                            (upstream-input-name b))))))
-
 (define (string->licenses license-string license-prefix)
   (let ((licenses
          (map string-trim-both
@@ -188,11 +174,21 @@ (define (description->alist description)
 (define* (maybe-inputs package-inputs #:optional (input-type 'inputs))
   "Given a list of PACKAGE-INPUTS, tries to generate the TYPE field of a
 package definition."
-  (match package-inputs
-    (()
-     '())
-    ((package-inputs ...)
-     `((,input-type (list ,@(format-inputs package-inputs)))))))
+  (define (format-input input)
+    (case (%input-style)
+      ((specification)
+       `(specification->package ,(upstream-input-downstream-name input)))
+      (else
+       ((compose string->symbol
+                  upstream-input-downstream-name)
+        input))))
+
+  (define (upstream-input-name<? i1 i2)
+    (string-ci<? (upstream-input-name i1)
+                 (upstream-input-name i2)))
+
+  (maybe-list-field input-type
+    (map format-input (sort package-inputs upstream-input-name<?))))
 
 (define %cran-url "https://cloud.r-project.org/web/packages/")
 (define %cran-canonical-url "https://cran.r-project.org/package=")
-- 
2.45.2





Information forwarded to lars <at> 6xq.net, guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Tue, 24 Sep 2024 20:22:06 GMT) Full text and rfc822 format available.

Message #107 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Subject: [PATCH v3 07/11] import: hackage: Use 'maybe-list-field' procedure.
Date: Tue, 24 Sep 2024 22:13:13 +0200
* guix/import/hackage.scm (maybe-inputs, maybe-arguments): Delete
procedures.
(hackage-module->sexp): Use 'maybe-list-field' and
'maybe-upstream-inputs' procedures.
* tests/hackage.scm: Fix whitespace and replace 'quasiquote' with
'list'.

Change-Id: I4fe39ff84c9f6a677f810d9e4fe751d762973757
---
 guix/import/hackage.scm | 39 ++++++++++++---------------------------
 tests/hackage.scm       | 13 +++++++------
 2 files changed, 19 insertions(+), 33 deletions(-)

diff --git a/guix/import/hackage.scm b/guix/import/hackage.scm
index 79a51d3300..bd3bed146e 100644
--- a/guix/import/hackage.scm
+++ b/guix/import/hackage.scm
@@ -9,6 +9,7 @@
 ;;; Copyright © 2019 Simon Tournier <zimon.toutoune <at> gmail.com>
 ;;; Copyright © 2022 Hartmut Goebel <h.goebel <at> crazy-compilers.com>
 ;;; Copyright © 2023-2024 Ludovic Courtès <ludo <at> gnu.org>
+;;; Copyright © 2024 Herman Rimm <herman <at> rimm.ee>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -288,26 +289,6 @@ (define* (hackage-module->sexp cabal cabal-hash
                           #:include-test-dependencies?
                           include-test-dependencies?))
 
-  (define (maybe-inputs input-type inputs)
-    (match inputs
-      (()
-       '())
-      ((inputs ...)
-       (list (list input-type
-                   `(list ,@(map (compose string->symbol
-                                          upstream-input-downstream-name)
-                                 inputs)))))))
-
-  (define (maybe-arguments)
-    (match (append (if (not include-test-dependencies?)
-                       '(#:tests? #f)
-                       '())
-                   (if (not (string-null? revision))
-                       `(#:cabal-revision (,revision ,cabal-hash))
-                       '()))
-      (() '())
-      (args `((arguments (,'quasiquote ,args))))))
-
   (let ((tarball (with-store store
                    (download-to-store store source-url))))
     (values
@@ -324,13 +305,17 @@ (define* (hackage-module->sexp cabal cabal-hash
                          "failed to download tar archive")))))
         (build-system haskell-build-system)
         (properties '((upstream-name . ,name)))
-        ,@(maybe-inputs 'inputs
-                        (filter (upstream-input-type-predicate 'regular)
-                                inputs))
-        ,@(maybe-inputs 'native-inputs
-                        (filter (upstream-input-type-predicate 'native)
-                                inputs))
-        ,@(maybe-arguments)
+        ,@(maybe-upstream-inputs 'inputs
+            (filter (upstream-input-type-predicate 'regular) inputs))
+        ,@(maybe-upstream-inputs 'native-inputs
+            (filter (upstream-input-type-predicate 'native) inputs))
+        ,@(maybe-list-field 'arguments
+            (append (if (not include-test-dependencies?)
+                        '(#:tests? #f)
+                        '())
+                    (if (not (string-null? revision))
+                        `(#:cabal-revision '(,revision ,cabal-hash))
+                        '())))
         (home-page ,(cabal-package-home-page cabal))
         (synopsis ,(cabal-package-synopsis cabal))
         (description ,(beautify-description (cabal-package-description cabal)))
diff --git a/tests/hackage.scm b/tests/hackage.scm
index 403f587c41..f6d91515e2 100644
--- a/tests/hackage.scm
+++ b/tests/hackage.scm
@@ -67,7 +67,7 @@ (define test-cabal-3
   if impl(ghc>=7.2&&<7.6)
     Build-depends: ghc-b
   if impl(ghc == 7.8)
-    Build-depends: 
+    Build-depends:
       HTTP       >= 4000.2.5 && < 4000.3,
       mtl        >= 2.0      && < 3
 ")
@@ -86,7 +86,7 @@ (define test-cabal-4
   if impl(ghc>=7.2&&<7.6)
     Build-depends: ghc-b
   if impl(ghc == 7.8)
-    Build-depends: 
+    Build-depends:
       HTTP       >= 4000.2.5 && < 4000.3,
       mtl        >= 2.0      && < 3
 ")
@@ -101,7 +101,7 @@ (define test-cabal-5
 license: BSD3
 library
   if impl(ghc == 7.8)
-    Build-depends: 
+    Build-depends:
       HTTP       >= 4000.2.5 && < 4000.3,
   if impl(ghc -any)
     Build-depends: mtl        >= 2.0      && < 3
@@ -126,7 +126,7 @@ (define test-cabal-6
   if impl(ghc>=7.2&&<7.6)
     Build-depends: ghc-b
   if impl(ghc == 7.8)
-    Build-depends: 
+    Build-depends:
       HTTP       >= 4000.2.5 && < 4000.3,
       mtl        >= 2.0      && < 3
 ")
@@ -524,8 +524,9 @@ (define-package-matcher match-ghc-foo-revision
     ('properties '(quote ((upstream-name . "foo"))))
     ('inputs ('list 'ghc-http))
     ('arguments
-     ('quasiquote
-      ('#:cabal-revision
+     ('list
+      '#:cabal-revision
+      ('quote
        ("2" "0xxd88fb659f0krljidbvvmkh9ppjnx83j0nqzx8whcg4n5qbyng"))))
     ('home-page "http://test.org")
     ('synopsis (? string?))
-- 
2.45.2





Information forwarded to guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Tue, 24 Sep 2024 20:22:07 GMT) Full text and rfc822 format available.

Message #110 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Subject: [PATCH v3 09/11] import: cpan: Use 'maybe-upstream-inputs' procedure.
Date: Tue, 24 Sep 2024 22:13:15 +0200
* guix/import/cpan.scm (maybe-inputs): Delete procedure.
(cpan-module->sexp): Use 'maybe-upstream-inputs' procedure.

Change-Id: I4fa99da62d81f02c2998ad96f5ea81e27df071cd
---
 guix/import/cpan.scm | 23 +++++++----------------
 1 file changed, 7 insertions(+), 16 deletions(-)

diff --git a/guix/import/cpan.scm b/guix/import/cpan.scm
index b87736eef6..611ea63eba 100644
--- a/guix/import/cpan.scm
+++ b/guix/import/cpan.scm
@@ -5,6 +5,7 @@
 ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me <at> tobias.gr>
 ;;; Copyright © 2020, 2021, 2023 Ludovic Courtès <ludo <at> gnu.org>
 ;;; Copyright © 2022 Hartmut Goebel <h.goebel <at> crazy-compilers.com>
+;;; Copyright © 2024 Herman Rimm <herman <at> rimm.ee>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -37,7 +38,8 @@ (define-module (guix import cpan)
   #:use-module (guix utils)
   #:use-module (guix base32)
   #:use-module ((guix download) #:select (download-to-store url-fetch))
-  #:use-module ((guix import utils) #:select (factorize-uri))
+  #:use-module ((guix import utils) #:select (factorize-uri
+                                              maybe-upstream-inputs))
   #:use-module (guix import json)
   #:use-module (guix packages)
   #:use-module (guix upstream)
@@ -275,15 +277,6 @@ (define (cpan-module->sexp release)
   (define version (cpan-release-version release))
   (define source-url (cpan-source-url release))
 
-  (define (maybe-inputs input-type inputs)
-    (match inputs
-      (()
-       '())
-      ((inputs ...)
-       `((,input-type (list ,@(map (compose string->symbol
-                                            upstream-input-downstream-name)
-                                   inputs)))))))
-
   (let ((tarball (with-store store
                    (download-to-store store source-url)))
         (inputs (cpan-module-inputs release)))
@@ -297,12 +290,10 @@ (define (cpan-module->sexp release)
                   (base32
                    ,(bytevector->nix-base32-string (file-sha256 tarball))))))
        (build-system perl-build-system)
-       ,@(maybe-inputs 'native-inputs
-                       (filter (upstream-input-type-predicate 'native)
-                               inputs))
-       ,@(maybe-inputs 'propagated-inputs
-                       (filter (upstream-input-type-predicate 'propagated)
-                               inputs))
+       ,@(maybe-upstream-inputs 'native-inputs
+           (filter (upstream-input-type-predicate 'native) inputs))
+       ,@(maybe-upstream-inputs 'propagated-inputs
+           (filter (upstream-input-type-predicate 'propagated) inputs))
        (home-page ,(cpan-home name))
        (synopsis ,(cpan-release-abstract release))
        (description fill-in-yourself!)
-- 
2.45.2





Information forwarded to guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Tue, 24 Sep 2024 20:22:07 GMT) Full text and rfc822 format available.

Message #113 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Subject: [PATCH v3 10/11] import: egg: Use maybe-*inputs procedures.
Date: Tue, 24 Sep 2024 22:13:16 +0200
* guix/import/egg.scm (maybe-inputs): Delete procedure.
(egg-parse-dependency): Simplify procedure to return strings.
(egg->guix-package): Use maybe-*inputs procedures.

Change-Id: Ib0a3f5b6f02912c847defd02ba7675d80005279b
---
 guix/import/egg.scm | 39 +++++++++++----------------------------
 1 file changed, 11 insertions(+), 28 deletions(-)

diff --git a/guix/import/egg.scm b/guix/import/egg.scm
index e3bc158475..97d09a7c9d 100644
--- a/guix/import/egg.scm
+++ b/guix/import/egg.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2021 Tobias Geerinckx-Rice <me <at> tobias.gr>
 ;;; Copyright © 2021 Sarah Morgensen <iskarian <at> mgsn.dev>
 ;;; Copyright © 2022 Hartmut Goebel <h.goebel <at> crazy-compilers.com>
+;;; Copyright © 2024 Herman Rimm <herman <at> rimm.ee>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -229,23 +230,14 @@ (define* (egg->guix-package name version #:key (file #f) (source #f)
                           (else char)))
                       (maybe-symbol->string name)))
 
-        (define* (egg-parse-dependency name #:key (system? #f))
-          (define extract-name
-            (match-lambda
-              ((name version) name)
-              (name name)))
-
-          (define (prettify-name name)
+        (define* (egg-parse-dependency dependency #:key (system? #f))
+          (let ((name (match dependency
+                        ((name version) name)
+                        (name name))))
             (if system?
                 (prettify-system-dependency name)
-                (maybe-symbol->string name)))
-          
-          (let ((name (prettify-name (extract-name name))))
-            ;; Dependencies are sometimes specified as symbols and sometimes
-            ;; as strings
-            (string->symbol (string-append
-                             (if system? "" package-name-prefix)
-                             name))))
+                (string-append package-name-prefix
+                               (maybe-symbol->string name)))))
 
         (define egg-propagated-inputs
           (let ((dependencies (assoc-ref egg-content 'dependencies)))
@@ -277,15 +269,6 @@ (define* (egg->guix-package name version #:key (file #f) (source #f)
                               test+build-dependencies))
               (() '()))))
 
-        ;; Copied from (guix import hackage).
-        (define (maybe-inputs input-type inputs)
-          (match inputs
-            (()
-             '())
-            ((inputs ...)
-             (list (list input-type
-                         `(list ,@inputs))))))
-
         (values
          `(package
             (name ,(egg-name->guix-name name))
@@ -303,16 +286,16 @@ (define* (egg->guix-package name version #:key (file #f) (source #f)
                                    "failed to download tar archive"))))))
             (build-system chicken-build-system)
             (arguments ,(list 'quasiquote (list #:egg-name name)))
-            ,@(maybe-inputs 'native-inputs egg-native-inputs)
-            ,@(maybe-inputs 'inputs egg-inputs)
-            ,@(maybe-inputs 'propagated-inputs egg-propagated-inputs)
+            ,@(maybe-native-inputs egg-native-inputs)
+            ,@(maybe-inputs egg-inputs)
+            ,@(maybe-propagated-inputs egg-propagated-inputs)
             (home-page ,egg-home-page)
             (synopsis ,egg-synopsis)
             (description #f)
             (license ,egg-licenses))
          (filter (lambda (name)
                    (not (member name '("srfi-4"))))
-                 (map (compose guix-name->egg-name symbol->string)
+                 (map guix-name->egg-name
                       (append egg-propagated-inputs
                               egg-native-inputs)))))))
 
-- 
2.45.2





Information forwarded to guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Tue, 24 Sep 2024 20:22:08 GMT) Full text and rfc822 format available.

Message #116 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Subject: [PATCH v3 11/11] import: hexpm: Use (guix import utils)
 'maybe-inputs' procedure.
Date: Tue, 24 Sep 2024 22:13:17 +0200
* guix/import/hexpm.scm (maybe-inputs): Delete procedure.
(dependencies->package-names): Return strings instead of symbols.
(make-hexpm-sexp): Use 'maybe-inputs' from (guix import utils).

Change-Id: Ie7a8a630a3a9d4859453d49fdee42aa560e27f17
---
 guix/import/hexpm.scm | 29 +++++++++--------------------
 1 file changed, 9 insertions(+), 20 deletions(-)

diff --git a/guix/import/hexpm.scm b/guix/import/hexpm.scm
index 71a54ba973..a7d74e24c3 100644
--- a/guix/import/hexpm.scm
+++ b/guix/import/hexpm.scm
@@ -5,6 +5,7 @@
 ;;; Copyright © 2019 Martin Becze <mjbecze <at> riseup.net>
 ;;; Copyright © 2019 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
 ;;; Copyright © 2020-2022 Hartmut Goebel <h.goebel <at> crazy-compilers.com>
+;;; Copyright © 2024 Herman Rimm <herman <at> rimm.ee>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -153,26 +154,14 @@ (define (lookup-hexpm-release version*)
 ;;; Converting hex.pm packages to Guix packages.
 ;;;
 
-(define (maybe-inputs package-inputs input-type)
-  "Given a list of PACKAGE-INPUTS, tries to generate the 'inputs' field of a
-package definition.  INPUT-TYPE, a symbol, is used to populate the name of
-the input field."
-  (match package-inputs
-    (()
-     '())
-    ((package-inputs ...)
-     `((,input-type (list ,@package-inputs))))))
-
 (define (dependencies->package-names names)
-  "Given a list of hexpm package NAMES, returns a list of guix package names
-as symbols."
-  ;; TODO: Base name on language of dependency.
-  ;; The language used for implementing the dependency is not know without
-  ;; recursing the dependencies.  So for now assume more packages are based on
-  ;; Erlang and prefix all dependencies with "erlang-" (the default).
-  (map string->symbol
-       (map hexpm-name->package-name
-            (sort names string-ci<?))))
+  "Given a list of hexpm package NAMES, returns a list of guix package
+names."
+  ;; TODO: Base name on the programming language of the dependency.
+  ;; The language used for implementing the dependency can only be known
+  ;; by traversing the dependencies.  So for now assume packages are
+  ;; based on Erlang, and prefix dependencies with "erlang-" by default.
+  (map hexpm-name->package-name (sort names string-ci<?)))
 
 (define* (make-hexpm-sexp #:key name version tarball-url
                           home-page synopsis description license
@@ -194,7 +183,7 @@ (define* (make-hexpm-sexp #:key name version tarball-url
                    (uri (hexpm-uri ,name version))
                    (sha256 (base32 ,(guix-hash-url temp)))))
          (build-system ,build-system)
-         ,@(maybe-inputs (dependencies->package-names dependencies) 'inputs)
+         ,@(maybe-inputs (dependencies->package-names dependencies))
          (synopsis ,synopsis)
          (description ,(beautify-description description))
          (home-page ,(match home-page
-- 
2.45.2





Information forwarded to efraim <at> flashner.co.il, guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Mon, 09 Dec 2024 20:00:02 GMT) Full text and rfc822 format available.

Message #119 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Subject: [PATCH v4 01/11] build-system: cargo: Accept unlabeled #:cargo-inputs.
Date: Mon,  9 Dec 2024 20:58:05 +0100
* guix/build-system/cargo.scm (crate-closure): Match unlabeled inputs.

Change-Id: Iae421281fa08d09ddd1e5d2da2864f0093d97cd1
---
 guix/build-system/cargo.scm | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/guix/build-system/cargo.scm b/guix/build-system/cargo.scm
index 658a2e525e..2e3061c0e8 100644
--- a/guix/build-system/cargo.scm
+++ b/guix/build-system/cargo.scm
@@ -6,6 +6,7 @@
 ;;; Copyright © 2019 Ivan Petkov <ivanppetkov <at> gmail.com>
 ;;; Copyright © 2020 Jakub Kądziołka <kuba <at> kadziolka.net>
 ;;; Copyright © 2021 Efraim Flashner <efraim <at> flashner.co.il>
+;;; Copyright © 2024 Herman Rimm <herman <at> rimm.ee>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -234,11 +235,14 @@ (define (crate-closure inputs)
        (if (null? propagated)
            (reverse result)
            (loop (reverse (concatenate propagated)) result '() #f seen)))
-      (((and input (label (? package? package))) rest ...)
+      ;; Match inputs with labels for backward compatibility.
+      (((or (_ (? package? package))
+            (? package? package))
+        rest ...)
        (if (and (not first?) (seen? seen package))
            (loop rest result propagated first? seen)
            (loop rest
-                 (cons input result)
+                 (cons package result)
                  (cons (package-cargo-inputs package)
                        propagated)
                  first?
@@ -296,8 +300,8 @@ (define (expand-crate-sources cargo-inputs cargo-development-inputs)
   something that can always be extended or reworked in the future)."
   (filter-map
     (match-lambda
-      ((label (? package? p))
-       (list label (package-source p)))
+      ((? package? p)
+       (list (package-name p) (package-source p)))
       ((label input)
        (list label input)))
     (crate-closure (append cargo-inputs cargo-development-inputs))))

base-commit: a5a540d71331fd43fd53e23eb49102c55462c28f
-- 
2.45.2





Information forwarded to guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Mon, 09 Dec 2024 20:00:03 GMT) Full text and rfc822 format available.

Message #122 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Cc: Sarah Morgensen <iskarian <at> mgsn.dev>
Subject: [PATCH v4 02/11] import: utils: Emit new-style package inputs.
Date: Mon,  9 Dec 2024 20:58:06 +0100
From: Sarah Morgensen <iskarian <at> mgsn.dev>

* guix/import/utils.scm (package-names->package-inputs)[make-input]:
Return new-style package inputs.
(maybe-list-field): Add procedure, which wraps BODY in 'list' instead of
'quasiquote'.
(maybe-packages-field): Add procedure.
(maybe-inputs): Use maybe-packages-field.
(maybe-native-inputs): Use maybe-packages-field.
(maybe-propagated-inputs): Use maybe-packages-field.

Change-Id: I66588f4c822d507ddbaf465a268bfb71af8a7ecd
---
 guix/import/utils.scm | 52 +++++++++++++++++++++++++------------------
 1 file changed, 30 insertions(+), 22 deletions(-)

diff --git a/guix/import/utils.scm b/guix/import/utils.scm
index ccf18a7bf9..4eab790645 100644
--- a/guix/import/utils.scm
+++ b/guix/import/utils.scm
@@ -13,6 +13,7 @@
 ;;; Copyright © 2022 Alice Brenon <alice.brenon <at> ens-lyon.fr>
 ;;; Copyright © 2022 Kyle Meyer <kyle <at> kyleam.com>
 ;;; Copyright © 2022 Philip McGrath <philip <at> philipmcgrath.com>
+;;; Copyright © 2024 Herman Rimm <herman <at> rimm.ee>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -65,6 +66,8 @@ (define-module (guix import utils)
             guix-hash-url
 
             package-names->package-inputs
+            maybe-list-field
+            maybe-packages-field
             maybe-inputs
             maybe-native-inputs
             maybe-propagated-inputs
@@ -425,39 +428,44 @@ (define* (package-names->package-inputs names #:optional (output #f))
 optional OUTPUT, tries to generate a quoted list of inputs, as suitable to
 use in an 'inputs' field of a package definition."
   (define (make-input input version)
-    (let ((name (if version (string-append input "-" version) input)))
+    (let ((symbol (string->symbol
+                    (if version
+                        (string-append input "-" version)
+                        input))))
       (if output
-          (list (string->symbol name) output)
-          (string->symbol name))))
+          (list symbol output)
+          symbol)))
 
   (map (match-lambda
          ((input version) (make-input input version))
          (input (make-input input #f)))
        names))
 
-(define* (maybe-inputs package-names #:optional (output #f)
-                       #:key (type #f))
-  "Given a list of PACKAGE-NAMES, tries to generate the 'inputs' field of a
-package definition.  TYPE can be used to specify the type of the inputs;
-either the 'native or 'propagated symbols are accepted.  Left unspecified, the
-snippet generated is for regular inputs."
-  (let ((field-name (match type
-                      ('native 'native-inputs)
-                      ('propagated 'propagated-inputs)
-                      (_ 'inputs))))
-    (match (package-names->package-inputs package-names output)
-      (()
-       '())
-      ((package-inputs ...)
-       `((,field-name (list ,@package-inputs)))))))
+(define* (maybe-list-field type body)
+  "Generates the TYPE field of a package definition if its value, BODY,
+is a non-empty list."
+  (match body
+    (() '())
+    ((? list?) (list (list type (cons 'list body))))))
+
+(define* (maybe-packages-field type package-names
+                               #:optional (output #f))
+  "Given a list of PACKAGE-NAMES, tries to generate the TYPE field of a
+package definition."
+  (maybe-list-field type
+    (package-names->package-inputs package-names output)))
+
+(define* (maybe-inputs package-names #:optional (output #f))
+  "MAYBE-PACKAGES-FIELD for inputs."
+  (maybe-packages-field 'inputs package-names output))
 
 (define* (maybe-native-inputs package-names #:optional (output #f))
-  "Same as MAYBE-INPUTS, but for native inputs."
-  (maybe-inputs package-names output #:type 'native))
+  "MAYBE-PACKAGES-FIELD for native inputs."
+  (maybe-packages-field 'native-inputs package-names output))
 
 (define* (maybe-propagated-inputs package-names #:optional (output #f))
-  "Same as MAYBE-INPUTS, but for propagated inputs."
-  (maybe-inputs package-names output #:type 'propagated))
+  "MAYBE-PACKAGES-FIELD for propagated inputs."
+  (maybe-packages-field 'propagated-inputs package-names output))
 
 (define* (package->definition guix-package #:optional append-version?/string)
   "If APPEND-VERSION?/STRING is #t, append the package's major+minor version.
-- 
2.45.2





Information forwarded to guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Mon, 09 Dec 2024 20:00:04 GMT) Full text and rfc822 format available.

Message #125 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Subject: [PATCH v4 04/11] import: utils: Add 'maybe-upstream-inputs' procedure.
Date: Mon,  9 Dec 2024 20:58:08 +0100
* guix/import/utils.scm (maybe-upstream-inputs): Add procedure.

Change-Id: Ib8a80216d512c0373e55e4f27e1ef2a7c1fb854a
---
 guix/import/utils.scm | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/guix/import/utils.scm b/guix/import/utils.scm
index 4eab790645..9544fbf00f 100644
--- a/guix/import/utils.scm
+++ b/guix/import/utils.scm
@@ -45,6 +45,7 @@ (define-module (guix import utils)
   #:use-module (guix download)
   #:use-module (guix sets)
   #:use-module ((guix ui) #:select (fill-paragraph))
+  #:use-module (guix upstream)
   #:use-module (gnu packages)
   #:autoload   (ice-9 control) (let/ec)
   #:use-module (ice-9 match)
@@ -71,6 +72,7 @@ (define-module (guix import utils)
             maybe-inputs
             maybe-native-inputs
             maybe-propagated-inputs
+            maybe-upstream-inputs
             package->definition
 
             spdx-string->license
@@ -467,6 +469,13 @@ (define* (maybe-propagated-inputs package-names #:optional (output #f))
   "MAYBE-PACKAGES-FIELD for propagated inputs."
   (maybe-packages-field 'propagated-inputs package-names output))
 
+(define* (maybe-upstream-inputs type upstream-inputs)
+  "Given a list of UPSTREAM-NAMES, tries to generate the TYPE field of a
+package definition."
+  (maybe-list-field type
+    (map (compose string->symbol upstream-input-downstream-name)
+         upstream-inputs)))
+
 (define* (package->definition guix-package #:optional append-version?/string)
   "If APPEND-VERSION?/STRING is #t, append the package's major+minor version.
 If it is the symbol 'full, append the package's complete version.  If
-- 
2.45.2





Information forwarded to efraim <at> flashner.co.il, guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Mon, 09 Dec 2024 20:00:06 GMT) Full text and rfc822 format available.

Message #128 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Cc: Sarah Morgensen <iskarian <at> mgsn.dev>
Subject: [PATCH v4 03/11] import: crate: Emit new-style package inputs.
Date: Mon,  9 Dec 2024 20:58:07 +0100
From: Sarah Morgensen <iskarian <at> mgsn.dev>

* guix/import/crate.scm (maybe-cargo-inputs,
maybe-cargo-development-inputs, maybe-arguments): Delete procedures.
(make-crate-sexp): Add 'unwrap' procedure, use with maybe-packages-field
and fix indentation.
* tests/crate.scm: Adjust accordingly.

Change-Id: Ie8debd2553a338c3c623162b843e0a9827314074
---
 guix/import/crate.scm |  51 ++++++------------
 tests/crate.scm       | 119 +++++++++++++++++-------------------------
 2 files changed, 65 insertions(+), 105 deletions(-)

diff --git a/guix/import/crate.scm b/guix/import/crate.scm
index 5996571cda..962159f16e 100644
--- a/guix/import/crate.scm
+++ b/guix/import/crate.scm
@@ -7,6 +7,7 @@
 ;;; Copyright © 2023 Simon Tournier <zimon.toutoune <at> gmail.com>
 ;;; Copyright © 2023, 2024 Efraim Flashner <efraim <at> flashner.co.il>
 ;;; Copyright © 2023, 2024 David Elsing <david.elsing <at> posteo.net>
+;;; Copyright © 2024 Herman Rimm <herman <at> rimm.ee>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -158,27 +159,6 @@ (define* (package-names->package-inputs names #:optional (output #f))
          (input (make-input input #f)))
        names))
 
-(define (maybe-cargo-inputs package-names)
-  (match (package-names->package-inputs package-names)
-    (()
-     '())
-    ((package-inputs ...)
-     `(#:cargo-inputs ,package-inputs))))
-
-(define (maybe-cargo-development-inputs package-names)
-  (match (package-names->package-inputs package-names)
-    (()
-     '())
-    ((package-inputs ...)
-     `(#:cargo-development-inputs ,package-inputs))))
-
-(define (maybe-arguments arguments)
-  (match arguments
-    (()
-     '())
-    ((args ...)
-     `((arguments (,'quasiquote ,args))))))
-
 (define (version->semver-prefix version)
   "Return the version up to and including the first non-zero part"
   (first
@@ -202,8 +182,14 @@ (define* (make-crate-sexp #:key name version cargo-inputs cargo-development-inpu
 
   (let* ((port (http-fetch (crate-uri name version)))
          (guix-name (crate-name->package-name name))
-         (cargo-inputs (format-inputs cargo-inputs))
-         (cargo-development-inputs (format-inputs cargo-development-inputs))
+         (unwrap (match-lambda
+                   ((lst) lst)
+                   (() '())))
+         (cargo-inputs (maybe-packages-field '#:cargo-inputs
+                         (format-inputs cargo-inputs)))
+         (cargo-development-inputs
+           (maybe-packages-field '#:cargo-development-inputs
+             (format-inputs cargo-development-inputs)))
          (description (beautify-description description))
          (pkg `(package
                    (name ,guix-name)
@@ -222,12 +208,10 @@ (define* (make-crate-sexp #:key name version cargo-inputs cargo-development-inpu
                          `((properties '((crate-version-yanked? . #t))))
                          '())
                    (build-system cargo-build-system)
-                   ,@(maybe-arguments (append (if build?
-                                                 '()
-                                                 '(#:skip-build? #t))
-                                              (maybe-cargo-inputs cargo-inputs)
-                                              (maybe-cargo-development-inputs
-                                                cargo-development-inputs)))
+                   ,@(maybe-list-field 'arguments
+                       (append (if build? '() '(#:skip-build? #t))
+                               (unwrap cargo-inputs)
+                               (unwrap cargo-development-inputs)))
                    (home-page ,home-page)
                    (synopsis ,(beautify-synopsis synopsis))
                    (description ,(if (string-prefix? "This" description)
@@ -239,11 +223,10 @@ (define* (make-crate-sexp #:key name version cargo-inputs cargo-development-inpu
                                (#f #f)
                                ((license) license)
                                (_ `(list ,@license)))))))
-         (close-port port)
-         (package->definition pkg
-                              (if yanked?
-                                  (string-append version "-yanked")
-                                  (version->semver-prefix version)))))
+    (close-port port)
+    (package->definition pkg (if yanked?
+                                 (string-append version "-yanked")
+                                 (version->semver-prefix version)))))
 
 (define (string->license string)
   (filter-map (lambda (license)
diff --git a/tests/crate.scm b/tests/crate.scm
index 5b4ad08c3c..8e3da2e72c 100644
--- a/tests/crate.scm
+++ b/tests/crate.scm
@@ -5,6 +5,8 @@
 ;;; Copyright © 2020 Martin Becze <mjbecze <at> riseup.net>
 ;;; Copyright © 2023 Efraim Flashner <efraim <at> flashner.co.il>
 ;;; Copyright © 2023 David Elsing <david.elsing <at> posteo.net>
+;;; Copyright © 2021 Sarah Morgensen <iskarian <at> mgsn.dev>
+;;; Copyright © 2024 Herman Rimm <herman <at> rimm.ee>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -497,10 +499,10 @@ (define have-guile-semver?
                            (?  string? hash)))))
                       (build-system 'cargo-build-system)
                       (arguments
-                       ('quasiquote
-                        (#:skip-build? #t
+                       (list
+                         #:skip-build? #t
                          #:cargo-inputs
-                         (("rust-leaf-alice" ('unquote 'rust-leaf-alice-0.7))))))
+                         (list rust-leaf-alice-0.7)))
                       (home-page "http://example.com")
                       (synopsis "summary")
                       (description "This package provides summary.")
@@ -589,7 +591,7 @@ (define have-guile-semver?
                      (?  string? hash)))))
                 (build-system cargo-build-system)
                 (arguments
-                 ('quasiquote (#:skip-build? #t)))
+                 (list #:skip-build? #t))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "This package provides summary.")
@@ -608,7 +610,7 @@ (define have-guile-semver?
                     (base32
                      (?  string? hash)))))
                 (build-system cargo-build-system)
-                (arguments ('quasiquote (#:skip-build? #t)))
+                (arguments (list #:skip-build? #t))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "This package provides summary.")
@@ -627,7 +629,7 @@ (define have-guile-semver?
                     (base32
                      (?  string? hash)))))
                 (build-system cargo-build-system)
-                (arguments ('quasiquote (#:skip-build? #t)))
+                (arguments (list #:skip-build? #t))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "This package provides summary.")
@@ -647,10 +649,9 @@ (define have-guile-semver?
                      (?  string? hash)))))
                 (build-system cargo-build-system)
                 (arguments
-                 ('quasiquote (#:skip-build? #t
-                               #:cargo-inputs
-                               (("rust-leaf-bob"
-                                 ('unquote rust-leaf-bob-3))))))
+                 (list #:skip-build? #t
+                       #:cargo-inputs
+                       (list rust-leaf-bob-3)))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "This package provides summary.")
@@ -670,14 +671,11 @@ (define have-guile-semver?
                      (?  string? hash)))))
                 (build-system cargo-build-system)
                 (arguments
-                 ('quasiquote (#:skip-build? #t
-                               #:cargo-inputs
-                               (("rust-intermediate-b"
-                                 ('unquote rust-intermediate-b-1))
-                                ("rust-leaf-alice"
-                                 ('unquote 'rust-leaf-alice-0.7))
-                                ("rust-leaf-bob"
-                                 ('unquote rust-leaf-bob-3))))))
+                 (list #:skip-build? #t
+                       #:cargo-inputs
+                       (list rust-intermediate-b-1
+                             rust-leaf-alice-0.7
+                             rust-leaf-bob-3)))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "This package provides summary.")
@@ -697,18 +695,13 @@ (define have-guile-semver?
                      (?  string? hash)))))
                 (build-system cargo-build-system)
                 (arguments
-                 ('quasiquote (#:cargo-inputs
-                               (("rust-intermediate-a"
-                                 ('unquote rust-intermediate-a-1))
-                                ("rust-intermediate-b"
-                                 ('unquote rust-intermediate-b-1))
-                                ("rust-leaf-alice"
-                                 ('unquote 'rust-leaf-alice-0.7))
-                                ("rust-leaf-bob"
-                                 ('unquote rust-leaf-bob-3)))
-                               #:cargo-development-inputs
-                               (("rust-intermediate-c"
-                                 ('unquote rust-intermediate-c-1))))))
+                 (list #:cargo-inputs
+                       (list rust-intermediate-a-1
+                             rust-intermediate-b-1
+                             rust-leaf-alice-0.7
+                             rust-leaf-bob-3)
+                       #:cargo-development-inputs
+                       ((list rust-intermediate-c-1))))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "This package provides summary.")
@@ -735,9 +728,8 @@ (define have-guile-semver?
                      (?  string? hash)))))
                 (build-system cargo-build-system)
                 (arguments
-                 ('quasiquote (#:cargo-development-inputs
-                               (("rust-leaf-alice"
-                                 ('unquote rust-leaf-alice-0.7))))))
+                 (list #:cargo-development-inputs
+                       (list rust-leaf-alice-0.7)))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "This package provides summary.")
@@ -793,9 +785,8 @@ (define have-guile-semver?
                      (?  string? hash)))))
                 (build-system cargo-build-system)
                 (arguments
-                 ('quasiquote (#:cargo-inputs
-                               (("rust-leaf-bob"
-                                 ('unquote rust-leaf-bob-3))))))
+                 (list #:cargo-inputs
+                       (list rust-leaf-bob-3)))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "This package provides summary.")
@@ -815,13 +806,10 @@ (define have-guile-semver?
                      (?  string? hash)))))
                 (build-system cargo-build-system)
                 (arguments
-                 ('quasiquote (#:cargo-inputs
-                               (("rust-intermediate-b"
-                                 ('unquote rust-intermediate-b-1))
-                                ("rust-leaf-alice"
-                                 ('unquote 'rust-leaf-alice-0.7))
-                                ("rust-leaf-bob"
-                                 ('unquote rust-leaf-bob-3))))))
+                 (list #:cargo-inputs
+                       (list rust-intermediate-b-1
+                             rust-leaf-alice-0.7
+                             rust-leaf-bob-3)))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "This package provides summary.")
@@ -841,18 +829,13 @@ (define have-guile-semver?
                      (?  string? hash)))))
                 (build-system cargo-build-system)
                 (arguments
-                 ('quasiquote (#:cargo-inputs
-                               (("rust-intermediate-a"
-                                 ('unquote rust-intermediate-a-1))
-                                ("rust-intermediate-b"
-                                 ('unquote rust-intermediate-b-1))
-                                ("rust-leaf-alice"
-                                 ('unquote 'rust-leaf-alice-0.7))
-                                ("rust-leaf-bob"
-                                 ('unquote rust-leaf-bob-3)))
-                               #:cargo-development-inputs
-                               (("rust-intermediate-c"
-                                 ('unquote rust-intermediate-c-1))))))
+                 (list #:cargo-inputs
+                       (list rust-intermediate-a-1
+                             rust-intermediate-b-1
+                             rust-leaf-alice-0.7
+                             rust-leaf-bob-3)
+                       #:cargo-development-inputs
+                       (list rust-intermediate-c-1)))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "This package provides summary.")
@@ -962,14 +945,11 @@ (define rust-leaf-bob-3.0.2-yanked
                  (?  string? hash)))))
             (build-system cargo-build-system)
             (arguments
-             ('quasiquote (#:cargo-inputs
-                           (("rust-leaf-bob"
-                             ('unquote 'rust-leaf-bob-3)))
-                           #:cargo-development-inputs
-                           (("rust-leaf-bob"
-                             ('unquote 'rust-leaf-bob-3.0.2-yanked))
-                            ("rust-leaf-bob"
-                             ('unquote 'rust-leaf-bob-4.0.0-yanked))))))
+             (list #:cargo-inputs
+                   (list rust-leaf-bob-3)
+                   #:cargo-development-inputs
+                   (list rust-leaf-bob-3.0.2-yanked
+                         rust-leaf-bob-4.0.0-yanked)))
             (home-page "http://example.com")
             (synopsis "summary")
             (description "This package provides summary.")
@@ -1093,14 +1073,11 @@ (define rust-leaf-bob-3.0.2-yanked
                      (?  string? hash)))))
                 (build-system cargo-build-system)
                 (arguments
-                 ('quasiquote (#:cargo-inputs
-                               (("rust-leaf-bob"
-                                 ('unquote 'rust-leaf-bob-3)))
-                               #:cargo-development-inputs
-                               (("rust-leaf-bob"
-                                 ('unquote 'rust-leaf-bob-3.0.2-yanked))
-                                ("rust-leaf-bob"
-                                 ('unquote 'rust-leaf-bob-4.0.0-yanked))))))
+                 (list #:cargo-inputs
+                       (list rust-leaf-bob-3)
+                       #:cargo-development-inputs
+                       (list rust-leaf-bob-3.0.2-yanked
+                             rust-leaf-bob-4.0.0-yanked)))
                 (home-page "http://example.com")
                 (synopsis "summary")
                 (description "This package provides summary.")
-- 
2.45.2





Information forwarded to andrew <at> trop.in, cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com, guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Mon, 09 Dec 2024 20:00:07 GMT) Full text and rfc822 format available.

Message #131 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Subject: [PATCH v4 06/11] import: elpa: Use maybe-propagated-inputs procedure.
Date: Mon,  9 Dec 2024 20:58:10 +0100
* guix/import/elpa.scm (maybe-inputs): Delete procedure.
(elpa-package->sexp): Use maybe-propagated-inputs procedure.

Change-Id: I9b40e9d387311f5dbbb079938733bf945a1a6ee6
---
 guix/import/elpa.scm | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/guix/import/elpa.scm b/guix/import/elpa.scm
index 46b6dc98a2..9ade189a8a 100644
--- a/guix/import/elpa.scm
+++ b/guix/import/elpa.scm
@@ -359,13 +359,6 @@ (define* (elpa-package->sexp pkg #:optional license repo)
     (map (compose string->symbol elpa-name->package-name)
          dependencies-names))
 
-  (define (maybe-inputs input-type inputs)
-    (match inputs
-      (()
-       '())
-      ((inputs ...)
-       (list (list input-type `(list ,@inputs))))))
-
   (define melpa-source
     (melpa-recipe->origin melpa-recipe))
 
@@ -386,7 +379,7 @@ (define* (elpa-package->sexp pkg #:optional license repo)
                                 (file-hash* tarball #:recursive? #false))
                                "failed to download package")))))))
       (build-system emacs-build-system)
-      ,@(maybe-inputs 'propagated-inputs dependencies)
+      ,@(maybe-propagated-inputs dependencies)
       ,@(if melpa-source
             (melpa-recipe->maybe-arguments melpa-recipe)
             '())
-- 
2.45.2





Information forwarded to lars <at> 6xq.net, guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Mon, 09 Dec 2024 20:00:08 GMT) Full text and rfc822 format available.

Message #134 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Subject: [PATCH v4 07/11] import: hackage: Use 'maybe-list-field' procedure.
Date: Mon,  9 Dec 2024 20:58:11 +0100
* guix/import/hackage.scm (maybe-inputs, maybe-arguments): Delete
procedures.
(hackage-module->sexp): Use 'maybe-list-field' and
'maybe-upstream-inputs' procedures.
* tests/hackage.scm: Fix whitespace and replace 'quasiquote' with
'list'.

Change-Id: I4fe39ff84c9f6a677f810d9e4fe751d762973757
---
 guix/import/hackage.scm | 39 ++++++++++++---------------------------
 tests/hackage.scm       | 13 +++++++------
 2 files changed, 19 insertions(+), 33 deletions(-)

diff --git a/guix/import/hackage.scm b/guix/import/hackage.scm
index 422887d435..99dfb84b7d 100644
--- a/guix/import/hackage.scm
+++ b/guix/import/hackage.scm
@@ -10,6 +10,7 @@
 ;;; Copyright © 2022 Hartmut Goebel <h.goebel <at> crazy-compilers.com>
 ;;; Copyright © 2023-2024 Ludovic Courtès <ludo <at> gnu.org>
 ;;; Copyright © 2024 Nicolas Graves <ngraves <at> ngraves.fr>
+;;; Copyright © 2024 Herman Rimm <herman <at> rimm.ee>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -290,26 +291,6 @@ (define* (hackage-module->sexp cabal cabal-hash
                           #:include-test-dependencies?
                           include-test-dependencies?))
 
-  (define (maybe-inputs input-type inputs)
-    (match inputs
-      (()
-       '())
-      ((inputs ...)
-       (list (list input-type
-                   `(list ,@(map (compose string->symbol
-                                          upstream-input-downstream-name)
-                                 inputs)))))))
-
-  (define (maybe-arguments)
-    (match (append (if (not include-test-dependencies?)
-                       '(#:tests? #f)
-                       '())
-                   (if (not (string-null? revision))
-                       `(#:cabal-revision (,revision ,cabal-hash))
-                       '()))
-      (() '())
-      (args `((arguments (,'quasiquote ,args))))))
-
   (let ((tarball (with-store store
                    (download-to-store store source-url))))
     (values
@@ -326,13 +307,17 @@ (define* (hackage-module->sexp cabal cabal-hash
                          "failed to download tar archive")))))
         (build-system haskell-build-system)
         (properties '((upstream-name . ,name)))
-        ,@(maybe-inputs 'inputs
-                        (filter (upstream-input-type-predicate 'regular)
-                                inputs))
-        ,@(maybe-inputs 'native-inputs
-                        (filter (upstream-input-type-predicate 'native)
-                                inputs))
-        ,@(maybe-arguments)
+        ,@(maybe-upstream-inputs 'inputs
+            (filter (upstream-input-type-predicate 'regular) inputs))
+        ,@(maybe-upstream-inputs 'native-inputs
+            (filter (upstream-input-type-predicate 'native) inputs))
+        ,@(maybe-list-field 'arguments
+            (append (if (not include-test-dependencies?)
+                        '(#:tests? #f)
+                        '())
+                    (if (not (string-null? revision))
+                        `(#:cabal-revision '(,revision ,cabal-hash))
+                        '())))
         (home-page ,(cabal-package-home-page cabal))
         (synopsis ,(cabal-package-synopsis cabal))
         (description ,(beautify-description (cabal-package-description cabal)))
diff --git a/tests/hackage.scm b/tests/hackage.scm
index 403f587c41..f6d91515e2 100644
--- a/tests/hackage.scm
+++ b/tests/hackage.scm
@@ -67,7 +67,7 @@ (define test-cabal-3
   if impl(ghc>=7.2&&<7.6)
     Build-depends: ghc-b
   if impl(ghc == 7.8)
-    Build-depends: 
+    Build-depends:
       HTTP       >= 4000.2.5 && < 4000.3,
       mtl        >= 2.0      && < 3
 ")
@@ -86,7 +86,7 @@ (define test-cabal-4
   if impl(ghc>=7.2&&<7.6)
     Build-depends: ghc-b
   if impl(ghc == 7.8)
-    Build-depends: 
+    Build-depends:
       HTTP       >= 4000.2.5 && < 4000.3,
       mtl        >= 2.0      && < 3
 ")
@@ -101,7 +101,7 @@ (define test-cabal-5
 license: BSD3
 library
   if impl(ghc == 7.8)
-    Build-depends: 
+    Build-depends:
       HTTP       >= 4000.2.5 && < 4000.3,
   if impl(ghc -any)
     Build-depends: mtl        >= 2.0      && < 3
@@ -126,7 +126,7 @@ (define test-cabal-6
   if impl(ghc>=7.2&&<7.6)
     Build-depends: ghc-b
   if impl(ghc == 7.8)
-    Build-depends: 
+    Build-depends:
       HTTP       >= 4000.2.5 && < 4000.3,
       mtl        >= 2.0      && < 3
 ")
@@ -524,8 +524,9 @@ (define-package-matcher match-ghc-foo-revision
     ('properties '(quote ((upstream-name . "foo"))))
     ('inputs ('list 'ghc-http))
     ('arguments
-     ('quasiquote
-      ('#:cabal-revision
+     ('list
+      '#:cabal-revision
+      ('quote
        ("2" "0xxd88fb659f0krljidbvvmkh9ppjnx83j0nqzx8whcg4n5qbyng"))))
     ('home-page "http://test.org")
     ('synopsis (? string?))
-- 
2.45.2





Information forwarded to laurent.gatto <at> gmail.com, rekado <at> elephly.net, zimon.toutoune <at> gmail.com, guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Mon, 09 Dec 2024 20:00:09 GMT) Full text and rfc822 format available.

Message #137 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Subject: [PATCH v4 08/11] import: cran: Use 'maybe-list-field' procedure.
Date: Mon,  9 Dec 2024 20:58:12 +0100
* guix/import/cran.scm (format-inputs): Delete procedure.
(maybe-inputs): Use 'maybe-list-field' procedure.

Change-Id: I5148afcebdac1f7fa0f8cce9e82e8cebb56c36c8
---
 guix/import/cran.scm | 36 ++++++++++++++++--------------------
 1 file changed, 16 insertions(+), 20 deletions(-)

diff --git a/guix/import/cran.scm b/guix/import/cran.scm
index fe69cb87f7..11843703ac 100644
--- a/guix/import/cran.scm
+++ b/guix/import/cran.scm
@@ -6,6 +6,7 @@
 ;;; Copyright © 2021 Sarah Morgensen <iskarian <at> mgsn.dev>
 ;;; Copyright © 2021 Simon Tournier <zimon.toutoune <at> gmail.com>
 ;;; Copyright © 2022 Hartmut Goebel <h.goebel <at> crazy-compilers.com>
+;;; Copyright © 2024 Herman Rimm <herman <at> rimm.ee>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -86,21 +87,6 @@ (define-module (guix import cran)
 (define %input-style
   (make-parameter 'variable)) ; or 'specification
 
-(define (format-inputs inputs)
-  "Generate a sorted list of package inputs from a list of upstream inputs."
-  (map (lambda (input)
-         (case (%input-style)
-           ((specification)
-            `(specification->package ,(upstream-input-downstream-name input)))
-           (else
-            ((compose string->symbol
-                       upstream-input-downstream-name)
-             input))))
-       (sort inputs
-             (lambda (a b)
-               (string-ci<? (upstream-input-name a)
-                            (upstream-input-name b))))))
-
 (define (string->licenses license-string license-prefix)
   (let ((licenses
          (map string-trim-both
@@ -189,11 +175,21 @@ (define (description->alist description)
 (define* (maybe-inputs package-inputs #:optional (input-type 'inputs))
   "Given a list of PACKAGE-INPUTS, tries to generate the TYPE field of a
 package definition."
-  (match package-inputs
-    (()
-     '())
-    ((package-inputs ...)
-     `((,input-type (list ,@(format-inputs package-inputs)))))))
+  (define (format-input input)
+    (case (%input-style)
+      ((specification)
+       `(specification->package ,(upstream-input-downstream-name input)))
+      (else
+       ((compose string->symbol
+                  upstream-input-downstream-name)
+        input))))
+
+  (define (upstream-input-name<? i1 i2)
+    (string-ci<? (upstream-input-name i1)
+                 (upstream-input-name i2)))
+
+  (maybe-list-field input-type
+    (map format-input (sort package-inputs upstream-input-name<?))))
 
 (define %cran-url "https://cloud.r-project.org/web/packages/")
 (define %cran-canonical-url "https://cran.r-project.org/package=")
-- 
2.45.2





Information forwarded to guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Mon, 09 Dec 2024 20:00:09 GMT) Full text and rfc822 format available.

Message #140 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Subject: [PATCH v4 09/11] import: cpan: Use 'maybe-upstream-inputs' procedure.
Date: Mon,  9 Dec 2024 20:58:13 +0100
* guix/import/cpan.scm (maybe-inputs): Delete procedure.
(cpan-module->sexp): Use 'maybe-upstream-inputs' procedure.

Change-Id: I4fa99da62d81f02c2998ad96f5ea81e27df071cd
---
 guix/import/cpan.scm | 25 ++++++++-----------------
 1 file changed, 8 insertions(+), 17 deletions(-)

diff --git a/guix/import/cpan.scm b/guix/import/cpan.scm
index 85e5e69098..e26cc85491 100644
--- a/guix/import/cpan.scm
+++ b/guix/import/cpan.scm
@@ -5,6 +5,7 @@
 ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me <at> tobias.gr>
 ;;; Copyright © 2020, 2021, 2023 Ludovic Courtès <ludo <at> gnu.org>
 ;;; Copyright © 2022 Hartmut Goebel <h.goebel <at> crazy-compilers.com>
+;;; Copyright © 2024 Herman Rimm <herman <at> rimm.ee>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -37,8 +38,9 @@ (define-module (guix import cpan)
   #:use-module (guix utils)
   #:use-module (guix base32)
   #:use-module ((guix download) #:select (download-to-store url-fetch))
-  #:use-module ((guix import utils)
-                #:select (factorize-uri recursive-import))
+  #:use-module ((guix import utils) #:select (factorize-uri
+                                              maybe-upstream-inputs
+                                              recursive-import))
   #:use-module (guix import json)
   #:use-module (guix packages)
   #:use-module (guix upstream)
@@ -277,15 +279,6 @@ (define (cpan-module->sexp release)
   (define version (cpan-release-version release))
   (define source-url (cpan-source-url release))
 
-  (define (maybe-inputs input-type inputs)
-    (match inputs
-      (()
-       '())
-      ((inputs ...)
-       `((,input-type (list ,@(map (compose string->symbol
-                                            upstream-input-downstream-name)
-                                   inputs)))))))
-
   (let* ((tarball (with-store store
                    (download-to-store store source-url)))
          (inputs (cpan-module-inputs release))
@@ -300,12 +293,10 @@ (define (cpan-module->sexp release)
                           (base32
                             ,(bytevector->nix-base32-string (file-sha256 tarball))))))
               (build-system perl-build-system)
-              ,@(maybe-inputs 'native-inputs
-                              (filter (upstream-input-type-predicate 'native)
-                                      inputs))
-              ,@(maybe-inputs 'propagated-inputs
-                              (filter (upstream-input-type-predicate 'propagated)
-                                      inputs))
+              ,@(maybe-upstream-inputs 'native-inputs
+                  (filter (upstream-input-type-predicate 'native) inputs))
+              ,@(maybe-upstream-inputs 'propagated-inputs
+                  (filter (upstream-input-type-predicate 'propagated) inputs))
               (home-page ,(cpan-home name))
               (synopsis ,(cpan-release-abstract release))
               (description fill-in-yourself!)
-- 
2.45.2





Information forwarded to guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Mon, 09 Dec 2024 20:00:10 GMT) Full text and rfc822 format available.

Message #143 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Subject: [PATCH v4 10/11] import: egg: Use maybe-*inputs procedures.
Date: Mon,  9 Dec 2024 20:58:14 +0100
* guix/import/egg.scm (maybe-inputs): Delete procedure.
(egg-parse-dependency): Simplify procedure to return strings.
(egg->guix-package): Use maybe-*inputs procedures.

Change-Id: Ib0a3f5b6f02912c847defd02ba7675d80005279b
---
 guix/import/egg.scm | 39 +++++++++++----------------------------
 1 file changed, 11 insertions(+), 28 deletions(-)

diff --git a/guix/import/egg.scm b/guix/import/egg.scm
index a87de1453e..049c45257e 100644
--- a/guix/import/egg.scm
+++ b/guix/import/egg.scm
@@ -4,6 +4,7 @@
 ;;; Copyright © 2021 Sarah Morgensen <iskarian <at> mgsn.dev>
 ;;; Copyright © 2022 Hartmut Goebel <h.goebel <at> crazy-compilers.com>
 ;;; Copyright © 2024 Ekaitz Zarraga <ekaitz <at> elenq.tech>
+;;; Copyright © 2024 Herman Rimm <herman <at> rimm.ee>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -230,23 +231,14 @@ (define* (egg->guix-package name version #:key (file #f) (source #f)
                           (else char)))
                       (maybe-symbol->string name)))
 
-        (define* (egg-parse-dependency name #:key (system? #f))
-          (define extract-name
-            (match-lambda
-              ((name version) name)
-              (name name)))
-
-          (define (prettify-name name)
+        (define* (egg-parse-dependency dependency #:key (system? #f))
+          (let ((name (match dependency
+                        ((name version) name)
+                        (name name))))
             (if system?
                 (prettify-system-dependency name)
-                (maybe-symbol->string name)))
-
-          (let ((name (prettify-name (extract-name name))))
-            ;; Dependencies are sometimes specified as symbols and sometimes
-            ;; as strings
-            (string->symbol (string-append
-                             (if system? "" package-name-prefix)
-                             name))))
+                (string-append package-name-prefix
+                               (maybe-symbol->string name)))))
 
         (define egg-propagated-inputs
           (let ((dependencies (assoc-ref egg-content 'dependencies)))
@@ -278,15 +270,6 @@ (define* (egg->guix-package name version #:key (file #f) (source #f)
                               test+build-dependencies))
               (() '()))))
 
-        ;; Copied from (guix import hackage).
-        (define (maybe-inputs input-type inputs)
-          (match inputs
-            (()
-             '())
-            ((inputs ...)
-             (list (list input-type
-                         `(list ,@inputs))))))
-
         (values
          `(package
             (name ,(egg-name->guix-name name))
@@ -304,16 +287,16 @@ (define* (egg->guix-package name version #:key (file #f) (source #f)
                                    "failed to download tar archive"))))))
             (build-system chicken-build-system)
             (arguments ,(list 'quasiquote (list #:egg-name name)))
-            ,@(maybe-inputs 'native-inputs egg-native-inputs)
-            ,@(maybe-inputs 'inputs egg-inputs)
-            ,@(maybe-inputs 'propagated-inputs egg-propagated-inputs)
+            ,@(maybe-native-inputs egg-native-inputs)
+            ,@(maybe-inputs egg-inputs)
+            ,@(maybe-propagated-inputs egg-propagated-inputs)
             (home-page ,egg-home-page)
             (synopsis ,egg-synopsis)
             (description #f)
             (license ,egg-licenses))
          (filter (lambda (name)
                    (not (member name '("srfi-4"))))
-                 (map (compose guix-name->egg-name symbol->string)
+                 (map guix-name->egg-name
                       (append egg-propagated-inputs
                               egg-native-inputs)))))))
 
-- 
2.45.2





Information forwarded to guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Mon, 09 Dec 2024 20:00:11 GMT) Full text and rfc822 format available.

Message #146 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Subject: [PATCH v4 11/11] import: hexpm: Use (guix import utils)
 'maybe-inputs' procedure.
Date: Mon,  9 Dec 2024 20:58:15 +0100
* guix/import/hexpm.scm (maybe-inputs): Delete procedure.
(dependencies->package-names): Return strings instead of symbols.
(make-hexpm-sexp): Use 'maybe-inputs' from (guix import utils).

Change-Id: Ie7a8a630a3a9d4859453d49fdee42aa560e27f17
---
 guix/import/hexpm.scm | 29 +++++++++--------------------
 1 file changed, 9 insertions(+), 20 deletions(-)

diff --git a/guix/import/hexpm.scm b/guix/import/hexpm.scm
index 71a54ba973..a7d74e24c3 100644
--- a/guix/import/hexpm.scm
+++ b/guix/import/hexpm.scm
@@ -5,6 +5,7 @@
 ;;; Copyright © 2019 Martin Becze <mjbecze <at> riseup.net>
 ;;; Copyright © 2019 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
 ;;; Copyright © 2020-2022 Hartmut Goebel <h.goebel <at> crazy-compilers.com>
+;;; Copyright © 2024 Herman Rimm <herman <at> rimm.ee>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -153,26 +154,14 @@ (define (lookup-hexpm-release version*)
 ;;; Converting hex.pm packages to Guix packages.
 ;;;
 
-(define (maybe-inputs package-inputs input-type)
-  "Given a list of PACKAGE-INPUTS, tries to generate the 'inputs' field of a
-package definition.  INPUT-TYPE, a symbol, is used to populate the name of
-the input field."
-  (match package-inputs
-    (()
-     '())
-    ((package-inputs ...)
-     `((,input-type (list ,@package-inputs))))))
-
 (define (dependencies->package-names names)
-  "Given a list of hexpm package NAMES, returns a list of guix package names
-as symbols."
-  ;; TODO: Base name on language of dependency.
-  ;; The language used for implementing the dependency is not know without
-  ;; recursing the dependencies.  So for now assume more packages are based on
-  ;; Erlang and prefix all dependencies with "erlang-" (the default).
-  (map string->symbol
-       (map hexpm-name->package-name
-            (sort names string-ci<?))))
+  "Given a list of hexpm package NAMES, returns a list of guix package
+names."
+  ;; TODO: Base name on the programming language of the dependency.
+  ;; The language used for implementing the dependency can only be known
+  ;; by traversing the dependencies.  So for now assume packages are
+  ;; based on Erlang, and prefix dependencies with "erlang-" by default.
+  (map hexpm-name->package-name (sort names string-ci<?)))
 
 (define* (make-hexpm-sexp #:key name version tarball-url
                           home-page synopsis description license
@@ -194,7 +183,7 @@ (define* (make-hexpm-sexp #:key name version tarball-url
                    (uri (hexpm-uri ,name version))
                    (sha256 (base32 ,(guix-hash-url temp)))))
          (build-system ,build-system)
-         ,@(maybe-inputs (dependencies->package-names dependencies) 'inputs)
+         ,@(maybe-inputs (dependencies->package-names dependencies))
          (synopsis ,synopsis)
          (description ,(beautify-description description))
          (home-page ,(match home-page
-- 
2.45.2





Information forwarded to lars <at> 6xq.net, marius <at> gnu.org, me <at> bonfacemunyoki.com, sharlatanus <at> gmail.com, tanguy <at> bioneland.org, jgart <at> dismail.de, guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Mon, 09 Dec 2024 20:00:12 GMT) Full text and rfc822 format available.

Message #149 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70923 <at> debbugs.gnu.org
Subject: [PATCH v4 05/11] import: pypi: Use 'maybe-list-field' procedure.
Date: Mon,  9 Dec 2024 20:58:09 +0100
* guix/import/pypi.scm (maybe-inputs): Delete procedure.
(make-pypi-sexp): Use 'maybe-list-field' and 'maybe-upstream-inputs'
procedures.
---
 guix/import/pypi.scm | 21 +++++----------------
 1 file changed, 5 insertions(+), 16 deletions(-)

diff --git a/guix/import/pypi.scm b/guix/import/pypi.scm
index 7b9f54a200..a98fdfa604 100644
--- a/guix/import/pypi.scm
+++ b/guix/import/pypi.scm
@@ -14,6 +14,7 @@
 ;;; Copyright © 2022 Vivien Kraus <vivien <at> planete-kraus.eu>
 ;;; Copyright © 2021 Simon Tournier <zimon.toutoune <at> gmail.com>
 ;;; Copyright © 2022 Hartmut Goebel <h.goebel <at> crazy-compilers.com>
+;;; Copyright © 2024 Herman Rimm <herman <at> rimm.ee>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -201,18 +202,6 @@ (define (wheel-url->extracted-directory wheel-url)
     ((name version _ ...)
      (string-append name "-" version ".dist-info"))))
 
-(define (maybe-inputs package-inputs input-type)
-  "Given a list of PACKAGE-INPUTS, tries to generate the 'inputs' field of a
-package definition.  INPUT-TYPE, a symbol, is used to populate the name of
-the input field."
-  (match package-inputs
-    (()
-     '())
-    ((package-inputs ...)
-     `((,input-type (list ,@(map (compose string->symbol
-                                          upstream-input-downstream-name)
-                                 package-inputs)))))))
-
 (define %requirement-name-regexp
   ;; Regexp to match the requirement name in a requirement specification.
 
@@ -538,10 +527,10 @@ (define* (make-pypi-sexp pypi-package
                             bytevector->nix-base32-string)))))
         ,@(maybe-upstream-name name)
         (build-system pyproject-build-system)
-        ,@(maybe-inputs (upstream-source-propagated-inputs source)
-                        'propagated-inputs)
-        ,@(maybe-inputs (upstream-source-native-inputs source)
-                        'native-inputs)
+        ,@(maybe-upstream-inputs 'propagated-inputs
+            (upstream-source-propagated-inputs source))
+        ,@(maybe-upstream-inputs 'native-inputs
+            (upstream-source-native-inputs source))
         (home-page ,(project-info-home-page info))
         (synopsis ,(project-info-summary info))
         (description ,(and=> (non-empty-string-or-false
-- 
2.45.2





Information forwarded to guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Tue, 10 Dec 2024 15:43:02 GMT) Full text and rfc822 format available.

Message #152 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Efraim Flashner <efraim <at> flashner.co.il>
To: Herman Rimm <herman <at> rimm.ee>
Cc: 70923 <at> debbugs.gnu.org
Subject: Re: [bug#70923] [PATCH v4 01/11] build-system: cargo: Accept
 unlabeled #:cargo-inputs.
Date: Tue, 10 Dec 2024 17:41:27 +0200
[Message part 1 (text/plain, inline)]
I've applied this one for now to the rust-team branch since it'll cause
a rebuild if applied to master.

I tried out the patches for the importer too, but I think with the
changes it needs the input from some other teams too?

On Mon, Dec 09, 2024 at 08:58:05PM +0100, Herman Rimm wrote:
> * guix/build-system/cargo.scm (crate-closure): Match unlabeled inputs.
> 
> Change-Id: Iae421281fa08d09ddd1e5d2da2864f0093d97cd1
> ---
>  guix/build-system/cargo.scm | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/guix/build-system/cargo.scm b/guix/build-system/cargo.scm
> index 658a2e525e..2e3061c0e8 100644
> --- a/guix/build-system/cargo.scm
> +++ b/guix/build-system/cargo.scm
> @@ -6,6 +6,7 @@
>  ;;; Copyright © 2019 Ivan Petkov <ivanppetkov <at> gmail.com>
>  ;;; Copyright © 2020 Jakub Kądziołka <kuba <at> kadziolka.net>
>  ;;; Copyright © 2021 Efraim Flashner <efraim <at> flashner.co.il>
> +;;; Copyright © 2024 Herman Rimm <herman <at> rimm.ee>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -234,11 +235,14 @@ (define (crate-closure inputs)
>         (if (null? propagated)
>             (reverse result)
>             (loop (reverse (concatenate propagated)) result '() #f seen)))
> -      (((and input (label (? package? package))) rest ...)
> +      ;; Match inputs with labels for backward compatibility.
> +      (((or (_ (? package? package))
> +            (? package? package))
> +        rest ...)
>         (if (and (not first?) (seen? seen package))
>             (loop rest result propagated first? seen)
>             (loop rest
> -                 (cons input result)
> +                 (cons package result)
>                   (cons (package-cargo-inputs package)
>                         propagated)
>                   first?
> @@ -296,8 +300,8 @@ (define (expand-crate-sources cargo-inputs cargo-development-inputs)
>    something that can always be extended or reworked in the future)."
>    (filter-map
>      (match-lambda
> -      ((label (? package? p))
> -       (list label (package-source p)))
> +      ((? package? p)
> +       (list (package-name p) (package-source p)))
>        ((label input)
>         (list label input)))
>      (crate-closure (append cargo-inputs cargo-development-inputs))))
> 
> base-commit: a5a540d71331fd43fd53e23eb49102c55462c28f
> -- 
> 2.45.2
> 
> 
> 

-- 
Efraim Flashner   <efraim <at> flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Tue, 10 Dec 2024 17:36:02 GMT) Full text and rfc822 format available.

Message #155 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Lars-Dominik Braun <lars <at> 6xq.net>
To: Herman Rimm <herman <at> rimm.ee>
Cc: 70923 <at> debbugs.gnu.org
Subject: Re: [bug#70923] [PATCH v4 07/11] import: hackage: Use
 'maybe-list-field' procedure.
Date: Tue, 10 Dec 2024 18:35:26 +0100
Hi,

> --- a/tests/hackage.scm
> +++ b/tests/hackage.scm
> @@ -67,7 +67,7 @@ (define test-cabal-3
>    if impl(ghc>=7.2&&<7.6)
>      Build-depends: ghc-b
>    if impl(ghc == 7.8)
> -    Build-depends: 
> +    Build-depends:
>        HTTP       >= 4000.2.5 && < 4000.3,
>        mtl        >= 2.0      && < 3
>  ")
> @@ -86,7 +86,7 @@ (define test-cabal-4
>    if impl(ghc>=7.2&&<7.6)
>      Build-depends: ghc-b
>    if impl(ghc == 7.8)
> -    Build-depends: 
> +    Build-depends:
>        HTTP       >= 4000.2.5 && < 4000.3,
>        mtl        >= 2.0      && < 3
>  ")
> @@ -101,7 +101,7 @@ (define test-cabal-5
>  license: BSD3
>  library
>    if impl(ghc == 7.8)
> -    Build-depends: 
> +    Build-depends:
>        HTTP       >= 4000.2.5 && < 4000.3,
>    if impl(ghc -any)
>      Build-depends: mtl        >= 2.0      && < 3
> @@ -126,7 +126,7 @@ (define test-cabal-6
>    if impl(ghc>=7.2&&<7.6)
>      Build-depends: ghc-b
>    if impl(ghc == 7.8)
> -    Build-depends: 
> +    Build-depends:
>        HTTP       >= 4000.2.5 && < 4000.3,
>        mtl        >= 2.0      && < 3
>  ")

why are these changes to the tests required? Having a space after the
colon is legal as far as I know.

Lars





Information forwarded to guix-patches <at> gnu.org:
bug#70923; Package guix-patches. (Thu, 12 Dec 2024 21:36:02 GMT) Full text and rfc822 format available.

Message #158 received at 70923 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: Lars-Dominik Braun <lars <at> 6xq.net>
Cc: 70923 <at> debbugs.gnu.org
Subject: Re: [bug#70923] [PATCH v4 07/11] import: hackage: Use
 'maybe-list-field' procedure.
Date: Thu, 12 Dec 2024 22:34:48 +0100
Hello,

On Tue, Dec 10, 2024 at 06:35:26PM +0100, Lars-Dominik Braun wrote:
> why are these changes to the tests required? Having a space after the
> colon is legal as far as I know.

Removing the trailing whitespace is not required.  It doesn't change the
test results.

Cheers,
Herman




This bug report was last modified 184 days ago.

Previous Next


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