import/cran: Add input style "specification".
* guix/import/cran.scm (%input-style): New parameter. (format-inputs): Use it. * guix/scripts/import/cran.scm (guix-import-cran): Set the %input-style parameter. (%options): Add "--style" option. * doc/guix.texi (Invoking guix import): Document it.
This commit is contained in:
parent
08c4dd518a
commit
5f5e3873d7
3 changed files with 43 additions and 22 deletions
|
@ -11009,6 +11009,13 @@ When @option{--recursive} is added, the importer will traverse the
|
||||||
dependency graph of the given upstream package recursively and generate
|
dependency graph of the given upstream package recursively and generate
|
||||||
package expressions for all those packages that are not yet in Guix.
|
package expressions for all those packages that are not yet in Guix.
|
||||||
|
|
||||||
|
When @option{--style=specification} is added, the importer will generate
|
||||||
|
package definitions whose inputs are package specifications instead of
|
||||||
|
references to package variables. This is useful when generated package
|
||||||
|
definitions are to be appended to existing user modules, as the list of
|
||||||
|
used package modules need not be changed. The default is
|
||||||
|
@option{--style=variable}.
|
||||||
|
|
||||||
When @option{--archive=bioconductor} is added, metadata is imported from
|
When @option{--archive=bioconductor} is added, metadata is imported from
|
||||||
@uref{https://www.bioconductor.org/, Bioconductor}, a repository of R
|
@uref{https://www.bioconductor.org/, Bioconductor}, a repository of R
|
||||||
packages for the analysis and comprehension of high-throughput
|
packages for the analysis and comprehension of high-throughput
|
||||||
|
|
|
@ -51,7 +51,9 @@
|
||||||
#:use-module (guix upstream)
|
#:use-module (guix upstream)
|
||||||
#:use-module (guix packages)
|
#:use-module (guix packages)
|
||||||
#:use-module (gnu packages)
|
#:use-module (gnu packages)
|
||||||
#:export (cran->guix-package
|
#:export (%input-style
|
||||||
|
|
||||||
|
cran->guix-package
|
||||||
bioconductor->guix-package
|
bioconductor->guix-package
|
||||||
cran-recursive-import
|
cran-recursive-import
|
||||||
%cran-updater
|
%cran-updater
|
||||||
|
@ -74,6 +76,9 @@
|
||||||
;;;
|
;;;
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
|
(define %input-style
|
||||||
|
(make-parameter 'variable)) ; or 'specification
|
||||||
|
|
||||||
(define string->license
|
(define string->license
|
||||||
(match-lambda
|
(match-lambda
|
||||||
("AGPL-3" 'agpl3+)
|
("AGPL-3" 'agpl3+)
|
||||||
|
@ -128,7 +133,11 @@
|
||||||
(define (format-inputs names)
|
(define (format-inputs names)
|
||||||
"Generate a sorted list of package inputs from a list of package NAMES."
|
"Generate a sorted list of package inputs from a list of package NAMES."
|
||||||
(map (lambda (name)
|
(map (lambda (name)
|
||||||
(list name (list 'unquote (string->symbol name))))
|
(case (%input-style)
|
||||||
|
((specification)
|
||||||
|
(list name (list 'unquote (list 'specification->package name))))
|
||||||
|
(else
|
||||||
|
(list name (list 'unquote (string->symbol name))))))
|
||||||
(sort names string-ci<?)))
|
(sort names string-ci<?)))
|
||||||
|
|
||||||
(define* (maybe-inputs package-inputs #:optional (type 'inputs))
|
(define* (maybe-inputs package-inputs #:optional (type 'inputs))
|
||||||
|
|
|
@ -67,6 +67,10 @@ Import and convert the CRAN package for PACKAGE-NAME.\n"))
|
||||||
(lambda (opt name arg result)
|
(lambda (opt name arg result)
|
||||||
(alist-cons 'repo (string->symbol arg)
|
(alist-cons 'repo (string->symbol arg)
|
||||||
(alist-delete 'repo result))))
|
(alist-delete 'repo result))))
|
||||||
|
(option '(#\s "style") #t #f
|
||||||
|
(lambda (opt name arg result)
|
||||||
|
(alist-cons 'style (string->symbol arg)
|
||||||
|
(alist-delete 'style result))))
|
||||||
(option '(#\r "recursive") #f #f
|
(option '(#\r "recursive") #f #f
|
||||||
(lambda (opt name arg result)
|
(lambda (opt name arg result)
|
||||||
(alist-cons 'recursive #t result)))
|
(alist-cons 'recursive #t result)))
|
||||||
|
@ -93,6 +97,7 @@ Import and convert the CRAN package for PACKAGE-NAME.\n"))
|
||||||
value)
|
value)
|
||||||
(_ #f))
|
(_ #f))
|
||||||
(reverse opts))))
|
(reverse opts))))
|
||||||
|
(parameterize ((%input-style (assoc-ref opts 'style)))
|
||||||
(match args
|
(match args
|
||||||
((package-name)
|
((package-name)
|
||||||
(if (assoc-ref opts 'recursive)
|
(if (assoc-ref opts 'recursive)
|
||||||
|
@ -112,4 +117,4 @@ Import and convert the CRAN package for PACKAGE-NAME.\n"))
|
||||||
(()
|
(()
|
||||||
(leave (G_ "too few arguments~%")))
|
(leave (G_ "too few arguments~%")))
|
||||||
((many ...)
|
((many ...)
|
||||||
(leave (G_ "too many arguments~%"))))))
|
(leave (G_ "too many arguments~%")))))))
|
||||||
|
|
Reference in a new issue