Displaying 20 results from an estimated 118 matches for "matched_group".
2016 Oct 05
4
[PATCH v2 0/2] Improve OVA manifest parsing
This series fixes and enhances parsing of the OVA manifest file.
The changes are:
- Added mandatory space to the regexp
- Process all lines in the file, not just one
- Warn on improperly formated lines
- Support SHA256 hashes
v1 -> v2: rebased on to master to make use of the Checksums module
Tomáš Golembiovský (2):
v2v: ova: fix checking of the manifest file
v2v: ova: support SHA256
2016 Oct 05
0
[PATCH v2 2/2] v2v: ova: support SHA256 hashes in manifest
...))= \\([0-9a-fA-F]+\\)\r?" in
List.iter (
fun mf ->
debug "Processing manifest %s" mf;
@@ -142,13 +142,14 @@ object
let rec loop () =
let line = input_line chan in
if Str.string_match rex line 0 then (
- let disk = Str.matched_group 1 line in
- let expected = Str.matched_group 2 line in
- let csum = Checksums.SHA1 expected in
+ let mode = Str.matched_group 1 line in
+ let disk = Str.matched_group 2 line in
+ let expected = Str.matched_group 3 line in
+ let csum...
2016 Nov 12
0
[PATCH v2 4/5] v2v: ova: don't extract files from OVA if it's not needed
...("'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 (
+ warning...
2017 Aug 01
0
[PATCH v2 3/3] daemon: Restore PCRE regular expressions in OCaml code.
...e =
(* 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 (PCRE.sub 2)
+...
2016 Oct 05
3
[PATCH v3 0/2] Improve OVA manifest parsing
This series fixes and enhances parsing of the OVA manifest file.
The changes are:
- Added mandatory space to the regexp
- Process all lines in the file, not just one
- Warn on improperly formated lines
- Support SHA256 hashes
v1 -> v2: rebased on to master to make use of the Checksums module
v2 -> v3:
- changed debug/warning messages in first patch according to Richard's
suggestions
2016 Oct 05
4
[PATCH v4 0/2] Improve OVA manifest parsing
This series fixes and enhances parsing of the OVA manifest file.
The changes are:
- Added mandatory space to the regexp
- Process all lines in the file, not just one
- Warn on improperly formated lines
- Support SHA256 hashes
v1 -> v2: rebased on to master to make use of the Checksums module
v2 -> v3:
- changed debug/warning messages in first patch according to Richard's
suggestions
2017 Sep 21
18
[PATCH v2 00/18] Replace many more uses of the Str module with PCRE.
v1 was here:
https://www.redhat.com/archives/libguestfs/2017-September/msg00135.html
This is a more complete evolution of the earlier patch. It replaces
most important uses of Str with PCRE throughout the code. It also
extends the bindings with some useful features like case-insensitive
regexps.
The main places I *didn't* touch are the generator (GObject uses Str
extensively); and
2016 Sep 08
1
[PATCH] virt-v2v: Support for ova exported from AWS [v2]
...ot;" in
- let rex = Str.regexp "^ovf:/disk/\\(.*\\)" in
+ let rex = Str.regexp "^\\(ovf:\\)?/disk/\\(.*\\)" in
if Str.string_match rex file_id 0 then (
(* Chase the references through to the actual file name. *)
- let file_id = Str.matched_group 1 file_id in
+ let file_id = Str.matched_group 2 file_id in
let expr = sprintf "/ovf:Envelope/ovf:DiskSection/ovf:Disk[@ovf:diskId='%s']/@ovf:fileRef" file_id in
let file_ref =
match xpath_string expr with
--
2.4.3
2016 Nov 21
2
Re: [PATCH v2 4/5] v2v: ova: don't extract files from OVA if it's not needed
...ersion' 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;
"warning" is already printed by the warnin...
2016 Sep 29
3
[PATCH 2/2] v2v: ova: support SHA256 hashes in manifest
...))= \\([0-9a-fA-F]+\\)\r?" in
List.iter (
fun mf ->
debug "Processing manifest %s" mf;
@@ -142,20 +142,23 @@ object
let rec loop () =
let line = input_line chan in
if Str.string_match rex line 0 then (
- let disk = Str.matched_group 1 line in
- let expected = Str.matched_group 2 line in
- let cmd = sprintf "sha1sum %s" (quote (mf_folder // disk)) in
+ let sha_num = Str.matched_group 1 line in
+ let disk = Str.matched_group 2 line in
+ let expected = Str.matched_g...
2016 Sep 06
2
[PATCH] virt-v2v: Support for ova exported from AWS
...ot;" in
- let rex = Str.regexp "^ovf:/disk/\\(.*\\)" in
+ let rex = Str.regexp "^\\(ovf:\\)?/disk/\\(.*\\)" in
if Str.string_match rex file_id 0 then (
(* Chase the references through to the actual file name. *)
- let file_id = Str.matched_group 1 file_id in
+ let file_id = Str.matched_group 2 file_id in
let expr = sprintf "/ovf:Envelope/ovf:DiskSection/ovf:Disk[@ovf:diskId='%s']/@ovf:fileRef" file_id in
let file_ref = xpath_to_string expr "" in
if file_ref == "&quo...
2014 Aug 21
3
Re: [PATCH] v2v: adding input -i ova
...from manifest file *)
> + let mf = dir // !mf in
> + let rex = Str.regexp "SHA1(\\(.*\\))= *\\(.*?\\).*$" in
> + let lines = read_file mf in
> + List.iter (
> + fun line ->
> + if Str.string_match rex line 0 then
> + let file = Str.matched_group 1 line in
> + let sha1 = Str.matched_group 2 line in
> +
> + let cmd = sprintf "sha1sum %s" (dir // file) in
Quoting needed, so:
let cmd = sprintf "sha1sum %s" (quote (dir // file)) in
> + let out = external_command ~prog cmd in
&g...
2017 Sep 22
27
[PATCH v3 00/22] Replace almost all uses of the Str module with PCRE.
v1:
https://www.redhat.com/archives/libguestfs/2017-September/msg00135.html
v2:
https://www.redhat.com/archives/libguestfs/2017-September/msg00158.html
v3 is almost identical to v2, but I have added 4 extra commits to
almost finish the job of replacing Str everywhere possible (note it's
not possible to replace Str in common/mlstdutils or the generator
because those are pure OCaml).
As
2016 Oct 07
3
[PATCH v5 0/2] Improve OVA manifest parsing
This series fixes and enhances parsing of the OVA manifest file.
The changes are:
- Added mandatory space to the regexp
- Process all lines in the file, not just one
- Warn on improperly formated lines
- Support SHA256 hashes
v4 -> v5:
- fix tests
- change one test to include the SHA256 checksum
Tomáš Golembiovský (2):
v2v: ova: fix checking of the manifest file
v2v: ova: support SHA256
2017 Jul 31
0
[PATCH v11 08/10] daemon: Implement inspection of Linux and other Unix-like operating systems.
...re_nld product_name 0 then (
+ (* Second line contains version string. *)
+ let major =
+ if List.length lines >= 2 then (
+ let line = List.nth lines 1 in
+ if Str.string_match re_sles_version line 0 then
+ Some (int_of_string (Str.matched_group 1 line))
+ else None
+ )
+ else None in
+
+ (* Third line contains service pack string. *)
+ let minor =
+ if List.length lines >= 3 then (
+ let line = List.nth lines 2 in
+ if Str.string_match re_sles_patchlevel...
2014 Aug 24
2
Re: [PATCH] v2v: adding input -i ova
...to virtual machines. Boot with a
> live CD or over the network (PXE) and turn machines into KVM guests.
> http://libguestfs.org/virt-v2v
After applying the patch I have a logical error at the check:
if hash <> sha1 then
its looks like the sha1 is not a string but a unit
let sha1 = Str.matched_group 2 line in
(sha1 : string);
Do you have an idea why?
(attached the new patch)
Shahar.
2014 Jan 30
2
[PATCH] builder: output translated notes
...open Common_utils
open Printf
+let split_locale loc =
+ let regex = Str.regexp "^\\([A-Za-z]+\\)\\(_\\([A-Za-z]+\\)\\)?\\(\\.\\([A-Za-z0-9-]+\\)\\)?\\(@\\([A-Za-z]+\\)\\)?$" in
+ let l = ref [] in
+ if Str.string_match regex loc 0 then (
+ let match_or_empty n =
+ try Str.matched_group n loc with
+ | Not_found -> "" in
+ let lang = Str.matched_group 1 loc in
+ let territory = match_or_empty 3 in
+ (match territory with
+ | "" -> ()
+ | territory -> l := (lang ^ "_" ^ territory) :: !l);
+ l := lang :: !l;
+ );
+ l :=...
2014 Aug 21
2
Re: [PATCH] v2v: adding input -i ova
...read_whole_file mf in
In here, add:
let lines = string_nsplit "\n" lines in
and replace the (Str.split ... lines) with just lines (after List.iter).
> + List.iter (
> + fun line ->
> + if Str.string_match rex line 0 then
> + let file = Str.matched_group 1 line in
> + let sha1 = Str.matched_group 2 line in
> +
> + let cmd = sprintf "sha1sum %s" (quote(dir // file)) in
Might be easier to use:
let cmd = sprintf "sha1sum %s | awk '{print $1}'"
(quote (dir // file)) in...
2014 Aug 24
2
Re: [PATCH] v2v: adding input -i ova
...Richard W.M. Jones wrote:
> On Sun, Aug 24, 2014 at 01:20:46PM +0300, Shahar Havivi wrote:
> > After applying the patch I have a logical error at the check:
> > if hash <> sha1 then
> >
> > its looks like the sha1 is not a string but a unit
> > let sha1 = Str.matched_group 2 line in
> > (sha1 : string);
> >
> > Do you have an idea why?
> > (attached the new patch)
>
> The patch you sent me compiles fine here. What's the error that you
> see?
The compilation is fine,
but the condition in line 88 (input_ova.ml) is true:
if hash...
2014 Mar 11
3
[PATCH 1/2] builder: move some language-related code into a Languages module
...01 USA.
+ *)
+
+open Common_utils
+
+let split_locale loc =
+ let regex = Str.regexp "^\\([A-Za-z]+\\)\\(_\\([A-Za-z]+\\)\\)?\\(\\.\\([A-Za-z0-9-]+\\)\\)?\\(@\\([A-Za-z]+\\)\\)?$" in
+ let l = ref [] in
+ if Str.string_match regex loc 0 then (
+ let match_or_empty n =
+ try Str.matched_group n loc with
+ | Not_found -> ""
+ in
+ let lang = Str.matched_group 1 loc in
+ let territory = match_or_empty 3 in
+ (match territory with
+ | "" -> ()
+ | territory -> l := (lang ^ "_" ^ territory) :: !l);
+ l := lang :: !l;
+ );
+...