summary refs log tree commit diff
diff options
context:
space:
mode:
authorSimon Tournier <zimon.toutoune@gmail.com>2023-04-24 17:51:17 +0200
committerLudovic Courtès <ludo@gnu.org>2023-04-30 23:07:58 +0200
commit7304694f51f3e99817ac3033fcd20545623e9a94 (patch)
tree76e41b1e9b6a94d9098065a840fe5b0cc6491c38
parent643692895f3beb067b970f1610f3517d081648e3 (diff)
downloadguix-7304694f51f3e99817ac3033fcd20545623e9a94.tar.gz
guix: import: crate: Fix incorrect returned values.
* guix/import/crate.scm (crate->guix-package): Return compatible values with
'recursive-import'.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
-rw-r--r--guix/import/crate.scm54
1 files changed, 28 insertions, 26 deletions
diff --git a/guix/import/crate.scm b/guix/import/crate.scm
index 514eca2229..6e10ebb5d4 100644
--- a/guix/import/crate.scm
+++ b/guix/import/crate.scm
@@ -4,6 +4,7 @@
 ;;; Copyright © 2019, 2020 Martin Becze <mjbecze@riseup.net>
 ;;; Copyright © 2021 Nicolas Goaziou <mail@nicolasgoaziou.fr>
 ;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
+;;; Copyright © 2023 Simon Tournier <zimon.toutoune@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -293,32 +294,33 @@ look up the development dependencs for the given crate."
           (match-lambda* (((name _) ...)
                           (apply string-ci<? name)))))
 
-  (and crate version*
-       (let* ((dependencies (crate-version-dependencies version*))
-              (dep-crates dev-dep-crates (partition normal-dependency? dependencies))
-              (cargo-inputs (sort-map-dependencies dep-crates))
-              (cargo-development-inputs (if include-dev-deps?
-                                            (sort-map-dependencies dev-dep-crates)
-                                            '())))
-         (values
-          (make-crate-sexp #:build? include-dev-deps?
-                           #:name crate-name
-                           #:version (crate-version-number version*)
-                           #:cargo-inputs cargo-inputs
-                           #:cargo-development-inputs cargo-development-inputs
-                           #:home-page
-                           (let ((home-page (crate-home-page crate)))
-                             (if (string? home-page)
-                                 home-page
-                                 (let ((repository (crate-repository crate)))
-                                   (if (string? repository)
-                                       repository
-                                       ""))))
-                           #:synopsis (crate-description crate)
-                           #:description (crate-description crate)
-                           #:license (and=> (crate-version-license version*)
-                                            string->license))
-          (append cargo-inputs cargo-development-inputs)))))
+  (if (and crate version*)
+      (let* ((dependencies (crate-version-dependencies version*))
+             (dep-crates dev-dep-crates (partition normal-dependency? dependencies))
+             (cargo-inputs (sort-map-dependencies dep-crates))
+             (cargo-development-inputs (if include-dev-deps?
+                                           (sort-map-dependencies dev-dep-crates)
+                                           '())))
+        (values
+         (make-crate-sexp #:build? include-dev-deps?
+                          #:name crate-name
+                          #:version (crate-version-number version*)
+                          #:cargo-inputs cargo-inputs
+                          #:cargo-development-inputs cargo-development-inputs
+                          #:home-page
+                          (let ((home-page (crate-home-page crate)))
+                            (if (string? home-page)
+                                home-page
+                                (let ((repository (crate-repository crate)))
+                                  (if (string? repository)
+                                      repository
+                                      ""))))
+                          #:synopsis (crate-description crate)
+                          #:description (crate-description crate)
+                          #:license (and=> (crate-version-license version*)
+                                           string->license))
+         (append cargo-inputs cargo-development-inputs)))
+      (values #f '())))
 
 (define* (crate-recursive-import crate-name #:key version)
   (recursive-import crate-name