diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2022-10-18 12:45:15 +0200 |
---|---|---|
committer | Ricardo Wurmus <rekado@elephly.net> | 2022-12-31 14:48:46 +0100 |
commit | d57dd25d3850d220bd82b44fa6f69812022199e4 (patch) | |
tree | f7f66e377afe1ed282378b7a13a87b428f1aa71c /guix/scripts | |
parent | 3c24da4260f28b4ed57efda0296688a50ac94628 (diff) | |
download | guix-patches-d57dd25d3850d220bd82b44fa6f69812022199e4.tar guix-patches-d57dd25d3850d220bd82b44fa6f69812022199e4.tar.gz |
import/cran: Allow custom license prefix.
* guix/import/cran.scm (string-licenses): Add license-prefix argument.
(string->license): Ditto.
(description->package): Ditto.
(cran->guix-package): Ditto.
(cran-recursive-import): Ditto.
* guix/scripts/import/cran.scm (%options): Add new option -p/--license-prefix.
(show-help): Document it.
(parse-options): Pass it to importer.
* doc/guix.texi (Invoking guix import): Document it.
Diffstat (limited to 'guix/scripts')
-rw-r--r-- | guix/scripts/import/cran.scm | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/guix/scripts/import/cran.scm b/guix/scripts/import/cran.scm index 2934d4300a..5298f059f2 100644 --- a/guix/scripts/import/cran.scm +++ b/guix/scripts/import/cran.scm @@ -53,6 +53,9 @@ Import and convert the CRAN package for PACKAGE-NAME.\n")) (display (G_ " -s, --style=STYLE choose output style, either specification or variable")) (display (G_ " + -p, --license-prefix=PREFIX + add custom prefix to licenses")) + (display (G_ " -V, --version display version information and exit")) (newline) (show-bug-report-information)) @@ -74,6 +77,10 @@ Import and convert the CRAN package for PACKAGE-NAME.\n")) (lambda (opt name arg result) (alist-cons 'style (string->symbol arg) (alist-delete 'style result)))) + (option '(#\p "license-prefix") #t #f + (lambda (opt name arg result) + (alist-cons 'license-prefix arg + (alist-delete 'license-prefix result)))) (option '(#\r "recursive") #f #f (lambda (opt name arg result) (alist-cons 'recursive #t result))) @@ -95,7 +102,13 @@ Import and convert the CRAN package for PACKAGE-NAME.\n")) (('argument . value) value) (_ #f)) - (reverse opts)))) + (reverse opts))) + (prefix (assoc-ref opts 'license-prefix)) + (prefix-proc (if (string? prefix) + (lambda (symbol) + (string->symbol + (string-append prefix (symbol->string symbol)))) + identity))) (parameterize ((%input-style (assoc-ref opts 'style))) (match args ((spec) @@ -107,11 +120,13 @@ Import and convert the CRAN package for PACKAGE-NAME.\n")) (filter identity (cran-recursive-import name #:version version - #:repo (or (assoc-ref opts 'repo) 'cran))))) + #:repo (or (assoc-ref opts 'repo) 'cran) + #:license-prefix prefix-proc)))) ;; Single import (let ((sexp (cran->guix-package name #:version version - #:repo (or (assoc-ref opts 'repo) 'cran)))) + #:repo (or (assoc-ref opts 'repo) 'cran) + #:license-prefix prefix-proc))) (unless sexp (leave (G_ "failed to download description for package '~a'~%") name)) |