import: crate: Comment out missing dependencies.

* guix/import/crate.scm (package-names->package-inputs): Emit comments.
(make-crate-sexp): Make input into comment if missing.
(crate->guix-package): Take #:mark-missing? argument.
[dependency-name+missing+version+yanked]: Mark as missing.  Rename from
dependency-name+version+yanked.
[sort-map-dependencies]: Adjust.
[remove-missing+yanked-info]: Remove missing info.  Rename from
remove-yanked-info.
* guix/scripts/import/crate.scm (show-help): Explain --mark-missing.
(%options): Add mark-missing option.
(guix-import-crate): Pass mark-missing option as #:mark-missing?.
* doc/guix.texi (Invoking guix import): Document --mark-missing.
* tests/crate.scm ("crate->guix-package-marks-missing-packages"): Add
test.

Change-Id: I065d394e1c04fdc332b8f7f8b9fcbd87c14c6512
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Herman Rimm 2025-01-26 21:41:16 +01:00 committed by Ludovic Courtès
parent 48c5942a1e
commit 6b55b971c8
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
4 changed files with 123 additions and 41 deletions

View file

@ -5,6 +5,7 @@
;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;; Copyright © 2023 Simon Tournier <zimon.toutoune@gmail.com>
;;; Copyright © 2023 David Elsing <david.elsing@posteo.net>
;;; Copyright © 2025 Herman Rimm <herman@rimm.ee>
;;;
;;; This file is part of GNU Guix.
;;;
@ -54,6 +55,9 @@ Import and convert the crates.io package for PACKAGE-NAME.\n"))
(display (G_ "
--allow-yanked allow importing yanked crates if no alternative
satisfying the version requirement is found"))
(display (G_ "
--mark-missing comment out the desired dependency if no
sufficient package exists for it"))
(newline)
(display (G_ "
-h, --help display this help and exit"))
@ -80,6 +84,9 @@ Import and convert the crates.io package for PACKAGE-NAME.\n"))
(option '("allow-yanked") #f #f
(lambda (opt name arg result)
(alist-cons 'allow-yanked #t result)))
(option '("mark-missing") #f #f
(lambda (opt name arg result)
(alist-cons 'mark-missing #t result)))
%standard-import-options))
@ -112,7 +119,8 @@ Import and convert the crates.io package for PACKAGE-NAME.\n"))
#:allow-yanked? (assoc-ref opts 'allow-yanked))
(crate->guix-package
name #:version version #:include-dev-deps? #t
#:allow-yanked? (assoc-ref opts 'allow-yanked)))
#:allow-yanked? (assoc-ref opts 'allow-yanked)
#:mark-missing? (assoc-ref opts 'mark-missing)))
((or #f '())
(leave (G_ "failed to download meta-data for package '~a'~%")
(if version