Displaying 13 results from an estimated 13 matches for "json_parser_tree_parse".
2018 Aug 17
0
[PATCH v3 1/4] mltools: Rename Yajl module as JSON_parser and move to common/mltools.
...s
open Tools_utils
open Common_gettext.Gettext
-open Yajl
+open JSON_parser
open Utils
open Printf
@@ -44,7 +44,7 @@ let get_index ~downloader ~sigchecker { Sources.uri; proxy } =
| Some f -> f
) else
tmpfile in
- yajl_tree_parse (read_whole_file file) in
+ json_parser_tree_parse (read_whole_file file) in
let downloads =
let uri_index =
@@ -106,7 +106,7 @@ let get_index ~downloader ~sigchecker { Sources.uri; proxy } =
* the ones related to checksums, explicitly filter
* the supported checksums.
*)
-...
2018 Aug 23
2
[PATCH 1/2] mltools: JSON: add json_parser_tree_parse_file
...+++++++++++
4 files changed, 52 insertions(+)
diff --git a/common/mltools/JSON_parser-c.c b/common/mltools/JSON_parser-c.c
index e10a2b69d..be1f011d1 100644
--- a/common/mltools/JSON_parser-c.c
+++ b/common/mltools/JSON_parser-c.c
@@ -37,6 +37,7 @@
#define JSON_DICT_TAG 5
value virt_builder_json_parser_tree_parse (value stringv);
+value virt_builder_json_parser_tree_parse_file (value stringv);
static value
convert_json_t (json_t *val, int level)
@@ -142,3 +143,27 @@ virt_builder_json_parser_tree_parse (value stringv)
CAMLreturn (rv);
}
+
+value
+virt_builder_json_parser_tree_parse_file (value file...
2018 Aug 20
6
[PATCH 0/4] mltools: JSON unification
An evolution of:
https://www.redhat.com/archives/libguestfs/2018-August/msg00155.html
2018 Aug 20
0
[PATCH 4/4] mltools: JSON: unify JSON_parser type with JSON.json_t.
...arser-c.c
@@ -28,7 +28,12 @@
#include <stdio.h>
#include <string.h>
-#define Val_none (Val_int (0))
+#define JSON_STRING_TAG 0
+#define JSON_INT_TAG 1
+#define JSON_FLOAT_TAG 2
+#define JSON_BOOL_TAG 3
+#define JSON_LIST_TAG 4
+#define JSON_DICT_TAG 5
value virt_builder_json_parser_tree_parse (value stringv);
@@ -36,60 +41,87 @@ static value
convert_json_t (json_t *val, int level)
{
CAMLparam0 ();
- CAMLlocal4 (rv, lv, v, sv);
+ CAMLlocal5 (rv, v, tv, sv, consv);
if (level > 20)
caml_invalid_argument ("too many levels of object/array nesting");
if (j...
2018 Aug 22
3
[PATCH v2 0/2] mltools: JSON: unify JSON & JSON parser.
v2:
- Added back the null value.
- Reran the tests.
Rich.
2018 Aug 17
8
[PATCH v3 4/4] v2v: Add --print-estimate option to print copy size
I rethought this again, as I think that it's a dangerous assumption to
bake qemu-img measure output into our API.
This patch series runs qemu-img measure behind the scenes, but then
parses the output and sums it to a single number which we print.
Doing that required a bit of reworking, moving the Jansson [JSON
parser] bindings from virt-builder into the common directory and
a couple of other
2018 Aug 23
0
[PATCH 2/2] builder: use the new json_parser_tree_parse_file
...parser.ml b/builder/simplestreams_parser.ml
index ccbfdff67..407eb11fb 100644
--- a/builder/simplestreams_parser.ml
+++ b/builder/simplestreams_parser.ml
@@ -44,7 +44,7 @@ let get_index ~downloader ~sigchecker { Sources.uri; proxy } =
| Some f -> f
) else
tmpfile in
- json_parser_tree_parse (read_whole_file file) in
+ json_parser_tree_parse_file file in
let downloads =
let uri_index =
--
2.17.1
2018 Aug 23
2
[PATCH v5] v2v: Add --print-estimate option to print copy size estimate.
v5:
- Normal output modified approx as suggested in previous email.
- Machine readable output uses JSON.
2019 Apr 03
1
[PATCH] UNTESTED v2v: openstack: Read server-id from metadata service.
Random old patch that I had in my queue. Posting it as a backup,
it is still untested.
Rich.
2018 Aug 23
0
[PATCH v4] v2v: Add --print-estimate option to print copy size estimate.
...REAT; O_TRUNC] 0o600 in
+ if run_command ~stdout_fd:fd !cmd <> 0 then
+ error (f_"qemu-img measure failed, see earlier errors");
+ (* Note that run_command closes fd. *)
+
+ let json = read_whole_file json in
+ debug "qemu-img measure output: %s" json;
+ let json = json_parser_tree_parse json in
+ debug "qemu-img measure output parsed as: %s"
+ (JSON.string_of_doc ~fmt:JSON.Indented ["", json]);
+
+ (* We're expecting the tree to contain nodes:
+ * Dict [ "required", Int number; "fully-allocated", Int number ]
+ * Of course t...
2018 Aug 17
0
[PATCH v3 4/4] v2v: Add --print-estimate option to print copy size estimate.
...t json;
+
+ let fd = Unix.openfile json [O_WRONLY; O_CREAT; O_TRUNC] 0o600 in
+ if run_command ~stdout_fd:fd !cmd <> 0 then
+ error (f_"qemu-img measure failed, see earlier errors");
+ (* Note that run_command closes fd. *)
+
+ let json = read_whole_file json in
+ let tree = json_parser_tree_parse json in
+
+ (* We're expecting the tree to contain nodes:
+ * object [| "required", number; "fully-allocated", number |]
+ * Of course the array could appear in any order.
+ *)
+ match tree with
+ | JSON_parser_object fields ->
+ let fields = Array.to_list fi...
2018 Aug 23
0
[PATCH v5] v2v: Add --print-estimate option to print copy size estimate.
...REAT; O_TRUNC] 0o600 in
+ if run_command ~stdout_fd:fd !cmd <> 0 then
+ error (f_"qemu-img measure failed, see earlier errors");
+ (* Note that run_command closes fd. *)
+
+ let json = read_whole_file json in
+ debug "qemu-img measure output: %s" json;
+ let json = json_parser_tree_parse json in
+ debug "qemu-img measure output parsed as: %s"
+ (JSON.string_of_doc ~fmt:JSON.Indented ["", json]);
+
+ (* We're expecting the tree to contain nodes:
+ * Dict [ "required", Int number; "fully-allocated", Int number ]
+ * Of course t...
2018 Aug 23
2
[PATCH v4] v2v: Add --print-estimate option to print copy size estimate.
v4:
- Same as v3, but depends on and uses new --machine-readable work.
Rich.