unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Simon Tournier <zimon.toutoune@gmail.com>
To: 63053@debbugs.gnu.org
Cc: "Simon Tournier" <zimon.toutoune@gmail.com>,
	"Christopher Baines" <mail@cbaines.net>,
	"Josselin Poiret" <dev@jpoiret.xyz>,
	"Ludovic Courtès" <ludo@gnu.org>,
	"Mathieu Othacehe" <othacehe@gnu.org>,
	"Ricardo Wurmus" <rekado@elephly.net>,
	"Simon Tournier" <zimon.toutoune@gmail.com>,
	"Tobias Geerinckx-Rice" <me@tobias.gr>
Subject: [bug#63053] [PATCH 1/3] guix: import: crate: Fix incorrect returned values.
Date: Mon, 24 Apr 2023 17:51:17 +0200	[thread overview]
Message-ID: <20230424155119.1540974-1-zimon.toutoune@gmail.com> (raw)
In-Reply-To: <20230424154801.1539772-1-zimon.toutoune@gmail.com>

* guix/import/crate.scm (crate->guix-package): Return compatible values with
'recursive-import'.
---
 guix/import/crate.scm | 54 ++++++++++++++++++++++---------------------
 1 file 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 @@ (define (sort-map-dependencies deps)
           (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
-- 
2.38.1





  reply	other threads:[~2023-04-24 15:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-24 15:48 [bug#63053] [PATCH 0/3] Fix "guix import crate" Simon Tournier
2023-04-24 15:51 ` Simon Tournier [this message]
2023-04-24 15:51   ` [bug#63053] [PATCH 2/3] scripts: import: crate: Handle non-existent package Simon Tournier
2023-04-24 15:51   ` [bug#63053] [PATCH 3/3] gnu: guix: Add guile-semver Simon Tournier
2023-04-30 21:09 ` bug#63053: [PATCH 0/3] Fix "guix import crate" Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230424155119.1540974-1-zimon.toutoune@gmail.com \
    --to=zimon.toutoune@gmail.com \
    --cc=63053@debbugs.gnu.org \
    --cc=dev@jpoiret.xyz \
    --cc=ludo@gnu.org \
    --cc=mail@cbaines.net \
    --cc=me@tobias.gr \
    --cc=othacehe@gnu.org \
    --cc=rekado@elephly.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).