search for: replace_first

Displaying 10 results from an estimated 10 matches for "replace_first".

2016 Oct 04
1
[PATCH] v2v: linux: try to fix removal of VMware tools
...de themselves, filter this out. *) let provides = - List.filter (fun s -> String.find s library = -1) provides in - - (* Trim whitespace. *) - let rex = Str.regexp "^[ \t]*\\([^ \t]+\\)[ \t]*$" in - let provides = List.map (Str.replace_first rex "\\1") provides in - - (* Install the dependencies with yum. Use yum explicitly - * because we don't have package names and local install is - * impractical. + List.filter ( + fun s -> + not (libra...
2015 Sep 12
1
[PATCH] v2v: fix provides list whitespace trim
...st.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") provides in (* Install the dependencies with yum. Use yum explicitly -- 2.1.0
2016 Aug 15
2
[PATCH v2] v2v: factor out bootloader handling
...nit -> unit + method update () = () +end + +(* Helper type used in detect_bootloader. *) +type bootloader_type = + | Grub1 + | Grub2 + +(* Helper function for SUSE: remove (hdX,X) prefix from a path. *) +let remove_hd_prefix path = + let rex = Str.regexp "^(hd.*)\\(.*\\)" in + Str.replace_first rex "\\1" path + +(* Grub1 (AKA grub-legacy) representation. *) +class bootloader_grub1 (g : G.guestfs) inspect grub_config = + (* Grub prefix? Usually "/boot". *) + let grub_prefix = + let mounts = g#inspect_get_mountpoints inspect.i_root in + try + List.find ( +...
2015 Nov 20
0
[PATCH] v2v: factor out bootloader handling
...nit -> unit + method update () = () +end + +(* Helper type used in detect_bootloader. *) +type bootloader_type = + | Grub1 + | Grub2 + +(* Helper function for SUSE: remove (hdX,X) prefix from a path. *) +let remove_hd_prefix path = + let rex = Str.regexp "^(hd.*)\\(.*\\)" in + Str.replace_first rex "\\1" path + +(* Grub1 (AKA grub-legacy) representation. *) +class bootloader_grub1 g inspect grub_config = + let prefix = + let mounts = g#inspect_get_mountpoints inspect.i_root in + try + List.find ( + fun path -> List.mem_assoc path mounts + ) [ "/bo...
2016 Aug 15
0
Re: [PATCH v2] v2v: factor out bootloader handling
...> +(* Helper type used in detect_bootloader. *) > +type bootloader_type = > + | Grub1 > + | Grub2 > + > +(* Helper function for SUSE: remove (hdX,X) prefix from a path. *) > +let remove_hd_prefix path = > + let rex = Str.regexp "^(hd.*)\\(.*\\)" in > + Str.replace_first rex "\\1" path > + > +(* Grub1 (AKA grub-legacy) representation. *) > +class bootloader_grub1 (g : G.guestfs) inspect grub_config = > + (* Grub prefix? Usually "/boot". *) > + let grub_prefix = > + let mounts = g#inspect_get_mountpoints inspect.i_root in...
2016 Aug 25
2
[PATCH v2] v2v: factor out bootloader handling
...(g : G.guestfs) inspect source rcaps = * list is the default booting kernel. *) let grub_kernels : kernel_info list = - (* Helper function for SUSE: remove (hdX,X) prefix from a path. *) - let remove_hd_prefix = - let rex = Str.regexp "^(hd.*)\\(.*\\)" in - Str.replace_first rex "\\1" - in - - let vmlinuzes = - match grub with - | `Grub1 -> - let paths = - let expr = sprintf "/files%s/title/kernel" grub_config in - let paths = g#aug_match expr in - let paths = Array.to_list paths in - - (...
2015 Nov 17
0
[PATCH 2/3] v2v: windows: Add a Windows '*.inf' file parser.
...ause + * we don't really understand the value format. + *) + let sections = List.map ( + fun (header, lines) -> + let lines = List.map ( + fun (key, value) -> + let value = + if String.contains value '"' then value + else Str.replace_first comment_rex "" value in + key, value + ) lines in + header, lines + ) sections in + + (* Normalize (by lowercasing) the section headers and keys (but not + * the values). + *) + let sections = List.map ( + fun (header, lines) -> + let header = String.l...
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
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