[PATCH] guix: import/crate: Move build-dependencies to cargo-inputs.

  • Open
  • quality assurance status badge
Details
2 participants
  • Efraim Flashner
  • Ludovic Courtès
Owner
unassigned
Submitted by
Efraim Flashner
Severity
normal
E
E
Efraim Flashner wrote on 24 Jan 2020 11:38
(address . guix-patches@gnu.org)(name . Efraim Flashner)(address . efraim@flashner.co.il)
20200124103843.29807-1-efraim@flashner.co.il
* guix/import/crate.scm (crate->guix-package): Add definition for
'dev-dependency?' and 'build-dependency?'. Adjust dep-crates to take
normal- and build- dependencies.
---
guix/import/crate.scm | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)

Toggle diff (48 lines)
diff --git a/guix/import/crate.scm b/guix/import/crate.scm
index 57823c3639..0fece81c55 100644
--- a/guix/import/crate.scm
+++ b/guix/import/crate.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2016 David Craven <david@craven.ch>
;;; Copyright © 2019, 2020 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2019 Martin Becze <mjbecze@riseup.net>
+;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -86,7 +87,7 @@
crate-dependency?
json->crate-dependency
(id crate-dependency-id "crate_id") ;string
- (kind crate-dependency-kind "kind" ;'normal | 'dev
+ (kind crate-dependency-kind "kind" ;'normal | 'dev | 'build
string->symbol)
(requirement crate-dependency-requirement "req")) ;string
@@ -197,6 +198,12 @@ latest version of CRATE-NAME."
(define (normal-dependency? dependency)
(eq? (crate-dependency-kind dependency) 'normal))
+ (define (dev-dependency? dependency)
+ (eq? (crate-dependency-kind dependency) 'dev))
+
+ (define (build-dependency? dependency)
+ (eq? (crate-dependency-kind dependency) 'build))
+
(define crate
(lookup-crate crate-name))
@@ -212,8 +219,9 @@ latest version of CRATE-NAME."
(and crate version*
(let* ((dependencies (crate-version-dependencies version*))
- (dep-crates (filter normal-dependency? dependencies))
- (dev-dep-crates (remove normal-dependency? dependencies))
+ (dep-crates (append (filter normal-dependency? dependencies)
+ (filter build-dependency? dependencies)))
+ (dev-dep-crates (filter dev-dependency? dependencies))
(cargo-inputs (sort (map crate-dependency-id dep-crates)
string-ci<?))
(cargo-development-inputs
--
2.25.0
L
L
Ludovic Courtès wrote on 5 Feb 2020 00:17
(name . Efraim Flashner)(address . efraim@flashner.co.il)(address . 39261@debbugs.gnu.org)
87imkmt01b.fsf@gnu.org
Hello!

Nitpick: for the subject line, I’d write:

import: crate: Move build dependencies to cargo-inputs.

Efraim Flashner <efraim@flashner.co.il> skribis:

Toggle quote (4 lines)
> * guix/import/crate.scm (crate->guix-package): Add definition for
> 'dev-dependency?' and 'build-dependency?'. Adjust dep-crates to take
> normal- and build- dependencies.

[...]

Toggle quote (3 lines)
> + (define (dev-dependency? dependency)
> + (eq? (crate-dependency-kind dependency) 'dev))

Nitpick2: I’d recommend ‘development-dependency?’ as per the style
guidelines. :-)

Anyhow, LGTM!

Thanks,
Ludo’.
E
E
Efraim Flashner wrote on 5 Feb 2020 08:14
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 39261@debbugs.gnu.org)
6D8DAA60-B757-463F-A7A8-7D3022974A1F@flashner.co.il
I'm actually going to let this one ride until we review the importer patches. Then if it still makes sense we can apply this one.

On February 4, 2020 11:17:36 PM UTC, "Ludovic Courtès" <ludo@gnu.org> wrote:
Toggle quote (25 lines)
>Hello!
>
>Nitpick: for the subject line, I’d write:
>
> import: crate: Move build dependencies to cargo-inputs.
>
>Efraim Flashner <efraim@flashner.co.il> skribis:
>
>> * guix/import/crate.scm (crate->guix-package): Add definition for
>> 'dev-dependency?' and 'build-dependency?'. Adjust dep-crates to take
>> normal- and build- dependencies.
>
>[...]
>
>> + (define (dev-dependency? dependency)
>> + (eq? (crate-dependency-kind dependency) 'dev))
>
>Nitpick2: I’d recommend ‘development-dependency?’ as per the style
>guidelines. :-)
>
>Anyhow, LGTM!
>
>Thanks,
>Ludo’.

--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 39261@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 39261
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch