diff --git a/guix/import/crate.scm b/guix/import/crate.scm index 3b36e9e3e3..263c2a8b16 100644 --- a/guix/import/crate.scm +++ b/guix/import/crate.scm @@ -142,6 +142,23 @@ record or #f if it was not found." ;;; Converting crates to Guix packages. ;;; +(define* (package-names->package-inputs names #:optional (output #f)) + "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-cargo-inputs package-names) (match (package-names->package-inputs package-names) (() diff --git a/guix/import/utils.scm b/guix/import/utils.scm index 45fed93134..b7756fcc40 100644 --- a/guix/import/utils.scm +++ b/guix/import/utils.scm @@ -418,12 +418,10 @@ LENGTH characters." 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 ((name (if version (string-append input "-" version) input))) + (if output + (list (string->symbol name) output) + (string->symbol name)))) (map (match-lambda ((input version) (make-input input version)) @@ -444,7 +442,7 @@ snippet generated is for regular inputs." (() '()) ((package-inputs ...) - `((,field-name (,'quasiquote ,package-inputs))))))) + `((,field-name (list ,@package-inputs))))))) (define* (maybe-native-inputs package-names #:optional (output #f)) "Same as MAYBE-INPUTS, but for native inputs." 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 @@ require github.com/kr/pretty v0.2.1 (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 \