unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Robert Vollmert <rob@vllmrt.net>
To: 36676@debbugs.gnu.org
Cc: Robert Vollmert <rob@vllmrt.net>
Subject: [bug#36676] [PATCH 3/3] guix: cargo-build-system: Use bundled json instead of guile-json
Date: Mon, 15 Jul 2019 21:41:55 +0200	[thread overview]
Message-ID: <20190715194155.91313-3-rob@vllmrt.net> (raw)
In-Reply-To: <20190715194155.91313-1-rob@vllmrt.net>

Per https://lists.gnu.org/archive/html/guix-devel/2019-07/msg00193.html

* guix/build/cargo-build-system.scm: Use (gnu build json) instead
of (json parser).
* guix/build-system/cargo.scm: Import (gnu build json) instead of
(json parser).
---
 guix/build-system/cargo.scm       | 2 +-
 guix/build/cargo-build-system.scm | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/guix/build-system/cargo.scm b/guix/build-system/cargo.scm
index fa211d456d..10a1bac844 100644
--- a/guix/build-system/cargo.scm
+++ b/guix/build-system/cargo.scm
@@ -61,7 +61,7 @@ to NAME and VERSION."
 (define %cargo-build-system-modules
   ;; Build-side modules imported by default.
   `((guix build cargo-build-system)
-    (json parser)
+    (guix build json)
     ,@%cargo-utils-modules))
 
 (define* (cargo-build store name inputs
diff --git a/guix/build/cargo-build-system.scm b/guix/build/cargo-build-system.scm
index e4e62dd838..f38de16cf7 100644
--- a/guix/build/cargo-build-system.scm
+++ b/guix/build/cargo-build-system.scm
@@ -20,6 +20,7 @@
 
 (define-module (guix build cargo-build-system)
   #:use-module ((guix build gnu-build-system) #:prefix gnu:)
+  #:use-module (guix build json)
   #:use-module (guix build utils)
   #:use-module (guix build cargo-utils)
   #:use-module (ice-9 popen)
@@ -27,7 +28,6 @@
   #:use-module (ice-9 ftw)
   #:use-module (ice-9 format)
   #:use-module (ice-9 match)
-  #:use-module (json parser)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26)
   #:export (%standard-phases
@@ -42,15 +42,15 @@
 (define (manifest-targets)
   "Extract all targets from the Cargo.toml manifest"
   (let* ((port (open-input-pipe "cargo read-manifest"))
-         (data (json->scm port))
-         (targets (hash-ref data "targets" '())))
+         (data (read-json port))
+         (targets (or (assoc-ref data "targets") '())))
     (close-port port)
     targets))
 
 (define (has-executable-target?)
   "Check if the current cargo project declares any binary targets."
   (let* ((bin? (lambda (kind) (string=? kind "bin")))
-         (get-kinds (lambda (dep) (hash-ref dep "kind")))
+         (get-kinds (lambda (dep) (assoc-ref dep "kind")))
          (bin-dep? (lambda (dep) (find bin? (get-kinds dep)))))
     (find bin-dep? (manifest-targets))))
 
-- 
2.20.1 (Apple Git-117)

  parent reply	other threads:[~2019-07-15 19:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-15 19:40 [bug#36676] [PATCH 0/3] cargo build system fixes Robert Vollmert
2019-07-15 19:41 ` [bug#36676] [PATCH 1/3] guix: cargo-build-system: Set CARGO_HOME early to fix build Robert Vollmert
2019-07-15 19:41   ` [bug#36676] [PATCH 2/3] gnu: Update rust-proc-macro2 to 0.4.30 to fix tests Robert Vollmert
2019-07-15 19:41   ` Robert Vollmert [this message]
2019-07-15 20:37 ` [bug#36676] [PATCH 0/3] cargo build system fixes Danny Milosavljevic
2019-07-16  7:57 ` bug#36676: " Danny Milosavljevic

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=20190715194155.91313-3-rob@vllmrt.net \
    --to=rob@vllmrt.net \
    --cc=36676@debbugs.gnu.org \
    /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).