[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#38408] [PATCH v9 4/8] guix: import: utils: allow generation of inpu
From: |
Martin Becze |
Subject: |
[bug#38408] [PATCH v9 4/8] guix: import: utils: allow generation of inputs to be version aware |
Date: |
Tue, 4 Feb 2020 07:18:21 -0500 |
* guix/import/utils.scm (package-names->package-inputs): Added the ability to
handle (name version) pairs
* guix/import/crate.scm (make-crate-sexp): cleaned up input field generation
---
guix/import/crate.scm | 17 +++++++++--------
guix/import/utils.scm | 21 ++++++++++++++-------
2 files changed, 23 insertions(+), 15 deletions(-)
diff --git a/guix/import/crate.scm b/guix/import/crate.scm
index 84b152620c..9128314370 100644
--- a/guix/import/crate.scm
+++ b/guix/import/crate.scm
@@ -151,16 +151,17 @@ record or #f if it was not found."
"Return the `package' s-expression for a rust package with the given NAME,
VERSION, CARGO-INPUTS, CARGO-DEVELOPMENT-INPUTS, HOME-PAGE, SYNOPSIS,
DESCRIPTION,
and LICENSE."
+ (define (format-inputs inputs)
+ (map
+ (match-lambda
+ ((name version) (list (crate-name->package-name name)
+ (version-major+minor version))))
+ inputs))
+
(let* ((port (http-fetch (crate-uri name version)))
(guix-name (crate-name->package-name name))
- (cargo-inputs
- (map
- (lambda (name-version)
- (apply crate-name->package-name name-version)) cargo-inputs))
- (cargo-development-inputs
- (map
- (lambda (name-version)
- (apply crate-name->package-name name-version))
cargo-development-inputs))
+ (cargo-inputs (format-inputs cargo-inputs))
+ (cargo-development-inputs (format-inputs cargo-development-inputs))
(pkg `(package
(name ,guix-name)
(version ,version)
diff --git a/guix/import/utils.scm b/guix/import/utils.scm
index 59430d3e66..518877d476 100644
--- a/guix/import/utils.scm
+++ b/guix/import/utils.scm
@@ -233,13 +233,20 @@ into a proper sentence and by using two spaces between
sentences."
cleaned 'pre ". " 'post)))
(define* (package-names->package-inputs names #:optional (output #f))
- "Given a list of PACKAGE-NAMES, and an optional OUTPUT, tries to generate a
-quoted list of inputs, as suitable to use in an 'inputs' field of a package
-definition."
- (map (lambda (input)
- (cons* input (list 'unquote (string->symbol input))
- (or (and output (list output))
- '())))
+ "Given a list of PACKAGE-NAMES or (PACKAGE-NAME VERSION) pairs, and an
+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))
+ '())))
+
+ (map (match-lambda
+ ((input version) (make-input input version))
+ (input (make-input input #f)))
names))
(define* (maybe-inputs package-names #:optional (output #f))
--
2.25.0
- [bug#38408] [PATCH v9 0/8] recursive semver crate importer!, Martin Becze, 2020/02/04
- [bug#38408] [PATCH v9 5/8] guix: import: crate: deduplicate dependencies, Martin Becze, 2020/02/04
- [bug#38408] [PATCH v9 4/8] guix: import: utils: allow generation of inputs to be version aware,
Martin Becze <=
- [bug#38408] [PATCH v9 1/8] guix: import: (recursive-import) Allow for version numbers, Martin Becze, 2020/02/04
- [bug#38408] [PATCH v9 3/8] Added Guile-Semver as a dependency to guix, Martin Becze, 2020/02/04
- [bug#38408] [PATCH v9 3/8] Added Guile-Semver as a dependency to guix, Efraim Flashner, 2020/02/17
- [bug#38408] [PATCH v9 3/8] Added Guile-Semver as a dependency to guix, Ludovic Courtès, 2020/02/17
- [bug#38408] [PATCH v9 3/8] Added Guile-Semver as a dependency to guix, Martin Becze, 2020/02/18
- [bug#38408] [PATCH v9 3/8] Added Guile-Semver as a dependency to guix, Ludovic Courtès, 2020/02/20
- [bug#38408] [PATCH v9 3/8] Added Guile-Semver as a dependency to guix, Martin Becze, 2020/02/20
- [bug#38408] [PATCH v9 3/8] Added Guile-Semver as a dependency to guix, Ludovic Courtès, 2020/02/21
- [bug#38408] [PATCH v9 3/8] Added Guile-Semver as a dependency to guix, Martin Becze, 2020/02/21