mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
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:
parent
48c5942a1e
commit
6b55b971c8
4 changed files with 123 additions and 41 deletions
107
tests/crate.scm
107
tests/crate.scm
|
@ -5,6 +5,7 @@
|
|||
;;; Copyright © 2020 Martin Becze <mjbecze@riseup.net>
|
||||
;;; Copyright © 2023, 2025 Efraim Flashner <efraim@flashner.co.il>
|
||||
;;; Copyright © 2023 David Elsing <david.elsing@posteo.net>
|
||||
;;; Copyright © 2025 Herman Rimm <herman@rimm.ee>
|
||||
;;;
|
||||
;;; This file is part of GNU Guix.
|
||||
;;;
|
||||
|
@ -446,6 +447,29 @@
|
|||
(define have-guile-semver?
|
||||
(false-if-exception (resolve-interface '(semver))))
|
||||
|
||||
(define rust-leaf-bob-3
|
||||
(package
|
||||
(name "rust-leaf-bob")
|
||||
(version "3.0.1")
|
||||
(source #f)
|
||||
(build-system #f)
|
||||
(home-page #f)
|
||||
(synopsis #f)
|
||||
(description #f)
|
||||
(license #f)))
|
||||
|
||||
(define rust-leaf-bob-3.0.2-yanked
|
||||
(package
|
||||
(name "rust-leaf-bob")
|
||||
(version "3.0.2")
|
||||
(source #f)
|
||||
(properties '((crate-version-yanked? . #t)))
|
||||
(build-system #f)
|
||||
(home-page #f)
|
||||
(synopsis #f)
|
||||
(description #f)
|
||||
(license #f)))
|
||||
|
||||
|
||||
(test-begin "crate")
|
||||
|
||||
|
@ -510,6 +534,66 @@
|
|||
(x
|
||||
(pk 'fail x #f)))))
|
||||
|
||||
(unless have-guile-semver? (test-skip 1))
|
||||
(test-assert "crate->guix-package-marks-missing-packages"
|
||||
(mock
|
||||
((gnu packages) find-packages-by-name
|
||||
(lambda* (name #:optional version)
|
||||
(match name
|
||||
("rust-leaf-bob"
|
||||
(list rust-leaf-bob-3.0.2-yanked))
|
||||
(_ '()))))
|
||||
(mock
|
||||
((guix http-client) http-fetch
|
||||
(lambda (url . rest)
|
||||
(match url
|
||||
("https://crates.io/api/v1/crates/intermediate-b"
|
||||
(open-input-string test-intermediate-b-crate))
|
||||
("https://crates.io/api/v1/crates/intermediate-b/1.2.3/download"
|
||||
(set! test-source-hash
|
||||
(bytevector->nix-base32-string
|
||||
(gcrypt-sha256 (string->bytevector "empty file\n" "utf-8"))))
|
||||
(open-input-string "empty file\n"))
|
||||
("https://crates.io/api/v1/crates/intermediate-b/1.2.3/dependencies"
|
||||
(open-input-string test-intermediate-b-dependencies))
|
||||
("https://crates.io/api/v1/crates/leaf-bob"
|
||||
(open-input-string test-leaf-bob-crate))
|
||||
("https://crates.io/api/v1/crates/leaf-bob/3.0.1/download"
|
||||
(set! test-source-hash
|
||||
(bytevector->nix-base32-string
|
||||
(gcrypt-sha256 (string->bytevector "empty file\n" "utf-8"))))
|
||||
(open-input-string "empty file\n"))
|
||||
(_ (error "Unexpected URL: " url)))))
|
||||
(match (crate->guix-package "intermediate-b" #:mark-missing? #t)
|
||||
((define-public 'rust-intermediate-b-1
|
||||
(package
|
||||
(name "rust-intermediate-b")
|
||||
(version "1.2.3")
|
||||
(source
|
||||
(origin
|
||||
(method url-fetch)
|
||||
(uri (crate-uri "intermediate-b" version))
|
||||
(file-name
|
||||
(string-append name "-" version ".tar.gz"))
|
||||
(sha256
|
||||
(base32
|
||||
(? string? hash)))))
|
||||
(build-system cargo-build-system)
|
||||
(arguments
|
||||
('quasiquote
|
||||
(#:skip-build? #t
|
||||
#:cargo-inputs
|
||||
(($ <comment> ";; rust-leaf-bob-3\n" #f)))))
|
||||
(home-page "http://example.com")
|
||||
(synopsis "summary")
|
||||
(description "This package provides summary.")
|
||||
(license (list license:expat license:asl2.0))))
|
||||
#t)
|
||||
(x
|
||||
(pk 'fail
|
||||
(pretty-print-with-comments (current-output-port) x)
|
||||
#f))))))
|
||||
|
||||
(unless have-guile-semver? (test-skip 1))
|
||||
(test-assert "crate-recursive-import"
|
||||
;; Replace network resources with sample data.
|
||||
|
@ -883,29 +967,6 @@
|
|||
|
||||
|
||||
|
||||
(define rust-leaf-bob-3
|
||||
(package
|
||||
(name "rust-leaf-bob")
|
||||
(version "3.0.1")
|
||||
(source #f)
|
||||
(build-system #f)
|
||||
(home-page #f)
|
||||
(synopsis #f)
|
||||
(description #f)
|
||||
(license #f)))
|
||||
|
||||
(define rust-leaf-bob-3.0.2-yanked
|
||||
(package
|
||||
(name "rust-leaf-bob")
|
||||
(version "3.0.2")
|
||||
(source #f)
|
||||
(properties '((crate-version-yanked? . #t)))
|
||||
(build-system #f)
|
||||
(home-page #f)
|
||||
(synopsis #f)
|
||||
(description #f)
|
||||
(license #f)))
|
||||
|
||||
(unless have-guile-semver? (test-skip 1))
|
||||
(test-assert "crate-recursive-import-honors-existing-packages"
|
||||
(mock
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue