diff options
author | David Elsing <david.elsing@posteo.net> | 2023-12-21 22:01:50 +0000 |
---|---|---|
committer | Efraim Flashner <efraim@flashner.co.il> | 2024-01-09 09:38:38 +0200 |
commit | 9f44ff2bb47c964d53905cea17c4bda758cce509 (patch) | |
tree | f902e562dc7fedb465d4cc3fec710664921450dd /guix | |
parent | 4b0aa65c0a9301a70c798ea76a493f67ef8371f4 (diff) |
import: crate: Optionally import dev-dependencies recursively.
If --recursive-dev-dependencies is specified, development dependencies
are also included for all recursively imported packages.
* doc/guix.texi (Invoking guix import): Mention --recursive-dev-dependencies.
* guix/import/crate.scm (crate-recursive-import): Add
recursive-dev-dependencies? argument.
* guix/scripts/import/crate.scm (show-help, guix-import-crate): Add
"--recursive-dev-dependencies".
* tests/crate.scm: Test both #f and #t for #:recursive-dev-dependencies?
in the 'cargo-recursive-import' test.
(test-root-dependencies): Add intermediate-c as dev-dependency.
(test-intermediate-c-crate, test-intermediate-c-dependencies): New
variables.
Signed-off-by: Efraim Flashner <efraim@flashner.co.il>
Change-Id: Iae89794681155d77f128733120e60f03bc297717
Diffstat (limited to 'guix')
-rw-r--r-- | guix/import/crate.scm | 7 | ||||
-rw-r--r-- | guix/scripts/import/crate.scm | 12 |
2 files changed, 16 insertions, 3 deletions
diff --git a/guix/import/crate.scm b/guix/import/crate.scm index 07874bdb26..db5461312f 100644 --- a/guix/import/crate.scm +++ b/guix/import/crate.scm @@ -328,14 +328,17 @@ look up the development dependencs for the given crate." (append cargo-inputs cargo-development-inputs))) (values #f '()))) -(define* (crate-recursive-import crate-name #:key version) +(define* (crate-recursive-import + crate-name #:key version recursive-dev-dependencies?) (recursive-import crate-name #:repo->guix-package (let ((crate->guix-package* (memoize crate->guix-package))) (lambda* params ;; download development dependencies only for the top level package - (let ((include-dev-deps? (equal? (car params) crate-name))) + (let ((include-dev-deps? + (or (equal? (car params) crate-name) + recursive-dev-dependencies?))) (apply crate->guix-package* (append params `(#:include-dev-deps? ,include-dev-deps?)))))) #:version version diff --git a/guix/scripts/import/crate.scm b/guix/scripts/import/crate.scm index 038faa87db..b13b6636a6 100644 --- a/guix/scripts/import/crate.scm +++ b/guix/scripts/import/crate.scm @@ -5,6 +5,7 @@ ;;; Copyright © 2019, 2020 Martin Becze <mjbecze@riseup.net> ;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev> ;;; Copyright © 2023 Simon Tournier <zimon.toutoune@gmail.com> +;;; Copyright © 2023 David Elsing <david.elsing@posteo.net> ;;; ;;; This file is part of GNU Guix. ;;; @@ -47,6 +48,9 @@ Import and convert the crates.io package for PACKAGE-NAME.\n")) (display (G_ " -r, --recursive import packages recursively")) + (display (G_ " + --recursive-dev-dependencies + include dev-dependencies recursively")) (newline) (display (G_ " -h, --help display this help and exit")) @@ -67,6 +71,9 @@ Import and convert the crates.io package for PACKAGE-NAME.\n")) (option '(#\r "recursive") #f #f (lambda (opt name arg result) (alist-cons 'recursive #t result))) + (option '("recursive-dev-dependencies") #f #f + (lambda (opt name arg result) + (alist-cons 'recursive-dev-dependencies #t result))) %standard-import-options)) @@ -92,7 +99,10 @@ Import and convert the crates.io package for PACKAGE-NAME.\n")) (package-name->name+version spec)) (match (if (assoc-ref opts 'recursive) - (crate-recursive-import name #:version version) + (crate-recursive-import + name #:version version + #:recursive-dev-dependencies? + (assoc-ref opts 'recursive-dev-dependencies)) (crate->guix-package name #:version version #:include-dev-deps? #t)) ((or #f '()) (leave (G_ "failed to download meta-data for package '~a'~%") |