search for: string_split

Displaying 20 results from an estimated 44 matches for "string_split".

Did you mean: string_nsplit
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 Mar 15
5
A few easy dpkg optimizations for supermin
I have done some printf profiling and found that supermin's calls to dpkg for individual packages are quite expensive. Here are some patches that gather all information on demand where possible. On my Debian/unstable-based workstation at home, preparing a minimal appliance using $ ./supermin --use-installed --prepare bash -o supermin.d now takes ~3.5s (previously ~15s). Turning that
2015 Oct 06
0
[PATCH 5/5] mllib: Replace various ad hoc string_* functions with String.*
...red 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 | 2 +- builder/index_parser.ml | 4 +- builder/paths.ml...
2015 Oct 07
1
Re: [PATCH 5/5] mllib: Replace various ad hoc string_* functions with String.*
...d 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: the functions would automatically alias functions with the same name, whenever available in OCaml' stdlib. Also (...
2017 Sep 01
0
[supermin][PATCH v2] os-release: use ID_LIKE as a fallback for SUSE detection
SUSE distros all have in common suse in ID_LIKE field. The ID field could be varying and is even set to 'Dummy' when building the packages. If the usual values for openSUSE/SLE can't be found in ID, try with ID_LIKE. --- Diff with v1: * Use Utils.string_split rather than too recent String.split_on_char src/os_release.ml | 10 +++++++++- src/os_release.mli | 7 +++++++ src/ph_rpm.ml | 1 + 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/os_release.ml b/src/os_release.ml index b2de259..abf2bea 100644 --- a/src/os_release.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.
2014 Aug 21
2
Re: [PATCH] v2v: adding input -i ova
On Thu, Aug 21, 2014 at 05:09:13PM +0300, Shahar Havivi wrote: [...] You'll also need to update documentation (v2v/virt-v2v.pod) and maybe add a test if it is possible to test this without carrying around huge/proprietary files. > + (* verify sha1 from manifest file *) > + let mf = dir // !mf in > + let rex = Str.regexp "SHA1(\\(.*\\))= *\\(.*?\\).*$" in > +
2015 Jun 12
1
[PATCH 3/3] get-kernel: add --prefix
...in - add, output, unversioned in + add, output, unversioned, prefix in (* Connect to libguestfs. *) let g = new G.guestfs () in @@ -167,8 +174,12 @@ read the man page virt-get-kernel(1). let dest_filename fn = let fn = Filename.basename fn in - if unversioned then fst (string_split "-" fn) - else fn in + let fn = + if unversioned then fst (string_split "-" fn) + else fn in + match prefix with + | None -> fn + | Some p -> p ^ "-" ^ fn in (* Download the latest. *) let outputdir = diff --git a/get-kernel/virt-...
2015 Feb 10
1
[PATCH] php: add a simple bindtests test
...uot; exit;\n"; + pr "}\n"; + ); + + pr "echo (\"EOF\\n\");\n"; + pr "?>\n"; + pr "--EXPECT--\n"; + + let dump filename = + let chan = open_in filename in + let rec loop () = + let line = input_line chan in + (match string_split ":" line with + | ("obool"|"oint"|"oint64"|"ostring"|"ostringlist") as x :: _ -> + pr "%s: unset\n" x + | _ -> pr "%s\n" line + ); + loop () + in + (try loop () with End_of_file -&...
2014 Aug 24
2
Re: [PATCH] v2v: adding input -i ova
...using awk ... > > let cmd = sprintf "sha1sum %s" (quote (dir // file)) in > > ... > > (match out with > > | [] -> error (f_"no output from sha1sum command, see previous errors") > > | [line] -> > > let hash, _ = string_split " " line in > if hash <> sha1 then > (etc) > > Rich. > > -- > Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones > Read my programming and virtualization blog: http://rwmj.wordpress.com > virt-p2v converts ph...
2014 Sep 17
4
[PATCH 0/2] supermin: use librpm for rpm support
Hi, this work makes supermin use the rpm library instead of invoking rpm directly. This, together with a needed refactoring of the dependency resolution, should help in make supermin faster on rpm-based systems. Surely the patches will still need polishing, especially for behaviours of newly added stuff, but at least it's a good starting point. Noting that you need rpm-devel on most of rpm
2015 Jun 12
0
[PATCH 2/3] get-kernel: add --unversioned-names
...rsioned in (* Connect to libguestfs. *) let g = new G.guestfs () in @@ -161,19 +165,24 @@ read the man page virt-get-kernel(1). if kernels = [] then error (f_"no kernel found"); + let dest_filename fn = + let fn = Filename.basename fn in + if unversioned then fst (string_split "-" fn) + else fn in + (* Download the latest. *) let outputdir = match output with | None -> Filename.current_dir_name | Some dir -> dir in let kernel_in = List.hd kernels in - let kernel_out = outputdir // Filename.basename kernel_in in + let kernel_ou...
2015 Jan 21
2
[PATCH] customize: add --commands-from-file
...t; ] in + let lines = read_whole_file filename in + let lines = string_nsplit \"\\n\" lines in + let lines = List.filter ( + fun line -> + String.length line > 0 && line.[0] <> '#' + ) lines in + let cmds = List.map (fun line -> string_split \" \" line) lines in + (* Check for commands not allowed in files containing commands. *) + List.iter ( + fun (cmd, _) -> + if List.mem cmd forbidden_commands then + error (f_\"command '%%s' cannot be used in command files, see the man page\&quot...
2016 Feb 18
0
[PATCH 3/3] Add and use an helper error function
...> - eprintf "supermin: rpm: get_rpm called too early"; - exit 1 + | None -> error "rpm: get_rpm called too early" | Some t -> t let rec rpm_init s = @@ -75,17 +73,12 @@ let rec rpm_init s = let version = rpm_version () in let major, minor = match string_split "." version with - | [] -> - eprintf "supermin: unable to parse empty rpm version string\n"; - exit 1 - | [x] -> - eprintf "supermin: unable to parse rpm version string: %s\n" x; - exit 1 + | [] -> error "unable to parse empty...
2016 Dec 08
4
[PATCH] generator: Share Common_utils code.
...ng{%s}" n n (String.concat ", " (List.map (sprintf "\"%s\"") xs)) ) optargs; @@ -971,7 +972,7 @@ and generate_php_bindtests () = let chan = open_in filename in let rec loop () = let line = input_line chan in - (match string_split ":" line with + (match String.nsplit ":" line with | ("obool"|"oint"|"oint64"|"ostring"|"ostringlist") as x :: _ -> pr "%s: unset\n" x | _ -> pr "%s\n" line diff --git a/gener...
2015 Jun 11
2
[PATCH] (Almost) new tool: virt-get-kernel
Extract the guest kernel/ramdisk extraction from virt-builder into a separate utility, so it can be used and improved without cluttering virt-builder. Currently it does what virt-builder --get-kernel did, adding also the options for remote disks and libvirt access, much like other libguestfs tools. virt-builder --get-kernel now just spawns virt-get-kernel. --- .gitignore |
2016 Feb 18
4
[PATCH 0/3] supermin: miscellaneous cleanups
Hi, few cleanups in the supermin codebase; no actual functional change. Thanks, -- Pino Toscano (3): ext2: simplify tracking of visited modules utils: remove unused run_python function Add and use an helper error function src/build.ml | 20 +++++----------- src/dpkg.ml | 4 +--- src/ext2_initrd.ml | 10 ++++---- src/kernel.ml | 27
2015 Jul 28
0
[PATCH 02/10] builder: create and use a new Checksums module
...+ let cmd = sprintf "%s %s" prog (quote filename) in + if verbose () then printf "%s\n%!" cmd; + let lines = external_command cmd in + match lines with + | [] -> + error (f_"%s did not return any output") prog + | line :: _ -> + let csum_actual = fst (string_split " " line) in + if csum_ref <> csum_actual then + error (f_"%s checksum of template did not match the expected checksum!\n found checksum: %s\n expected checksum: %s\nTry:\n - Use the '-v' option and look for earlier error messages.\n - Delete the cache: virt-b...
2012 Apr 18
1
[PATCH RFC] sysprep: remove user accounts
...t lines = Array.to_list (g#read_lines passwd) in + let lines_passwd = Array.to_list (g#read_lines passwd) in + let lines_shadow = Array.to_list (g#read_lines shadow) in + let lines_group = Array.to_list (g#read_lines group) in + List.iter ( + fun line -> + let user_line = string_split ":" line in + let user_line = Array.of_list user_line in + if user_line.(2) >= min_uid and user_line.(2) <= max_uid then ( + let user = user_line(0) in + let lines_passwd = List.filter ( + fun line -> not (string_prefix line user) +...
2014 Mar 08
9
supermin and dpkg-divert
While trying to run libguestfs tests after building with "--enable-appliance --with-supermin-extra-options=--use-installed", I ran into a peculiar error message in the c-api test: ,---- | libguestfs: error: strings: /abssymlink: strings: error while loading | shared libraries: libbfd-2.24-multiarch.so: cannot open shared object | file: No such file or directory `---- The problem here