* [bug#70923] [PATCH 00/13] Add (guix import utils) procedures.
@ 2024-05-13 19:59 Herman Rimm via Guix-patches via
2024-05-13 20:07 ` [bug#70923] [PATCH 01/13] build-system: cargo: Accept unlabeled #:cargo-inputs Herman Rimm via Guix-patches via
` (14 more replies)
0 siblings, 15 replies; 38+ messages in thread
From: Herman Rimm via Guix-patches via @ 2024-05-13 19:59 UTC (permalink / raw)
To: 70923
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
^ permalink raw reply [flat|nested] 38+ messages in thread
* [bug#70923] [PATCH 01/13] build-system: cargo: Accept unlabeled #:cargo-inputs.
2024-05-13 19:59 [bug#70923] [PATCH 00/13] Add (guix import utils) procedures Herman Rimm via Guix-patches via
@ 2024-05-13 20:07 ` Herman Rimm via Guix-patches via
2024-05-13 20:07 ` [bug#70923] [PATCH 02/13] import: utils: Emit new-style package inputs Herman Rimm via Guix-patches via
` (13 subsequent siblings)
14 siblings, 0 replies; 38+ messages in thread
From: Herman Rimm via Guix-patches via @ 2024-05-13 20:07 UTC (permalink / raw)
To: 70923; +Cc: Efraim Flashner
* 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
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#70923] [PATCH 02/13] import: utils: Emit new-style package inputs.
2024-05-13 19:59 [bug#70923] [PATCH 00/13] Add (guix import utils) procedures Herman Rimm via Guix-patches via
2024-05-13 20:07 ` [bug#70923] [PATCH 01/13] build-system: cargo: Accept unlabeled #:cargo-inputs Herman Rimm via Guix-patches via
@ 2024-05-13 20:07 ` Herman Rimm via Guix-patches via
2024-05-13 20:08 ` [bug#70923] [PATCH 03/13] tests: go: Adjust to " Herman Rimm via Guix-patches via
` (12 subsequent siblings)
14 siblings, 0 replies; 38+ messages in thread
From: Herman Rimm via Guix-patches via @ 2024-05-13 20:07 UTC (permalink / raw)
To: 70923; +Cc: Sarah Morgensen
From: Sarah Morgensen <iskarian@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@ens-lyon.fr>
;;; Copyright © 2022 Kyle Meyer <kyle@kyleam.com>
;;; Copyright © 2022 Philip McGrath <philip@philipmcgrath.com>
+;;; Copyright © 2024 Herman Rimm <herman@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
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#70923] [PATCH 03/13] tests: go: Adjust to new-style package inputs.
2024-05-13 19:59 [bug#70923] [PATCH 00/13] Add (guix import utils) procedures Herman Rimm via Guix-patches via
2024-05-13 20:07 ` [bug#70923] [PATCH 01/13] build-system: cargo: Accept unlabeled #:cargo-inputs Herman Rimm via Guix-patches via
2024-05-13 20:07 ` [bug#70923] [PATCH 02/13] import: utils: Emit new-style package inputs Herman Rimm via Guix-patches via
@ 2024-05-13 20:08 ` Herman Rimm via Guix-patches via
2024-05-13 20:08 ` [bug#70923] [PATCH 04/13] tests: elm: " Herman Rimm via Guix-patches via
` (11 subsequent siblings)
14 siblings, 0 replies; 38+ messages in thread
From: Herman Rimm via Guix-patches via @ 2024-05-13 20:08 UTC (permalink / raw)
To: 70923; +Cc: Sarah Morgensen, Katherine Cox-Buday, Sharlatan Hellseher
From: Sarah Morgensen <iskarian@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
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#70923] [PATCH 04/13] tests: elm: Adjust to new-style package inputs.
2024-05-13 19:59 [bug#70923] [PATCH 00/13] Add (guix import utils) procedures Herman Rimm via Guix-patches via
` (2 preceding siblings ...)
2024-05-13 20:08 ` [bug#70923] [PATCH 03/13] tests: go: Adjust to " Herman Rimm via Guix-patches via
@ 2024-05-13 20:08 ` Herman Rimm via Guix-patches via
2024-05-13 20:08 ` [bug#70923] [PATCH 05/13] import: crate: Emit " Herman Rimm via Guix-patches via
` (10 subsequent siblings)
14 siblings, 0 replies; 38+ messages in thread
From: Herman Rimm via Guix-patches via @ 2024-05-13 20:08 UTC (permalink / raw)
To: 70923
* 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
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#70923] [PATCH 05/13] import: crate: Emit new-style package inputs.
2024-05-13 19:59 [bug#70923] [PATCH 00/13] Add (guix import utils) procedures Herman Rimm via Guix-patches via
` (3 preceding siblings ...)
2024-05-13 20:08 ` [bug#70923] [PATCH 04/13] tests: elm: " Herman Rimm via Guix-patches via
@ 2024-05-13 20:08 ` Herman Rimm via Guix-patches via
2024-05-13 20:08 ` [bug#70923] [PATCH 06/13] import: utils: Add 'maybe-upstream-inputs' procedure Herman Rimm via Guix-patches via
` (9 subsequent siblings)
14 siblings, 0 replies; 38+ messages in thread
From: Herman Rimm via Guix-patches via @ 2024-05-13 20:08 UTC (permalink / raw)
To: 70923; +Cc: Sarah Morgensen, Efraim Flashner
From: Sarah Morgensen <iskarian@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@gmail.com>
;;; Copyright © 2023, 2024 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2023, 2024 David Elsing <david.elsing@posteo.net>
+;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
+;;; Copyright © 2024 Herman Rimm <herman@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@riseup.net>
;;; Copyright © 2023 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2023 David Elsing <david.elsing@posteo.net>
+;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
+;;; Copyright © 2024 Herman Rimm <herman@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
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#70923] [PATCH 06/13] import: utils: Add 'maybe-upstream-inputs' procedure.
2024-05-13 19:59 [bug#70923] [PATCH 00/13] Add (guix import utils) procedures Herman Rimm via Guix-patches via
` (4 preceding siblings ...)
2024-05-13 20:08 ` [bug#70923] [PATCH 05/13] import: crate: Emit " Herman Rimm via Guix-patches via
@ 2024-05-13 20:08 ` Herman Rimm via Guix-patches via
2024-05-13 20:08 ` [bug#70923] [PATCH 07/13] import: pypi: Use 'maybe-list-field' procedure Herman Rimm via Guix-patches via
` (8 subsequent siblings)
14 siblings, 0 replies; 38+ messages in thread
From: Herman Rimm via Guix-patches via @ 2024-05-13 20:08 UTC (permalink / raw)
To: 70923
* 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
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#70923] [PATCH 07/13] import: pypi: Use 'maybe-list-field' procedure.
2024-05-13 19:59 [bug#70923] [PATCH 00/13] Add (guix import utils) procedures Herman Rimm via Guix-patches via
` (5 preceding siblings ...)
2024-05-13 20:08 ` [bug#70923] [PATCH 06/13] import: utils: Add 'maybe-upstream-inputs' procedure Herman Rimm via Guix-patches via
@ 2024-05-13 20:08 ` Herman Rimm via Guix-patches via
2024-05-13 20:08 ` [bug#70923] [PATCH 08/13] import: elpa: Use maybe-propagated-inputs procedure Herman Rimm via Guix-patches via
` (7 subsequent siblings)
14 siblings, 0 replies; 38+ messages in thread
From: Herman Rimm via Guix-patches via @ 2024-05-13 20:08 UTC (permalink / raw)
To: 70923
Cc: Lars-Dominik Braun, Marius Bakke, Munyoki Kilyungi,
Sharlatan Hellseher, Tanguy Le Carrour, jgart
* 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
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#70923] [PATCH 08/13] import: elpa: Use maybe-propagated-inputs procedure.
2024-05-13 19:59 [bug#70923] [PATCH 00/13] Add (guix import utils) procedures Herman Rimm via Guix-patches via
` (6 preceding siblings ...)
2024-05-13 20:08 ` [bug#70923] [PATCH 07/13] import: pypi: Use 'maybe-list-field' procedure Herman Rimm via Guix-patches via
@ 2024-05-13 20:08 ` Herman Rimm via Guix-patches via
2024-05-13 20:08 ` [bug#70923] [PATCH 09/13] import: hackage: Use 'maybe-list-field' procedure Herman Rimm via Guix-patches via
` (6 subsequent siblings)
14 siblings, 0 replies; 38+ messages in thread
From: Herman Rimm via Guix-patches via @ 2024-05-13 20:08 UTC (permalink / raw)
To: 70923; +Cc: Andrew Tropin, Katherine Cox-Buday, Liliana Marie Prikler
* 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
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#70923] [PATCH 09/13] import: hackage: Use 'maybe-list-field' procedure.
2024-05-13 19:59 [bug#70923] [PATCH 00/13] Add (guix import utils) procedures Herman Rimm via Guix-patches via
` (7 preceding siblings ...)
2024-05-13 20:08 ` [bug#70923] [PATCH 08/13] import: elpa: Use maybe-propagated-inputs procedure Herman Rimm via Guix-patches via
@ 2024-05-13 20:08 ` Herman Rimm via Guix-patches via
2024-05-13 20:08 ` [bug#70923] [PATCH 10/13] import: cran: " Herman Rimm via Guix-patches via
` (5 subsequent siblings)
14 siblings, 0 replies; 38+ messages in thread
From: Herman Rimm via Guix-patches via @ 2024-05-13 20:08 UTC (permalink / raw)
To: 70923; +Cc: Lars-Dominik Braun
* 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
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#70923] [PATCH 10/13] import: cran: Use 'maybe-list-field' procedure.
2024-05-13 19:59 [bug#70923] [PATCH 00/13] Add (guix import utils) procedures Herman Rimm via Guix-patches via
` (8 preceding siblings ...)
2024-05-13 20:08 ` [bug#70923] [PATCH 09/13] import: hackage: Use 'maybe-list-field' procedure Herman Rimm via Guix-patches via
@ 2024-05-13 20:08 ` Herman Rimm via Guix-patches via
2024-05-13 20:08 ` [bug#70923] [PATCH 11/13] import: cpan: Use 'maybe-upstream-inputs' procedure Herman Rimm via Guix-patches via
` (4 subsequent siblings)
14 siblings, 0 replies; 38+ messages in thread
From: Herman Rimm via Guix-patches via @ 2024-05-13 20:08 UTC (permalink / raw)
To: 70923; +Cc: Ricardo Wurmus
* 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
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#70923] [PATCH 11/13] import: cpan: Use 'maybe-upstream-inputs' procedure.
2024-05-13 19:59 [bug#70923] [PATCH 00/13] Add (guix import utils) procedures Herman Rimm via Guix-patches via
` (9 preceding siblings ...)
2024-05-13 20:08 ` [bug#70923] [PATCH 10/13] import: cran: " Herman Rimm via Guix-patches via
@ 2024-05-13 20:08 ` Herman Rimm via Guix-patches via
2024-05-13 20:08 ` [bug#70923] [PATCH 12/13] import: egg: Use maybe-*inputs procedures Herman Rimm via Guix-patches via
` (3 subsequent siblings)
14 siblings, 0 replies; 38+ messages in thread
From: Herman Rimm via Guix-patches via @ 2024-05-13 20:08 UTC (permalink / raw)
To: 70923
* 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
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#70923] [PATCH 12/13] import: egg: Use maybe-*inputs procedures.
2024-05-13 19:59 [bug#70923] [PATCH 00/13] Add (guix import utils) procedures Herman Rimm via Guix-patches via
` (10 preceding siblings ...)
2024-05-13 20:08 ` [bug#70923] [PATCH 11/13] import: cpan: Use 'maybe-upstream-inputs' procedure Herman Rimm via Guix-patches via
@ 2024-05-13 20:08 ` Herman Rimm via Guix-patches via
2024-05-13 20:08 ` [bug#70923] [PATCH 13/13] import: hexpm: Use (guix import utils) 'maybe-inputs' procedure Herman Rimm via Guix-patches via
` (2 subsequent siblings)
14 siblings, 0 replies; 38+ messages in thread
From: Herman Rimm via Guix-patches via @ 2024-05-13 20:08 UTC (permalink / raw)
To: 70923
* 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
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#70923] [PATCH 13/13] import: hexpm: Use (guix import utils) 'maybe-inputs' procedure.
2024-05-13 19:59 [bug#70923] [PATCH 00/13] Add (guix import utils) procedures Herman Rimm via Guix-patches via
` (11 preceding siblings ...)
2024-05-13 20:08 ` [bug#70923] [PATCH 12/13] import: egg: Use maybe-*inputs procedures Herman Rimm via Guix-patches via
@ 2024-05-13 20:08 ` Herman Rimm via Guix-patches via
2024-09-04 20:32 ` [bug#70923] [PATCH v2 01/12] build-system: cargo: Accept unlabeled #:cargo-inputs Herman Rimm via Guix-patches via
2024-09-24 20:13 ` [bug#70923] [PATCH v3 00/11] Add (guix import utils) procedures Herman Rimm via Guix-patches via
14 siblings, 0 replies; 38+ messages in thread
From: Herman Rimm via Guix-patches via @ 2024-05-13 20:08 UTC (permalink / raw)
To: 70923
* 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
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#70923] [PATCH v2 01/12] build-system: cargo: Accept unlabeled #:cargo-inputs.
2024-05-13 19:59 [bug#70923] [PATCH 00/13] Add (guix import utils) procedures Herman Rimm via Guix-patches via
` (12 preceding siblings ...)
2024-05-13 20:08 ` [bug#70923] [PATCH 13/13] import: hexpm: Use (guix import utils) 'maybe-inputs' procedure Herman Rimm via Guix-patches via
@ 2024-09-04 20:32 ` Herman Rimm via Guix-patches via
2024-09-04 20:32 ` [bug#70923] [PATCH v2 02/12] import: utils: Emit new-style inputs from maybe-*inputs procedures Herman Rimm via Guix-patches via
` (10 more replies)
2024-09-24 20:13 ` [bug#70923] [PATCH v3 00/11] Add (guix import utils) procedures Herman Rimm via Guix-patches via
14 siblings, 11 replies; 38+ messages in thread
From: Herman Rimm via Guix-patches via @ 2024-09-04 20:32 UTC (permalink / raw)
To: 70923
* 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@gmail.com>
;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
;;; Copyright © 2021 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2024 Herman Rimm <herman@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
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#70923] [PATCH v2 02/12] import: utils: Emit new-style inputs from maybe-*inputs procedures.
2024-09-04 20:32 ` [bug#70923] [PATCH v2 01/12] build-system: cargo: Accept unlabeled #:cargo-inputs Herman Rimm via Guix-patches via
@ 2024-09-04 20:32 ` Herman Rimm via Guix-patches via
2024-09-04 20:32 ` [bug#70923] [PATCH v2 03/12] tests: elm: Adjust to new-style package inputs Herman Rimm via Guix-patches via
` (9 subsequent siblings)
10 siblings, 0 replies; 38+ messages in thread
From: Herman Rimm via Guix-patches via @ 2024-09-04 20:32 UTC (permalink / raw)
To: 70923
* 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@ens-lyon.fr>
;;; Copyright © 2022 Kyle Meyer <kyle@kyleam.com>
;;; Copyright © 2022 Philip McGrath <philip@philipmcgrath.com>
+;;; Copyright © 2024 Herman Rimm <herman@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
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#70923] [PATCH v2 03/12] tests: elm: Adjust to new-style package inputs.
2024-09-04 20:32 ` [bug#70923] [PATCH v2 01/12] build-system: cargo: Accept unlabeled #:cargo-inputs Herman Rimm via Guix-patches via
2024-09-04 20:32 ` [bug#70923] [PATCH v2 02/12] import: utils: Emit new-style inputs from maybe-*inputs procedures Herman Rimm via Guix-patches via
@ 2024-09-04 20:32 ` Herman Rimm via Guix-patches via
2024-09-04 20:32 ` [bug#70923] [PATCH v2 04/12] import: crate: Use (guix import utils) procedures Herman Rimm via Guix-patches via
` (8 subsequent siblings)
10 siblings, 0 replies; 38+ messages in thread
From: Herman Rimm via Guix-patches via @ 2024-09-04 20:32 UTC (permalink / raw)
To: 70923
* 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
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#70923] [PATCH v2 04/12] import: crate: Use (guix import utils) procedures.
2024-09-04 20:32 ` [bug#70923] [PATCH v2 01/12] build-system: cargo: Accept unlabeled #:cargo-inputs Herman Rimm via Guix-patches via
2024-09-04 20:32 ` [bug#70923] [PATCH v2 02/12] import: utils: Emit new-style inputs from maybe-*inputs procedures Herman Rimm via Guix-patches via
2024-09-04 20:32 ` [bug#70923] [PATCH v2 03/12] tests: elm: Adjust to new-style package inputs Herman Rimm via Guix-patches via
@ 2024-09-04 20:32 ` Herman Rimm via Guix-patches via
2024-09-04 20:32 ` [bug#70923] [PATCH v2 05/12] import: utils: Add maybe-upstream-inputs Herman Rimm via Guix-patches via
` (7 subsequent siblings)
10 siblings, 0 replies; 38+ messages in thread
From: Herman Rimm via Guix-patches via @ 2024-09-04 20:32 UTC (permalink / raw)
To: 70923
* 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@gmail.com>
;;; Copyright © 2023, 2024 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2023, 2024 David Elsing <david.elsing@posteo.net>
+;;; Copyright © 2024 Herman Rimm <herman@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@mgsn.dev>
;;; Copyright © 2023 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2023 David Elsing <david.elsing@posteo.net>
+;;; Copyright © 2024 Herman Rimm <herman@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
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#70923] [PATCH v2 05/12] import: utils: Add maybe-upstream-inputs.
2024-09-04 20:32 ` [bug#70923] [PATCH v2 01/12] build-system: cargo: Accept unlabeled #:cargo-inputs Herman Rimm via Guix-patches via
` (2 preceding siblings ...)
2024-09-04 20:32 ` [bug#70923] [PATCH v2 04/12] import: crate: Use (guix import utils) procedures Herman Rimm via Guix-patches via
@ 2024-09-04 20:32 ` Herman Rimm via Guix-patches via
2024-09-04 20:33 ` [bug#70923] [PATCH v2 06/12] import: pypi: Use maybe-upstream-inputs Herman Rimm via Guix-patches via
` (6 subsequent siblings)
10 siblings, 0 replies; 38+ messages in thread
From: Herman Rimm via Guix-patches via @ 2024-09-04 20:32 UTC (permalink / raw)
To: 70923
* 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
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#70923] [PATCH v2 06/12] import: pypi: Use maybe-upstream-inputs.
2024-09-04 20:32 ` [bug#70923] [PATCH v2 01/12] build-system: cargo: Accept unlabeled #:cargo-inputs Herman Rimm via Guix-patches via
` (3 preceding siblings ...)
2024-09-04 20:32 ` [bug#70923] [PATCH v2 05/12] import: utils: Add maybe-upstream-inputs Herman Rimm via Guix-patches via
@ 2024-09-04 20:33 ` Herman Rimm via Guix-patches via
2024-09-04 20:33 ` [bug#70923] [PATCH v2 07/12] import: elpa: Use maybe-propagated-inputse Herman Rimm via Guix-patches via
` (5 subsequent siblings)
10 siblings, 0 replies; 38+ messages in thread
From: Herman Rimm via Guix-patches via @ 2024-09-04 20:33 UTC (permalink / raw)
To: 70923
* 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@planete-kraus.eu>
;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
+;;; Copyright © 2024 Herman Rimm <herman@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
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#70923] [PATCH v2 07/12] import: elpa: Use maybe-propagated-inputse.
2024-09-04 20:32 ` [bug#70923] [PATCH v2 01/12] build-system: cargo: Accept unlabeled #:cargo-inputs Herman Rimm via Guix-patches via
` (4 preceding siblings ...)
2024-09-04 20:33 ` [bug#70923] [PATCH v2 06/12] import: pypi: Use maybe-upstream-inputs Herman Rimm via Guix-patches via
@ 2024-09-04 20:33 ` Herman Rimm via Guix-patches via
2024-09-04 20:33 ` [bug#70923] [PATCH v2 08/12] import: hackage: Use maybe-list-field Herman Rimm via Guix-patches via
` (4 subsequent siblings)
10 siblings, 0 replies; 38+ messages in thread
From: Herman Rimm via Guix-patches via @ 2024-09-04 20:33 UTC (permalink / raw)
To: 70923
* 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
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#70923] [PATCH v2 08/12] import: hackage: Use maybe-list-field.
2024-09-04 20:32 ` [bug#70923] [PATCH v2 01/12] build-system: cargo: Accept unlabeled #:cargo-inputs Herman Rimm via Guix-patches via
` (5 preceding siblings ...)
2024-09-04 20:33 ` [bug#70923] [PATCH v2 07/12] import: elpa: Use maybe-propagated-inputse Herman Rimm via Guix-patches via
@ 2024-09-04 20:33 ` Herman Rimm via Guix-patches via
2024-09-04 20:33 ` [bug#70923] [PATCH v2 09/12] import: cran: Refactor format-inputs and use maybe-list-field Herman Rimm via Guix-patches via
` (3 subsequent siblings)
10 siblings, 0 replies; 38+ messages in thread
From: Herman Rimm via Guix-patches via @ 2024-09-04 20:33 UTC (permalink / raw)
To: 70923
* 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@gmail.com>
;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;; Copyright © 2023-2024 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2024 Herman Rimm <herman@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
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#70923] [PATCH v2 09/12] import: cran: Refactor format-inputs and use maybe-list-field.
2024-09-04 20:32 ` [bug#70923] [PATCH v2 01/12] build-system: cargo: Accept unlabeled #:cargo-inputs Herman Rimm via Guix-patches via
` (6 preceding siblings ...)
2024-09-04 20:33 ` [bug#70923] [PATCH v2 08/12] import: hackage: Use maybe-list-field Herman Rimm via Guix-patches via
@ 2024-09-04 20:33 ` Herman Rimm via Guix-patches via
2024-09-04 20:33 ` [bug#70923] [PATCH v2 10/12] import: cpan: Use maybe-upstream-inputs Herman Rimm via Guix-patches via
` (2 subsequent siblings)
10 siblings, 0 replies; 38+ messages in thread
From: Herman Rimm via Guix-patches via @ 2024-09-04 20:33 UTC (permalink / raw)
To: 70923
* 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@mgsn.dev>
;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
+;;; Copyright © 2024 Herman Rimm <herman@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
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#70923] [PATCH v2 10/12] import: cpan: Use maybe-upstream-inputs.
2024-09-04 20:32 ` [bug#70923] [PATCH v2 01/12] build-system: cargo: Accept unlabeled #:cargo-inputs Herman Rimm via Guix-patches via
` (7 preceding siblings ...)
2024-09-04 20:33 ` [bug#70923] [PATCH v2 09/12] import: cran: Refactor format-inputs and use maybe-list-field Herman Rimm via Guix-patches via
@ 2024-09-04 20:33 ` Herman Rimm via Guix-patches via
2024-09-04 20:33 ` [bug#70923] [PATCH v2 11/12] import: egg: Use maybe-*inputs procedures Herman Rimm via Guix-patches via
2024-09-04 20:33 ` [bug#70923] [PATCH v2 12/12] import: hexpm: Use maybe-inputs Herman Rimm via Guix-patches via
10 siblings, 0 replies; 38+ messages in thread
From: Herman Rimm via Guix-patches via @ 2024-09-04 20:33 UTC (permalink / raw)
To: 70923
* 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@tobias.gr>
;;; Copyright © 2020, 2021, 2023 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
+;;; Copyright © 2024 Herman Rimm <herman@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
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#70923] [PATCH v2 11/12] import: egg: Use maybe-*inputs procedures.
2024-09-04 20:32 ` [bug#70923] [PATCH v2 01/12] build-system: cargo: Accept unlabeled #:cargo-inputs Herman Rimm via Guix-patches via
` (8 preceding siblings ...)
2024-09-04 20:33 ` [bug#70923] [PATCH v2 10/12] import: cpan: Use maybe-upstream-inputs Herman Rimm via Guix-patches via
@ 2024-09-04 20:33 ` Herman Rimm via Guix-patches via
2024-09-04 20:33 ` [bug#70923] [PATCH v2 12/12] import: hexpm: Use maybe-inputs Herman Rimm via Guix-patches via
10 siblings, 0 replies; 38+ messages in thread
From: Herman Rimm via Guix-patches via @ 2024-09-04 20:33 UTC (permalink / raw)
To: 70923
* 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@tobias.gr>
;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
+;;; Copyright © 2024 Herman Rimm <herman@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
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#70923] [PATCH v2 12/12] import: hexpm: Use maybe-inputs.
2024-09-04 20:32 ` [bug#70923] [PATCH v2 01/12] build-system: cargo: Accept unlabeled #:cargo-inputs Herman Rimm via Guix-patches via
` (9 preceding siblings ...)
2024-09-04 20:33 ` [bug#70923] [PATCH v2 11/12] import: egg: Use maybe-*inputs procedures Herman Rimm via Guix-patches via
@ 2024-09-04 20:33 ` Herman Rimm via Guix-patches via
10 siblings, 0 replies; 38+ messages in thread
From: Herman Rimm via Guix-patches via @ 2024-09-04 20:33 UTC (permalink / raw)
To: 70923
* 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@riseup.net>
;;; Copyright © 2019 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2020-2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
+;;; Copyright © 2024 Herman Rimm <herman@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
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#70923] [PATCH v3 00/11] Add (guix import utils) procedures.
2024-05-13 19:59 [bug#70923] [PATCH 00/13] Add (guix import utils) procedures Herman Rimm via Guix-patches via
` (13 preceding siblings ...)
2024-09-04 20:32 ` [bug#70923] [PATCH v2 01/12] build-system: cargo: Accept unlabeled #:cargo-inputs Herman Rimm via Guix-patches via
@ 2024-09-24 20:13 ` Herman Rimm via Guix-patches via
2024-09-24 20:13 ` [bug#70923] [PATCH v3 01/11] build-system: cargo: Accept unlabeled #:cargo-inputs Herman Rimm via Guix-patches via
` (10 more replies)
14 siblings, 11 replies; 38+ messages in thread
From: Herman Rimm via Guix-patches via @ 2024-09-24 20:13 UTC (permalink / raw)
To: 70923
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
^ permalink raw reply [flat|nested] 38+ messages in thread
* [bug#70923] [PATCH v3 01/11] build-system: cargo: Accept unlabeled #:cargo-inputs.
2024-09-24 20:13 ` [bug#70923] [PATCH v3 00/11] Add (guix import utils) procedures Herman Rimm via Guix-patches via
@ 2024-09-24 20:13 ` Herman Rimm via Guix-patches via
2024-09-24 20:13 ` [bug#70923] [PATCH v3 02/11] import: utils: Emit new-style package inputs Herman Rimm via Guix-patches via
` (9 subsequent siblings)
10 siblings, 0 replies; 38+ messages in thread
From: Herman Rimm via Guix-patches via @ 2024-09-24 20:13 UTC (permalink / raw)
To: 70923; +Cc: Efraim Flashner
* 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@gmail.com>
;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
;;; Copyright © 2021 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2024 Herman Rimm <herman@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
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#70923] [PATCH v3 02/11] import: utils: Emit new-style package inputs.
2024-09-24 20:13 ` [bug#70923] [PATCH v3 00/11] Add (guix import utils) procedures Herman Rimm via Guix-patches via
2024-09-24 20:13 ` [bug#70923] [PATCH v3 01/11] build-system: cargo: Accept unlabeled #:cargo-inputs Herman Rimm via Guix-patches via
@ 2024-09-24 20:13 ` Herman Rimm via Guix-patches via
2024-09-24 20:13 ` [bug#70923] [PATCH v3 03/11] import: crate: " Herman Rimm via Guix-patches via
` (8 subsequent siblings)
10 siblings, 0 replies; 38+ messages in thread
From: Herman Rimm via Guix-patches via @ 2024-09-24 20:13 UTC (permalink / raw)
To: 70923; +Cc: Sarah Morgensen
From: Sarah Morgensen <iskarian@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@ens-lyon.fr>
;;; Copyright © 2022 Kyle Meyer <kyle@kyleam.com>
;;; Copyright © 2022 Philip McGrath <philip@philipmcgrath.com>
+;;; Copyright © 2024 Herman Rimm <herman@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
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#70923] [PATCH v3 03/11] import: crate: Emit new-style package inputs.
2024-09-24 20:13 ` [bug#70923] [PATCH v3 00/11] Add (guix import utils) procedures Herman Rimm via Guix-patches via
2024-09-24 20:13 ` [bug#70923] [PATCH v3 01/11] build-system: cargo: Accept unlabeled #:cargo-inputs Herman Rimm via Guix-patches via
2024-09-24 20:13 ` [bug#70923] [PATCH v3 02/11] import: utils: Emit new-style package inputs Herman Rimm via Guix-patches via
@ 2024-09-24 20:13 ` Herman Rimm via Guix-patches via
2024-09-24 20:13 ` [bug#70923] [PATCH v3 04/11] import: utils: Add 'maybe-upstream-inputs' procedure Herman Rimm via Guix-patches via
` (7 subsequent siblings)
10 siblings, 0 replies; 38+ messages in thread
From: Herman Rimm via Guix-patches via @ 2024-09-24 20:13 UTC (permalink / raw)
To: 70923; +Cc: Sarah Morgensen, Efraim Flashner
From: Sarah Morgensen <iskarian@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@gmail.com>
;;; Copyright © 2023, 2024 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2023, 2024 David Elsing <david.elsing@posteo.net>
+;;; Copyright © 2024 Herman Rimm <herman@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@riseup.net>
;;; Copyright © 2023 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2023 David Elsing <david.elsing@posteo.net>
+;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
+;;; Copyright © 2024 Herman Rimm <herman@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
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#70923] [PATCH v3 04/11] import: utils: Add 'maybe-upstream-inputs' procedure.
2024-09-24 20:13 ` [bug#70923] [PATCH v3 00/11] Add (guix import utils) procedures Herman Rimm via Guix-patches via
` (2 preceding siblings ...)
2024-09-24 20:13 ` [bug#70923] [PATCH v3 03/11] import: crate: " Herman Rimm via Guix-patches via
@ 2024-09-24 20:13 ` Herman Rimm via Guix-patches via
2024-09-24 20:13 ` [bug#70923] [PATCH v3 05/11] import: pypi: Use 'maybe-list-field' procedure Herman Rimm via Guix-patches via
` (6 subsequent siblings)
10 siblings, 0 replies; 38+ messages in thread
From: Herman Rimm via Guix-patches via @ 2024-09-24 20:13 UTC (permalink / raw)
To: 70923
* 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
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#70923] [PATCH v3 05/11] import: pypi: Use 'maybe-list-field' procedure.
2024-09-24 20:13 ` [bug#70923] [PATCH v3 00/11] Add (guix import utils) procedures Herman Rimm via Guix-patches via
` (3 preceding siblings ...)
2024-09-24 20:13 ` [bug#70923] [PATCH v3 04/11] import: utils: Add 'maybe-upstream-inputs' procedure Herman Rimm via Guix-patches via
@ 2024-09-24 20:13 ` Herman Rimm via Guix-patches via
2024-09-24 20:13 ` [bug#70923] [PATCH v3 06/11] import: elpa: Use maybe-propagated-inputs procedure Herman Rimm via Guix-patches via
` (5 subsequent siblings)
10 siblings, 0 replies; 38+ messages in thread
From: Herman Rimm via Guix-patches via @ 2024-09-24 20:13 UTC (permalink / raw)
To: 70923
Cc: Lars-Dominik Braun, Marius Bakke, Munyoki Kilyungi,
Sharlatan Hellseher, Tanguy Le Carrour, jgart
* 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@planete-kraus.eu>
;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
+;;; Copyright © 2024 Herman Rimm <herman@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
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#70923] [PATCH v3 06/11] import: elpa: Use maybe-propagated-inputs procedure.
2024-09-24 20:13 ` [bug#70923] [PATCH v3 00/11] Add (guix import utils) procedures Herman Rimm via Guix-patches via
` (4 preceding siblings ...)
2024-09-24 20:13 ` [bug#70923] [PATCH v3 05/11] import: pypi: Use 'maybe-list-field' procedure Herman Rimm via Guix-patches via
@ 2024-09-24 20:13 ` Herman Rimm via Guix-patches via
2024-09-24 20:13 ` [bug#70923] [PATCH v3 07/11] import: hackage: Use 'maybe-list-field' procedure Herman Rimm via Guix-patches via
` (4 subsequent siblings)
10 siblings, 0 replies; 38+ messages in thread
From: Herman Rimm via Guix-patches via @ 2024-09-24 20:13 UTC (permalink / raw)
To: 70923; +Cc: Andrew Tropin, Katherine Cox-Buday, Liliana Marie Prikler
* 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
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#70923] [PATCH v3 07/11] import: hackage: Use 'maybe-list-field' procedure.
2024-09-24 20:13 ` [bug#70923] [PATCH v3 00/11] Add (guix import utils) procedures Herman Rimm via Guix-patches via
` (5 preceding siblings ...)
2024-09-24 20:13 ` [bug#70923] [PATCH v3 06/11] import: elpa: Use maybe-propagated-inputs procedure Herman Rimm via Guix-patches via
@ 2024-09-24 20:13 ` Herman Rimm via Guix-patches via
2024-09-24 20:13 ` [bug#70923] [PATCH v3 08/11] import: cran: " Herman Rimm via Guix-patches via
` (3 subsequent siblings)
10 siblings, 0 replies; 38+ messages in thread
From: Herman Rimm via Guix-patches via @ 2024-09-24 20:13 UTC (permalink / raw)
To: 70923; +Cc: Lars-Dominik Braun
* 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@gmail.com>
;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;; Copyright © 2023-2024 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2024 Herman Rimm <herman@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
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#70923] [PATCH v3 08/11] import: cran: Use 'maybe-list-field' procedure.
2024-09-24 20:13 ` [bug#70923] [PATCH v3 00/11] Add (guix import utils) procedures Herman Rimm via Guix-patches via
` (6 preceding siblings ...)
2024-09-24 20:13 ` [bug#70923] [PATCH v3 07/11] import: hackage: Use 'maybe-list-field' procedure Herman Rimm via Guix-patches via
@ 2024-09-24 20:13 ` Herman Rimm via Guix-patches via
2024-09-24 20:13 ` [bug#70923] [PATCH v3 09/11] import: cpan: Use 'maybe-upstream-inputs' procedure Herman Rimm via Guix-patches via
` (2 subsequent siblings)
10 siblings, 0 replies; 38+ messages in thread
From: Herman Rimm via Guix-patches via @ 2024-09-24 20:13 UTC (permalink / raw)
To: 70923; +Cc: Laurent Gatto, Ricardo Wurmus, Simon Tournier
* 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@mgsn.dev>
;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
+;;; Copyright © 2024 Herman Rimm <herman@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
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#70923] [PATCH v3 09/11] import: cpan: Use 'maybe-upstream-inputs' procedure.
2024-09-24 20:13 ` [bug#70923] [PATCH v3 00/11] Add (guix import utils) procedures Herman Rimm via Guix-patches via
` (7 preceding siblings ...)
2024-09-24 20:13 ` [bug#70923] [PATCH v3 08/11] import: cran: " Herman Rimm via Guix-patches via
@ 2024-09-24 20:13 ` Herman Rimm via Guix-patches via
2024-09-24 20:13 ` [bug#70923] [PATCH v3 10/11] import: egg: Use maybe-*inputs procedures Herman Rimm via Guix-patches via
2024-09-24 20:13 ` [bug#70923] [PATCH v3 11/11] import: hexpm: Use (guix import utils) 'maybe-inputs' procedure Herman Rimm via Guix-patches via
10 siblings, 0 replies; 38+ messages in thread
From: Herman Rimm via Guix-patches via @ 2024-09-24 20:13 UTC (permalink / raw)
To: 70923
* 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@tobias.gr>
;;; Copyright © 2020, 2021, 2023 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
+;;; Copyright © 2024 Herman Rimm <herman@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
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#70923] [PATCH v3 10/11] import: egg: Use maybe-*inputs procedures.
2024-09-24 20:13 ` [bug#70923] [PATCH v3 00/11] Add (guix import utils) procedures Herman Rimm via Guix-patches via
` (8 preceding siblings ...)
2024-09-24 20:13 ` [bug#70923] [PATCH v3 09/11] import: cpan: Use 'maybe-upstream-inputs' procedure Herman Rimm via Guix-patches via
@ 2024-09-24 20:13 ` Herman Rimm via Guix-patches via
2024-09-24 20:13 ` [bug#70923] [PATCH v3 11/11] import: hexpm: Use (guix import utils) 'maybe-inputs' procedure Herman Rimm via Guix-patches via
10 siblings, 0 replies; 38+ messages in thread
From: Herman Rimm via Guix-patches via @ 2024-09-24 20:13 UTC (permalink / raw)
To: 70923
* 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@tobias.gr>
;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
+;;; Copyright © 2024 Herman Rimm <herman@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
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#70923] [PATCH v3 11/11] import: hexpm: Use (guix import utils) 'maybe-inputs' procedure.
2024-09-24 20:13 ` [bug#70923] [PATCH v3 00/11] Add (guix import utils) procedures Herman Rimm via Guix-patches via
` (9 preceding siblings ...)
2024-09-24 20:13 ` [bug#70923] [PATCH v3 10/11] import: egg: Use maybe-*inputs procedures Herman Rimm via Guix-patches via
@ 2024-09-24 20:13 ` Herman Rimm via Guix-patches via
10 siblings, 0 replies; 38+ messages in thread
From: Herman Rimm via Guix-patches via @ 2024-09-24 20:13 UTC (permalink / raw)
To: 70923
* 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@riseup.net>
;;; Copyright © 2019 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2020-2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
+;;; Copyright © 2024 Herman Rimm <herman@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
^ permalink raw reply related [flat|nested] 38+ messages in thread
end of thread, other threads:[~2024-09-24 20:22 UTC | newest]
Thread overview: 38+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-13 19:59 [bug#70923] [PATCH 00/13] Add (guix import utils) procedures Herman Rimm via Guix-patches via
2024-05-13 20:07 ` [bug#70923] [PATCH 01/13] build-system: cargo: Accept unlabeled #:cargo-inputs Herman Rimm via Guix-patches via
2024-05-13 20:07 ` [bug#70923] [PATCH 02/13] import: utils: Emit new-style package inputs Herman Rimm via Guix-patches via
2024-05-13 20:08 ` [bug#70923] [PATCH 03/13] tests: go: Adjust to " Herman Rimm via Guix-patches via
2024-05-13 20:08 ` [bug#70923] [PATCH 04/13] tests: elm: " Herman Rimm via Guix-patches via
2024-05-13 20:08 ` [bug#70923] [PATCH 05/13] import: crate: Emit " Herman Rimm via Guix-patches via
2024-05-13 20:08 ` [bug#70923] [PATCH 06/13] import: utils: Add 'maybe-upstream-inputs' procedure Herman Rimm via Guix-patches via
2024-05-13 20:08 ` [bug#70923] [PATCH 07/13] import: pypi: Use 'maybe-list-field' procedure Herman Rimm via Guix-patches via
2024-05-13 20:08 ` [bug#70923] [PATCH 08/13] import: elpa: Use maybe-propagated-inputs procedure Herman Rimm via Guix-patches via
2024-05-13 20:08 ` [bug#70923] [PATCH 09/13] import: hackage: Use 'maybe-list-field' procedure Herman Rimm via Guix-patches via
2024-05-13 20:08 ` [bug#70923] [PATCH 10/13] import: cran: " Herman Rimm via Guix-patches via
2024-05-13 20:08 ` [bug#70923] [PATCH 11/13] import: cpan: Use 'maybe-upstream-inputs' procedure Herman Rimm via Guix-patches via
2024-05-13 20:08 ` [bug#70923] [PATCH 12/13] import: egg: Use maybe-*inputs procedures Herman Rimm via Guix-patches via
2024-05-13 20:08 ` [bug#70923] [PATCH 13/13] import: hexpm: Use (guix import utils) 'maybe-inputs' procedure Herman Rimm via Guix-patches via
2024-09-04 20:32 ` [bug#70923] [PATCH v2 01/12] build-system: cargo: Accept unlabeled #:cargo-inputs Herman Rimm via Guix-patches via
2024-09-04 20:32 ` [bug#70923] [PATCH v2 02/12] import: utils: Emit new-style inputs from maybe-*inputs procedures Herman Rimm via Guix-patches via
2024-09-04 20:32 ` [bug#70923] [PATCH v2 03/12] tests: elm: Adjust to new-style package inputs Herman Rimm via Guix-patches via
2024-09-04 20:32 ` [bug#70923] [PATCH v2 04/12] import: crate: Use (guix import utils) procedures Herman Rimm via Guix-patches via
2024-09-04 20:32 ` [bug#70923] [PATCH v2 05/12] import: utils: Add maybe-upstream-inputs Herman Rimm via Guix-patches via
2024-09-04 20:33 ` [bug#70923] [PATCH v2 06/12] import: pypi: Use maybe-upstream-inputs Herman Rimm via Guix-patches via
2024-09-04 20:33 ` [bug#70923] [PATCH v2 07/12] import: elpa: Use maybe-propagated-inputse Herman Rimm via Guix-patches via
2024-09-04 20:33 ` [bug#70923] [PATCH v2 08/12] import: hackage: Use maybe-list-field Herman Rimm via Guix-patches via
2024-09-04 20:33 ` [bug#70923] [PATCH v2 09/12] import: cran: Refactor format-inputs and use maybe-list-field Herman Rimm via Guix-patches via
2024-09-04 20:33 ` [bug#70923] [PATCH v2 10/12] import: cpan: Use maybe-upstream-inputs Herman Rimm via Guix-patches via
2024-09-04 20:33 ` [bug#70923] [PATCH v2 11/12] import: egg: Use maybe-*inputs procedures Herman Rimm via Guix-patches via
2024-09-04 20:33 ` [bug#70923] [PATCH v2 12/12] import: hexpm: Use maybe-inputs Herman Rimm via Guix-patches via
2024-09-24 20:13 ` [bug#70923] [PATCH v3 00/11] Add (guix import utils) procedures Herman Rimm via Guix-patches via
2024-09-24 20:13 ` [bug#70923] [PATCH v3 01/11] build-system: cargo: Accept unlabeled #:cargo-inputs Herman Rimm via Guix-patches via
2024-09-24 20:13 ` [bug#70923] [PATCH v3 02/11] import: utils: Emit new-style package inputs Herman Rimm via Guix-patches via
2024-09-24 20:13 ` [bug#70923] [PATCH v3 03/11] import: crate: " Herman Rimm via Guix-patches via
2024-09-24 20:13 ` [bug#70923] [PATCH v3 04/11] import: utils: Add 'maybe-upstream-inputs' procedure Herman Rimm via Guix-patches via
2024-09-24 20:13 ` [bug#70923] [PATCH v3 05/11] import: pypi: Use 'maybe-list-field' procedure Herman Rimm via Guix-patches via
2024-09-24 20:13 ` [bug#70923] [PATCH v3 06/11] import: elpa: Use maybe-propagated-inputs procedure Herman Rimm via Guix-patches via
2024-09-24 20:13 ` [bug#70923] [PATCH v3 07/11] import: hackage: Use 'maybe-list-field' procedure Herman Rimm via Guix-patches via
2024-09-24 20:13 ` [bug#70923] [PATCH v3 08/11] import: cran: " Herman Rimm via Guix-patches via
2024-09-24 20:13 ` [bug#70923] [PATCH v3 09/11] import: cpan: Use 'maybe-upstream-inputs' procedure Herman Rimm via Guix-patches via
2024-09-24 20:13 ` [bug#70923] [PATCH v3 10/11] import: egg: Use maybe-*inputs procedures Herman Rimm via Guix-patches via
2024-09-24 20:13 ` [bug#70923] [PATCH v3 11/11] import: hexpm: Use (guix import utils) 'maybe-inputs' procedure Herman Rimm via Guix-patches via
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).