import/cran: Restore format-inputs.

This fixes a regression introduced in commit
e6223017d9 causing the selected input style to
be ignored.

* guix/import/cran.scm (format-inputs): New procedure.
(maybe-inputs): Use it.

Change-Id: I0d36f972fcb9888ed2be4ec9360bbcab13c25c5d
This commit is contained in:
Ricardo Wurmus 2023-12-28 10:15:45 +01:00
parent a2a8c4c13a
commit 513994aead
No known key found for this signature in database
GPG Key ID: 197A5888235FACAC

View File

@ -85,6 +85,21 @@
(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-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
@ -177,9 +192,7 @@ package definition."
(()
'())
((package-inputs ...)
`((,input-type (list ,@(map (compose string->symbol
upstream-input-downstream-name)
package-inputs)))))))
`((,input-type (list ,@(format-inputs package-inputs)))))))
(define %cran-url "https://cran.r-project.org/web/packages/")
(define %cran-canonical-url "https://cran.r-project.org/package=")