Displaying 20 results from an estimated 132 matches for "of_string".
2018 Apr 23
3
[PATCH 0/3] v2v: Miscellaneous refactoring and fixes.
Originally an attempt to fix:
https://bugzilla.redhat.com/show_bug.cgi?id=1570407
However this isn't a complete fix. The OVA supplied doesn't even
conform to VMware's own "specification" (I use the word loosely). The
OVF inside the OVA references the disk.vmdk file, but the OVA doesn't
contain that disk.vmdk file, only a snapshot called
disk.vmdk.000000000. Therefore
2017 Feb 07
1
Re: [PATCH v2 1/7] mllib: factorize code to add Checksum.get_checksum function
...+---------
> mllib/checksums.mli | 9 +++++++++
> 2 files changed, 25 insertions(+), 9 deletions(-)
>
> diff --git a/mllib/checksums.ml b/mllib/checksums.ml
> index 1009e131c..bee829085 100644
> --- a/mllib/checksums.ml
> +++ b/mllib/checksums.ml
> @@ -45,14 +45,13 @@ let of_string csum_type csum_value =
> | "sha512" -> SHA512 csum_value
> | _ -> invalid_arg csum_type
>
> -let verify_checksum csum ?tar filename =
> - let prog, csum_ref =
> +let do_compute_checksum csum ?tar filename =
> + let prog =
> match csum with
>...
2017 Aug 01
0
[PATCH v2 3/3] daemon: Restore PCRE regular expressions in OCaml code.
...e_list mountable =
(* Execute 'btrfs subvolume list <fs>', and split the output into lines *)
@@ -103,10 +103,10 @@ let btrfs_subvolume_list mountable =
*)
List.map (
fun line ->
- if Str.string_match re_btrfs_subvolume_list line 0 then (
- let id = Int64.of_string (Str.matched_group 1 line)
- and top_level_id = Int64.of_string (Str.matched_group 2 line)
- and path = Str.matched_group 3 line in
+ if PCRE.matches re_btrfs_subvolume_list line then (
+ let id = Int64.of_string (PCRE.sub 1)
+ and top_level_id = Int64.of_string (PC...
2015 Nov 17
0
[PATCH 2/3] v2v: windows: Add a Windows '*.inf' file parser.
...;";
i_major_version = 0; i_minor_version = 0;
@@ -126,6 +134,97 @@ let test_drive_index ctx =
assert_raises exn (fun () -> Utils.drive_index "Z");
assert_raises exn (fun () -> Utils.drive_index "aB")
+(* Test parsing a [*.inf] file. *)
+let test_windows_inf_of_string ctx =
+ let printer = Windows_inf.to_string in
+
+ (* There is nothing special about this choice. It is just a driver
+ * [*.inf] file picked at random.
+ *)
+ let path = srcdir // ".." // "test-data" // "fake-virtio-win" //
+ "cd" // &q...
2014 Jan 21
0
[PATCH] builder: proper consider subkeys in index files
...t;, Some "sha512") fields)
with Not_found ->
- try Some (List.assoc "checksum" fields)
+ try Some (List.assoc ("checksum", None) fields)
with Not_found -> None in
let revision =
- try int_of_string (List.assoc "revision" fields)
+ try int_of_string (List.assoc ("revision", None) fields)
with
| Not_found -> 1
| Failure "int_of_string" ->
@@ -188,9 +194,9 @@ let get_index ~prog ~debug ~downloader ~sigchecker s...
2014 Jan 21
2
Re: [PATCH] builder: proper consider subkeys in index files
On Tuesday 21 January 2014 16:37:20 Richard W.M. Jones wrote:
> On Tue, Jan 21, 2014 at 05:18:27PM +0100, Pino Toscano wrote:
> > + sv = caml_copy_string (fields->subkey ? fields->subkey : "");
> >
> > Store_field (v, 1, sv);
>
> Heh, sure would be nice if this was an option type :-)
>
> I believe the following should work:
>
>
2014 Jan 21
3
[PATCH] builder: proper consider subkeys in index files
...quot; "sha512" fields)
with Not_found ->
- try Some (List.assoc "checksum" fields)
+ try Some (find_elem "checksum" "" fields)
with Not_found -> None in
let revision =
- try int_of_string (List.assoc "revision" fields)
+ try int_of_string (find_elem "revision" "" fields)
with
| Not_found -> 1
| Failure "int_of_string" ->
@@ -188,9 +196,9 @@ let get_index ~prog ~debug ~downloader ~sigcheck...
2016 Nov 04
0
[PATCH 4/5] v2v: ova: don't extract files from OVA if it's not needed
...+ external_command ((stringify_args cmd1) ^ " | " ^ (stringify_args cmd2))
+ in
+ if (List.length lines < 1) then
+ raise Not_found
+ else
+ let soffset, ssize = String.split " " (List.hd lines) in
+ let offset =
+ try Int64.of_string soffset
+ with Failure _ ->
+ error (f_"Invalid offset returned by `tar`: %s") soffset
+ in
+ let size =
+ try Int64.of_string ssize
+ with Failure _ ->
+ error (f_"Invalid size returend by `tar': %s") ssiz...
2016 Nov 04
0
[PATCH 1/5] mllib: compute checksum of file inside tar
...tgolembi@redhat.com>
---
mllib/checksums.ml | 10 ++++++++--
mllib/checksums.mli | 2 +-
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/mllib/checksums.ml b/mllib/checksums.ml
index dfa8c3a..9fcff2f 100644
--- a/mllib/checksums.ml
+++ b/mllib/checksums.ml
@@ -45,7 +45,7 @@ let of_string csum_type csum_value =
| "sha512" -> SHA512 csum_value
| _ -> invalid_arg csum_type
-let verify_checksum csum filename =
+let verify_checksum csum ?(tar = "") filename =
let prog, csum_ref =
match csum with
| SHA1 c -> "sha1sum", c
@@ -53,...
2016 Nov 12
0
[PATCH v2 1/5] mllib: compute checksum of file inside tar
...olembi@redhat.com>
---
mllib/checksums.ml | 11 +++++++++--
mllib/checksums.mli | 2 +-
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/mllib/checksums.ml b/mllib/checksums.ml
index dfa8c3a..0907499 100644
--- a/mllib/checksums.ml
+++ b/mllib/checksums.ml
@@ -45,7 +45,7 @@ let of_string csum_type csum_value =
| "sha512" -> SHA512 csum_value
| _ -> invalid_arg csum_type
-let verify_checksum csum filename =
+let verify_checksum csum ?(tar) filename =
let prog, csum_ref =
match csum with
| SHA1 c -> "sha1sum", c
@@ -53,7 +53,14 @@ let...
2016 Dec 07
0
[PATCH v3 1/6] mllib: compute checksum of file inside tar
...i@redhat.com>
---
mllib/checksums.ml | 11 +++++++++--
mllib/checksums.mli | 7 +++++--
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/mllib/checksums.ml b/mllib/checksums.ml
index dfa8c3a..a6c995b 100644
--- a/mllib/checksums.ml
+++ b/mllib/checksums.ml
@@ -45,7 +45,7 @@ let of_string csum_type csum_value =
| "sha512" -> SHA512 csum_value
| _ -> invalid_arg csum_type
-let verify_checksum csum filename =
+let verify_checksum csum ?tar filename =
let prog, csum_ref =
match csum with
| SHA1 c -> "sha1sum", c
@@ -53,7 +53,14 @@ let v...
2017 Feb 07
0
[PATCH v2 1/7] mllib: factorize code to add Checksum.get_checksum function
...mllib/checksums.ml | 25 ++++++++++++++++---------
mllib/checksums.mli | 9 +++++++++
2 files changed, 25 insertions(+), 9 deletions(-)
diff --git a/mllib/checksums.ml b/mllib/checksums.ml
index 1009e131c..bee829085 100644
--- a/mllib/checksums.ml
+++ b/mllib/checksums.ml
@@ -45,14 +45,13 @@ let of_string csum_type csum_value =
| "sha512" -> SHA512 csum_value
| _ -> invalid_arg csum_type
-let verify_checksum csum ?tar filename =
- let prog, csum_ref =
+let do_compute_checksum csum ?tar filename =
+ let prog =
match csum with
- | SHA1 c -> "sha1sum", c
-...
2017 Feb 10
0
[PATCH v3 01/10] mllib: factorize code to add Checksum.get_checksum function
...llib/checksums.ml | 25 +++++++++++++++----------
mllib/checksums.mli | 9 +++++++++
2 files changed, 24 insertions(+), 10 deletions(-)
diff --git a/mllib/checksums.ml b/mllib/checksums.ml
index 1009e131c..000214703 100644
--- a/mllib/checksums.ml
+++ b/mllib/checksums.ml
@@ -45,14 +45,14 @@ let of_string csum_type csum_value =
| "sha512" -> SHA512 csum_value
| _ -> invalid_arg csum_type
-let verify_checksum csum ?tar filename =
- let prog, csum_ref =
- match csum with
- | SHA1 c -> "sha1sum", c
- | SHA256 c -> "sha256sum", c
- | SHA512...
2016 Sep 30
6
[PATCH 0/4] Consolidate Checksums as common code
Hi,
this small series moves the OCaml Checksums module from virt-builder to
mllib, adding more features to use it also for v2v.
Thanks,
Pino Toscano (4):
mllib: move Checksums from builder
mllib, builder: add and use Checksums.of_string
mllib: add SHA1 support in Checksums
v2v: -i ova: use Checksums
builder/Makefile.am | 2 --
builder/builder.ml | 6 +++-
builder/checksums.ml | 57 -----------------------------------
builder/checksums.mli | 33 --------------------
builder/simp...
2017 Sep 12
0
[PATCH v8 3/7] builder: add a template parameter to get_index
...ile ()
+ ) in
let signature_uri =
try Some (make_absolute_uri (List.assoc ("sig", None) fields))
with Not_found -> None in
@@ -113,7 +115,7 @@ let get_index ~downloader ~sigchecker
let revision =
try Rev_int (int_of_string (List.assoc ("revision", None) fields))
with
- | Not_found -> Rev_int 1
+ | Not_found -> if template then Rev_int 0 else Rev_int 1
| Failure _ ->
eprintf (f_"%s: cannot parse ‘revision’ field for ‘%s’\n") pr...
2017 Sep 18
0
[PATCH v9 3/7] builder: add a template parameter to get_index
...ile ()
+ ) in
let signature_uri =
try Some (make_absolute_uri (List.assoc ("sig", None) fields))
with Not_found -> None in
@@ -113,7 +115,7 @@ let get_index ~downloader ~sigchecker
let revision =
try Rev_int (int_of_string (List.assoc ("revision", None) fields))
with
- | Not_found -> Rev_int 1
+ | Not_found -> if template then Rev_int 0 else Rev_int 1
| Failure _ ->
eprintf (f_"%s: cannot parse ‘revision’ field for ‘%s’\n") pr...
2016 Nov 12
0
[PATCH v2 4/5] v2v: ova: don't extract files from OVA if it's not needed
...[] -> error ("'qemu-img --version' returned no output")
+ | line :: _ ->
+ let rex = Str.regexp "qemu-img version \\([0-9]+\\)\\.\\([0-9]+\\)" in
+ if Str.string_match rex line 0 then (
+ try
+ int_of_string (Str.matched_group 1 line),
+ int_of_string (Str.matched_group 2 line)
+ with Failure _ ->
+ warning (f_"warning: failed to read qemu-img version! Line: %S")
+ line;
+ 0, 9
+ ) else (
+...
2017 Oct 05
0
[PATCH v11 3/6] builder: add a template parameter to get_index
...n
let signature_uri =
try Some (make_absolute_uri (List.assoc ("sig", None) fields))
with Not_found -> None in
@@ -112,7 +114,7 @@ let get_index ~downloader ~sigchecker { Sources.uri; proxy } =
let revision =
try Rev_int (int_of_string (List.assoc ("revision", None) fields))
with
- | Not_found -> Rev_int 1
+ | Not_found -> if template then Rev_int 0 else Rev_int 1
| Failure _ ->
eprintf (f_"%s: cannot parse ‘revision’ field for ‘%s’\n") pr...
2017 Oct 27
0
[PATCH v11 5/8] builder: add a template parameter to get_index
...let signature_uri =
try Some (make_absolute_uri (List.assoc ("sig", None) fields))
with Not_found -> None in
@@ -112,21 +129,34 @@ let get_index ~downloader ~sigchecker { Sources.uri; proxy } =
let revision =
try Rev_int (int_of_string (List.assoc ("revision", None) fields))
with
- | Not_found -> Rev_int 1
+ | Not_found -> if template then Rev_int 0 else Rev_int 1
| Failure _ ->
eprintf (f_"%s: cannot parse ‘revision’ field for ‘%s’\n") pr...
2017 Nov 13
0
[PATCH v12 2/3] builder: add a template parameter to get_index
...let signature_uri =
try Some (make_absolute_uri (List.assoc ("sig", None) fields))
with Not_found -> None in
@@ -112,21 +127,34 @@ let get_index ~downloader ~sigchecker { Sources.uri; proxy } =
let revision =
try Rev_int (int_of_string (List.assoc ("revision", None) fields))
with
- | Not_found -> Rev_int 1
+ | Not_found -> if template then Rev_int 0 else Rev_int 1
| Failure _ ->
eprintf (f_"%s: cannot parse ‘revision’ field for ‘%s’\n") pr...