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





This bug report was last modified 26 days ago.

Previous Next


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