search for: regexp_case_fold

Displaying 15 results from an estimated 15 matches for "regexp_case_fold".

2017 Sep 22
0
[PATCH v3 15/22] v2v: windows: Convert the Windows-related conversion modules from Str to PCRE.
...= "UninstallString" in diff --git a/v2v/windows.ml b/v2v/windows.ml index 6c6ed01c7..fb68c86c9 100644 --- a/v2v/windows.ml +++ b/v2v/windows.ml @@ -24,12 +24,12 @@ open Common_utils open Utils (* Detect anti-virus (AV) software installed in Windows guests. *) -let rex_virus = Str.regexp_case_fold "virus" (* generic *) -let rex_kaspersky = Str.regexp_case_fold "kaspersky" -let rex_mcafee = Str.regexp_case_fold "mcafee" -let rex_norton = Str.regexp_case_fold "norton" -let rex_sophos = Str.regexp_case_fold "sophos" -let rex_avg_tech =...
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
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
2015 Nov 17
0
[PATCH 2/3] v2v: windows: Add a Windows '*.inf' file parser.
...r_rex = + Str.regexp "^[ \t]*\\[[ \t]*\\(.*\\)[ \t]*\\][ \t]*$" + +let match_section_header line = Str.string_match section_header_rex line 0 +let not_section_header line = not (match_section_header line) + +(* Match [key = value] in a Windows [*.inf] file. *) +let key_value_rex = + Str.regexp_case_fold + "^[ \t]*\\([a-z0-9%_.]+\\)[ \t]*=[ \t]*\\(.*\\)[ \t]*$" + +(* Match comment preceeded by whitespace (so comments can be removed). *) +let comment_rex = Str.regexp "[ \t]*;.*" + +(* Parse a Windows [*.inf] file into headers and section lines. *) +let of_string content = + (...
2015 Aug 31
2
[PATCH 1/2] mllib: add and use set_standard_options
...arg2, _, _) = compare_command_line_args arg1 arg2 in + List.sort cmp argspec in + let argspec = Arg.align argspec in + long_options := argspec; + argspec + (* Compare two version strings intelligently. *) let rex_numbers = Str.regexp "^\\([0-9]+\\)\\(.*\\)$" let rex_letters = Str.regexp_case_fold "^\\([a-z]+\\)\\(.*\\)$" diff --git a/mllib/common_utils.mli b/mllib/common_utils.mli index 9d1ee6a..5d93b53 100644 --- a/mllib/common_utils.mli +++ b/mllib/common_utils.mli @@ -122,6 +122,12 @@ val display_short_options : unit -> 'a val display_long_options : unit -> 'a (...
2015 Nov 17
8
[PATCH 0/3] v2v: windows: Use '*.inf' files to control how Windows drivers are installed.
https://github.com/rwmjones/libguestfs/tree/rewrite-virtio-copy-drivers Instead of trying to split and parse elements from virtio-win paths, use the '*.inf' files supplied with the drivers to control how Windows drivers are installed. The following emails best explain how this works: https://www.redhat.com/archives/libguestfs/2015-October/msg00352.html
2015 Nov 17
0
[PATCH 3/3] v2v: windows: Use '*.inf' files to control how Windows drivers are installed.
...t;i386" else Some "x86_64" + ) + else + raise Not_found + with + Not_found -> + warning (f_"%s: could not find or parse the [Manufacturer] section in the Windows inf file") + inf_name; + None + +and manufacturer_rex = + Str.regexp_case_fold ".*,NT\\(x86\\|amd64\\)" (* The following function is only exported for unit tests. *) module UNIT_TESTS = struct - let virtio_iso_path_matches_guest_os = virtio_iso_path_matches_guest_os + let virtio_inf_matches_guest_os = virtio_inf_matches_guest_os end (* This is a wrapper th...
2017 Jun 15
0
[PATCH v6 04/41] mllib: Split ‘Common_utils’ into ‘Std_utils’ + ‘Common_utils’.
...if r > 0 then ( + Buffer.add_substring buf (Bytes.to_string b) 0 r; + loop () + ) + in + loop (); + close_in chan; + Buffer.contents buf + +(* Compare two version strings intelligently. *) +let rex_numbers = Str.regexp "^\\([0-9]+\\)\\(.*\\)$" +let rex_letters = Str.regexp_case_fold "^\\([a-z]+\\)\\(.*\\)$" + +let compare_version v1 v2 = + let rec split_version = function + | "" -> [] + | str -> + let first, rest = + if Str.string_match rex_numbers str 0 then ( + let n = Str.matched_group 1 str in + let rest = Str....
2016 Dec 08
4
[PATCH] generator: Share Common_utils code.
...create_standard_options argspec ?anon_fun ?(key_opts = false) usage_msg = else []) in Getopt.create argspec ?anon_fun usage_msg +(*<stdlib>*) + (* Compare two version strings intelligently. *) let rex_numbers = Str.regexp "^\\([0-9]+\\)\\(.*\\)$" let rex_letters = Str.regexp_case_fold "^\\([a-z]+\\)\\(.*\\)$" @@ -684,6 +772,8 @@ let stringify_args args = | [] -> "" | app :: xs -> app ^ quote_args xs +(*</stdlib>*) + (* Run an external command, slurp up the output as a list of lines. *) let external_command ?(echo_cmd = true) cmd = if...
2017 Jun 19
16
[PATCH v7 00/13] Refactor utilities
This is just the utilities part of the patch series from: https://www.redhat.com/archives/libguestfs/2017-June/msg00103.html I believe this addresses everything raised in comments on that patch series. Rich.
2017 Jun 09
12
[PATCH 00/12] Refactor utility functions.
This turned out to be rather more involved than I thought. We have lots of utility functions, spread all over the repository, with not a lot of structure. This moves many of them under common/ and structures them so there are clear dependencies. This doesn't complete the job by any means. Other items I had on my to-do list for this change were: - Split up mllib/common_utils into: -
2017 Jun 12
32
[PATCH v5 00/32] Refactor utilities, implement some APIs in OCaml.
This is a combination of: https://www.redhat.com/archives/libguestfs/2017-June/msg00046.html [PATCH 00/12] Refactor utility functions. plus: https://www.redhat.com/archives/libguestfs/2017-June/msg00023.html [PATCH v3 00/19] Allow APIs to be implemented in OCaml. with the second patches rebased on top of the utility refactoring, and some other adjustments and extensions. This passes
2014 Feb 25
2
[PATCH supermin v4] Supermin 5 rewrite.
...4;5;6;7;8] + ) + +let rec filter_map f = function + | [] -> [] + | x :: xs -> + let x = f x in + match x with + | None -> filter_map f xs + | Some x -> x :: filter_map f xs + +let rex_numbers = Str.regexp "^\\([0-9]+\\)\\(.*\\)$" +let rex_letters = Str.regexp_case_fold "^\\([a-z]+\\)\\(.*\\)$" + +let rec compare_version v1 v2 = + compare (split_version v1) (split_version v2) + +and split_version = function + | "" -> [] + | str -> + let first, rest = + if Str.string_match rex_numbers str 0 then ( + let n = Str.matched_gr...
2017 Jun 15
45
[PATCH v6 00/41] Refactor utilities, reimplement inspection in the daemon.
v5: https://www.redhat.com/archives/libguestfs/2017-June/msg00065.html Since v5, this now implements inspection almost completely for Linux and Windows guests. Rich.
2017 Jun 21
45
[PATCH v8 00/42] Refactor utilities and reimplement inspection.
v7 was: https://www.redhat.com/archives/libguestfs/2017-June/msg00169.html https://www.redhat.com/archives/libguestfs/2017-June/msg00184.html I believe this addresses all comments received so far. Also it now passes a test where I compared about 100 disk images processed with old and new virt-inspector binaries. The output is identical in all cases except one which is caused by a bug in blkid