search for: string_find

Displaying 20 results from an estimated 30 matches for "string_find".

2015 Jan 22
3
[PATCH 1/2] configure: look for the oUnit OCaml module
It will be used for the OCaml unit tests. --- configure.ac | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/configure.ac b/configure.ac index e0fb481..e360bbb 100644 --- a/configure.ac +++ b/configure.ac @@ -1120,6 +1120,7 @@ AS_IF([test "x$OCAMLC" != "xno"],[ ]) OCAML_PKG_gettext=no +OCAML_PKG_oUnit=no AS_IF([test "x$OCAMLC" != "xno"],[ #
2015 Jan 22
0
[PATCH 2/2] mllib: convert common_utils_tests to oUnit
..._suffix,foo,foo" (string_suffix "foo" "foo"); + assert_bool "string_suffix,123foo,foo" (string_suffix "123foo" "foo"); + assert_bool "not string_suffix,,foo" (not (string_suffix "" "foo")) + +(* Test Common_utils.string_find. *) +let test_string_find () = + assert_equal_int 0 (string_find "" ""); + assert_equal_int 0 (string_find "foo" ""); + assert_equal_int 1 (string_find "foo" "o"); + assert_equal_int 3 (string_find "foobar" "bar");...
2014 Dec 04
2
[PATCH v3 0/2] v2v: When picking a default kernel, favour non-debug
Since v2: - Use string_suffix kernel_name "-debug" || string_suffix kernel_name "-dbg" - This requires addition of the string_suffix function and some tests
2015 Oct 06
0
[PATCH 5/5] mllib: Replace various ad hoc string_* functions with String.*
This is just a straight refactoring. Various ad hoc string_* functions that appeared in Common_utils have been renamed and placed in the String.* namespace. The old vs "new" functions are: string_prefix -> String.is_prefix string_suffix -> String.is_suffix string_find -> String.find replace_str -> String.replace string_nsplit -> String.nsplit string_split -> String.split string_lines_split -> String.lines_split string_random8 -> String.random8 --- builder/checksums.ml | 2 +- builder/downloader.ml...
2015 Oct 06
10
[PATCH 0/5] mllib: Hide bad String functions and miscellaneous refactoring.
Hide/prevent the use of bad string functions like String.lowercase. These are replaced by safe functions that won't break UTF-8 strings. Other miscellaneous refactoring. Rich.
2015 May 11
3
[PATCH 1/2] mllib: Require OUnit2 for tests.
...uot;foo" ""); assert_bool "string_suffix,foo,foo" (string_suffix "foo" "foo"); @@ -103,7 +103,7 @@ let test_string_suffix () = assert_bool "not string_suffix,,foo" (not (string_suffix "" "foo")) (* Test Common_utils.string_find. *) -let test_string_find () = +let test_string_find ctx = assert_equal_int 0 (string_find "" ""); assert_equal_int 0 (string_find "foo" ""); assert_equal_int 1 (string_find "foo" "o"); @@ -112,7 +112,7 @@ let test_string_find ()...
2015 Sep 12
1
[PATCH] v2v: fix provides list whitespace trim
...insertion(+), 1 deletion(-) diff --git a/v2v/convert_linux.ml b/v2v/convert_linux.ml index adbcaa2..1e9e689 100644 --- a/v2v/convert_linux.ml +++ b/v2v/convert_linux.ml @@ -581,7 +581,7 @@ let rec convert ~keep_serial_console (g : G.guestfs) inspect source = List.filter (fun s -> string_find s library = -1) provides in (* Trim whitespace. *) - let rex = Str.regexp "^[ \\t]*\\([^ \\t]+\\)[ \\t]*$" in + let rex = Str.regexp "^[ \t]*\\([^ \t]+\\)[ \t]*$" in let provides = List.map (Str.replace_first rex "\\1")...
2015 Oct 07
1
Re: [PATCH 5/5] mllib: Replace various ad hoc string_* functions with String.*
...just a straight refactoring. Various ad hoc string_* > functions that appeared in Common_utils have been renamed and placed > in the String.* namespace. The old vs "new" functions are: > > string_prefix -> String.is_prefix > string_suffix -> String.is_suffix > string_find -> String.find > replace_str -> String.replace > string_nsplit -> String.nsplit > string_split -> String.split > string_lines_split -> String.lines_split > string_random8 -> String.random8 > --- As mentioned yesterday on IRC, I'm torn about this one...
2014 Dec 04
2
[PATCH v2] v2v: When picking a default kernel, favour non-debug kernels over debug kernels (RHBZ#1170073).
...upports_virtio = List.mem "virtio_net" modules in let is_xen_kernel = List.mem "xennet" modules in + (* If the package name is like "kernel-debug", then it's + * a debug kernel. + *) + let is_debug = string_find app.G.app2_name "debug" >= 0 in + Some { ki_app = app; ki_name = name; @@ -253,6 +259,7 @@ let rec convert ~verbose ~keep_serial_console (g : G.guestfs) inspect source = ki_modules = modules; ki_supports_vir...
2015 Jan 29
3
[PATCH 1/2] sparsify: ignore read-only btrfs snapshots (RHBZ#1079625)
...List.exists (fun fs' -> fs = g#canonical_device_name fs') ignores in + let is_readonly_btrfs_snapshot fs mp = + try + let is_btrfs = List.mem fs btrfs_filesystems in + if is_btrfs then ( + try + let vol_info = g#btrfs_subvolume_show mp in + string_find (List.assoc "Flags" vol_info) "readonly" <> -1 + with _ -> false + ) else false + with Not_found -> false + in + List.iter ( fun fs -> if not (is_ignored fs) then ( @@ -230,10 +247,15 @@ You can ignore this warning or change it to a...
2013 Aug 16
3
[PATCH v2] sysprep: added --mount-options option to mount selected
Nikita, Please take a look at the attached patch. I have rewritten it a little, and only lightly tested it. Rich.
2014 Aug 21
3
Re: [PATCH] v2v: adding input -i ova
...gt; type overlay = { > - ov_overlay : string; (** Local overlay file (qcow2 format). *) > + ov_overlay : string; (** Local overlgy file (qcow2 format). *) Typo added. > +let string_contains s1 s2 = There's a function already defined for this in mllib/common_utils.ml. `string_find'. It returns -1 if not found, or >= 0 if found. > +let read_file filename = See mllib/common_utils.ml `read_whole_file'. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com...
2015 Jan 23
2
[PATCH 1/2] mllib: tests: add tests for string_lines_split
...:(fun x -> Int64.to_string x) +let assert_equal_stringlist = assert_equal ~printer:(fun x -> "(" ^ (String.escaped (String.concat "," x)) ^ ")") (* Test Common_utils.int_of_le32 and Common_utils.le32_of_int. *) let test_le32 () = @@ -110,6 +111,22 @@ let test_string_find () = assert_equal_int (-1) (string_find "" "baz"); assert_equal_int (-1) (string_find "foobar" "baz") +(* Test Common_utils.string_lines_split. *) +let test_string_lines_split () = + assert_equal_stringlist [""] (string_lines_split "&q...
2015 Aug 10
0
[PATCH 3/4] v2v: copy virtio drivers without guestfs handle leak
...what version of Windows - * this driver is for. Paths can be things like: - * "NetKVM/2k12R2/amd64/netkvm.sys" or - * "./drivers/amd64/Win2012R2/netkvm.sys". - * Note we check lowercase paths. - *) - let pathelem elem = string_find lc_path ("/" ^ elem ^ "/") >= 0 in - let arch = - if pathelem "x86" || pathelem "i386" then "i386" - else if pathelem "amd64" then "x86_64" - else raise Not_found in - let os_...
2014 Dec 04
0
Re: [PATCH v2] v2v: When picking a default kernel, favour non-debug kernels over debug kernels (RHBZ#1170073).
...t;virtio_net" modules in > let is_xen_kernel = List.mem "xennet" modules in > > + (* If the package name is like "kernel-debug", then it's > + * a debug kernel. > + *) > + let is_debug = string_find app.G.app2_name "debug" >= 0 in What about something like (simplified): let is_debug = string_suffix app2_name "-debug" || string_suffix app2_name "-dbg" in ? This should avoid matching "debug" in other parts of the package name (unlik...
2014 Dec 04
1
[PATCH] v2v: When picking a default kernel, favour non-debug kernels over debug kernels (RHBZ#1170073).
...upports_virtio = List.mem "virtio_net" modules in let is_xen_kernel = List.mem "xennet" modules in + (* If the package name is like "kernel-debug", then it's + * a debug kernel. + *) + let is_debug = string_find app.G.app2_name "debug" >= 0 in + Some { ki_app = app; ki_name = name; @@ -253,6 +259,7 @@ let rec convert ~verbose ~keep_serial_console (g : G.guestfs) inspect source = ki_modules = modules; ki_supports_vir...
2015 Aug 10
15
[PATCH 0/4] v2v: simplify driver copying from virtio-win iso
Libguestfs supports passing an ISO image as a source of virtio windows drivers to v2v. That support, however, looks too heavy-weight: in order to access those drivers, a separate guestfs handle is created (and thus a new emulator process is started), which runs until v2v completes. This series attempts to make it simpler and lighter-weight, by making the relevant code more local, and by
2014 Aug 21
2
[PATCH] v2v: adding input -i ova
Shahar: This is the same patch as you posted, but I have rebased it on top of current HEAD. You'll have to do save the next email to a file, and do: git reset --hard HEAD^ git pull git am /path/to/saved_email There are no changes in this patch, except what is needed to make it compile. Will follow-up with comments. Rich.
2015 Jun 23
0
[PATCH v2] v2v: Support loading virtio-win drivers from virtio-win.iso (RHBZ#1234351).
...what version of Windows + * this driver is for. Paths can be things like: + * "NetKVM/2k12R2/amd64/netkvm.sys" or + * "./drivers/amd64/Win2012R2/netkvm.sys". + * Note we check lowercase paths. + *) + let pathelem elem = string_find lc_path ("/" ^ elem ^ "/") >= 0 in + let arch = + if pathelem "x86" || pathelem "i386" then "i386" + else if pathelem "amd64" then "x86_64" + else raise Not_found in + let os_...
2015 Jun 23
2
[PATCH v2] v2v: Support loading virtio-win drivers from
In version 2: - Add a bunch of debugging output. - Recognize Windows Vista, Windows 10. - Compare driver paths case-insensitively.