aboutsummaryrefslogtreecommitdiff
path: root/guix/scripts
diff options
context:
space:
mode:
authorDavid Elsing <david.elsing@posteo.net>2023-12-21 22:01:52 +0000
committerEfraim Flashner <efraim@flashner.co.il>2024-01-09 09:38:38 +0200
commitb26926189e5bf253093050f9a73f2d9d7555cc3e (patch)
tree0537b9ea4b7b0409abdd76e35517b81d7573135b /guix/scripts
parent53add91be621a9d97e534397f16f71e071eaba96 (diff)
downloadguix-b26926189e5bf253093050f9a73f2d9d7555cc3e.tar
guix-b26926189e5bf253093050f9a73f2d9d7555cc3e.tar.gz
guix: import: Optionally import necessary yanked crates.
* doc/guix.texi (Invoking guix import): Mention '--allow-yanked'. * guix/import/crate.scm (make-crate-sexp): Add yanked? argument. For yanked packages, use the full version suffixed by "-yanked" for generated variable names and add a comment and package property. (crate->guix-package): Add allow-yanked? argument and if it is set to #t, allow importing yanked crates if no other version matching the requirements exists. [find-package-version]: Packages previously marked as yanked are only included if allow-yanked? is #t and then take the lowest priority. [find-crate-version]: If allow-yanked? is #t, also consider yanked versions with the lowest priority. [dependency-name+version]: Rename to ... [dependency-name+version+yanked] ...this. Honor allow-yanked? and choose between an existing package and an upstream package. Exit with an error message if no version fulfilling the requirement is found. [version*]: Exit with an error message if the crate version is not found. (cargo-recursive-import): Add allow-yanked? argument. * guix/read-print.scm: Export <comment>. * guix/scripts/import/crate.scm: Add "--allow-yanked". * tests/crate.scm: Add test 'crate-recursive-import-only-yanked-available'. [sort-map-dependencies]: Adjust accordingly. [remove-yanked-info]: New variable. Adjust test 'crate-recursive-import-honors-existing-packages'. (test-bar-dependencies): Add yanked dev-dependencies. (test-leaf-bob-crate): Add yanked versions. (rust-leaf-bob-3.0.2-yanked): New variable. Signed-off-by: Efraim Flashner <efraim@flashner.co.il> Change-Id: I175d89b39774e6b57dcd1f05bf68718d23866bb7
Diffstat (limited to 'guix/scripts')
-rw-r--r--guix/scripts/import/crate.scm14
1 files changed, 12 insertions, 2 deletions
diff --git a/guix/scripts/import/crate.scm b/guix/scripts/import/crate.scm
index b13b6636a6..082a973aee 100644
--- a/guix/scripts/import/crate.scm
+++ b/guix/scripts/import/crate.scm
@@ -51,6 +51,10 @@ Import and convert the crates.io package for PACKAGE-NAME.\n"))
(display (G_ "
--recursive-dev-dependencies
include dev-dependencies recursively"))
+ (display (G_ "
+ --allow-yanked
+ allow importing yanked crates if no alternative
+ satisfying the version requirement exists"))
(newline)
(display (G_ "
-h, --help display this help and exit"))
@@ -74,6 +78,9 @@ Import and convert the crates.io package for PACKAGE-NAME.\n"))
(option '("recursive-dev-dependencies") #f #f
(lambda (opt name arg result)
(alist-cons 'recursive-dev-dependencies #t result)))
+ (option '("allow-yanked") #f #f
+ (lambda (opt name arg result)
+ (alist-cons 'allow-yanked #t result)))
%standard-import-options))
@@ -102,8 +109,11 @@ Import and convert the crates.io package for PACKAGE-NAME.\n"))
(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))
+ (assoc-ref opts 'recursive-dev-dependencies)
+ #:allow-yanked? (assoc-ref opts 'allow-yanked))
+ (crate->guix-package
+ name #:version version #:include-dev-deps? #t
+ #:allow-yanked? (assoc-ref opts 'allow-yanked)))
((or #f '())
(leave (G_ "failed to download meta-data for package '~a'~%")
(if version