search for: create_standard_opt

Displaying 20 results from an estimated 65 matches for "create_standard_opt".

2018 Sep 19
0
[PATCH 1/2] mltools: create a cmdline_options struct
Instead of returning directly a Getopt.t handle, now Tools_utils.create_standard_options returns a struct, which at the moment contains only the Getopt.t handle. This way, it will be easy to add more data needed for handling standard command line options. This is mostly refactoring, with no functional changes. --- builder/cmdline.ml | 2 +- builder/reposit...
2018 Aug 20
2
[PATCH 1/2] mlstdutils/mltools: factorize the machine-readable option
Store the machine-readable flag globally, just like done for verbose/debug/etc, and enhance create_standard_options to provide --machine-readable automatically. --- common/mlstdutils/std_utils.ml | 4 ++++ common/mlstdutils/std_utils.mli | 7 +++++-- common/mltools/tools_utils.ml | 7 ++++++- common/mltools/tools_utils.mli | 5 ++++- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/common...
2018 Sep 20
1
Re: [PATCH 1/2] mltools: create a cmdline_options struct
...78a..99984bfa1 100644 > --- a/common/mltools/tools_utils.mli > +++ b/common/mltools/tools_utils.mli > @@ -74,7 +74,13 @@ val machine_readable : unit -> machine_readable_fn option > readable output to, in case it was enabled via > [--machine-readable]. *) > > -val create_standard_options : Getopt.speclist -> ?anon_fun:Getopt.anon_fun -> ?key_opts:bool -> ?machine_readable:bool -> Getopt.usage_msg -> Getopt.t > +type cmdline_options = { > + getopt : Getopt.t; (** The actual Getopt handle. *) > +} > +(** Structure representing all the data...
2018 Aug 20
0
[PATCH 2/2] OCaml tools: simplify machine-readable handling
Make use of the helper provided by Tools_utils.create_standard_options, so there is no need to implement the logic in each tool. This affects all the OCaml tools with --machine-readable, namely: virt-builder, virt-builder-repository, virt-dib, virt-get-kernel, virt-resize, virt-sparsify, and virt-v2v. --- builder/cmdline.ml | 8 ++------ builder/reposit...
2016 Sep 19
0
[PATCH 3/3] OCaml tools: add crypto support (RHBZ#1362649)
...customize/customize_main.ml index 07fd790..5613277 100644 --- a/customize/customize_main.ml +++ b/customize/customize_main.ml @@ -102,7 +102,7 @@ A short summary of the options is given below. For detailed help please read the man page virt-customize(1). ") prog in - let opthandle = create_standard_options argspec usage_msg in + let opthandle = create_standard_options argspec ~key_opts:true usage_msg in Getopt.parse opthandle; if not !format_consumed then @@ -175,6 +175,9 @@ read the man page virt-customize(1). g#launch (); g in + (* Decrypt the disks. *) + inspect_decrypt...
2016 Sep 19
6
[PATCH 0/3] add crypto/LUKS support in some OCaml-based tools
Hi, this series refactors some guestfish code (not much), and exposes it via Common_utils, so it is possible to decrypt LUKS partitions when using virt-customize, virt-get-kernel, virt-sparsify, and virt-sysprep. This brings them closer in features with C tools. Most probably a couple more of other OCaml-based tools (virt-v2v to convert encrypted guests, and virt-builder to use encrypted
2016 Sep 19
0
[PATCH 2/3] mllib: expose disk decrypt functionalities
...> unit = "guestfs_int_mllib_set_echo_keys" "noalloc" +external c_set_keys_from_stdin : unit -> unit = "guestfs_int_mllib_set_keys_from_stdin" "noalloc" + module Char = struct include Char @@ -591,7 +595,7 @@ let human_size i = ) ) -let create_standard_options argspec ?anon_fun usage_msg = +let create_standard_options argspec ?anon_fun ?(key_opts = false) usage_msg = (** Install an exit hook to check gc consistency for --debug-gc *) let set_debug_gc () = at_exit (fun () -> Gc.compact()) in @@ -604,6 +608,14 @@ let create_standard_option...
2018 Sep 19
5
[PATCH 0/2] RFC: --key option for tools
Hi, the following series adds a --key option in the majority of tools: this makes it possible to pass LUKS credentials programmatically, avoid the need to manually input them, or unsafely pass them via stdin. Thanks, Pino Toscano (2): mltools: create a cmdline_options struct Introduce a --key option in tools that accept keys builder/cmdline.ml | 2 +-
2017 May 22
1
[PATCH] v2v: add crypto support (RHBZ#1451665)
...1 deletion(-) diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml index a1338eb..70301ab 100644 --- a/v2v/cmdline.ml +++ b/v2v/cmdline.ml @@ -236,7 +236,7 @@ A short summary of the options is given below. For detailed help please read the man page virt-v2v(1). ") prog in - let opthandle = create_standard_options argspec ~anon_fun usage_msg in + let opthandle = create_standard_options argspec ~anon_fun ~key_opts:true usage_msg in Getopt.parse opthandle; (* Dereference the arguments. *) diff --git a/v2v/v2v.ml b/v2v/v2v.ml index 8cf1fad..59f5ef1 100644 --- a/v2v/v2v.ml +++ b/v2v/v2v.ml @@ -86,6...
2019 Jan 16
0
[PATCH 2/5] mltools: create a new external_command_code
...on/mltools/tools_utils.mli | 8 ++++++++ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/common/mltools/tools_utils.ml b/common/mltools/tools_utils.ml index 3b1554c5a..e6b2b5713 100644 --- a/common/mltools/tools_utils.ml +++ b/common/mltools/tools_utils.ml @@ -338,7 +338,13 @@ let create_standard_options argspec ?anon_fun ?(key_opts = false) ?(machine_read } (* Run an external command, slurp up the output as a list of lines. *) -let external_command ?(echo_cmd = true) cmd = +let rec external_command ?(echo_cmd = true) cmd = + let lines, exitcode = external_command_code ~echo_cmd cmd in +...
2018 Aug 21
0
[PATCH 2/2] OCaml tools: add output selection for --machine-readable
...| File f -> open_out f + in + match !machine_readable_channel with + | Some chan -> chan + | None -> + let chan = open_machine_readable_channel () in + machine_readable_channel := Some chan; + chan + in + fprintf (get_machine_readable_channel ()) fs + let create_standard_options argspec ?anon_fun ?(key_opts = false) ?(machine_readable = false) usage_msg = (** Install an exit hook to check gc consistency for --debug-gc *) let set_debug_gc () = at_exit (fun () -> Gc.compact()) in + let parse_machine_readable = function + | None -> + machine_read...
2019 Jan 16
2
Re: [PATCH 2/5] mltools: create a new external_command_code
...+++++ > 2 files changed, 18 insertions(+), 12 deletions(-) > > diff --git a/common/mltools/tools_utils.ml b/common/mltools/tools_utils.ml > index 3b1554c5a..e6b2b5713 100644 > --- a/common/mltools/tools_utils.ml > +++ b/common/mltools/tools_utils.ml > @@ -338,7 +338,13 @@ let create_standard_options argspec ?anon_fun ?(key_opts = false) ?(machine_read > } > > (* Run an external command, slurp up the output as a list of lines. *) > -let external_command ?(echo_cmd = true) cmd = > +let rec external_command ?(echo_cmd = true) cmd = > + let lines, exitcode = external_c...
2018 Aug 21
4
[PATCH 0/2] RFC: add output selection for --machine-readable
Hi, this is a first approach (hence RFC, since it misses tests & documentation) in selecting the output for --machine-readable. The possible choices are: * --machine-readable: to stdout, like before * --machine-readable=file:name-of-file: to the specified file * --machine-readable=stream:stdout: explicitly to stdout * --machine-readable=stream:stderr: explicitly to stderr This makes it
2019 Jan 16
10
[PATCH 0/5] [RFC] builder: handle unavailable repos
In case a repository of virt-builder references files (e.g. the index) that cannot be downloaded (network issues, 404, etc) then virt-builder errors out on this situation. This is not a nice situation, from an user POV. This series does some refactoring to allow to better handle downloading failures, and handle the failures gracefully in virt-builder. RFC because I'm not yet too convinced
2018 Aug 23
0
[PATCH v2 2/2] OCaml tools: add output selection for --machine-readable
...functionality of the module Tools_utils. + * The tests are controlled by the test-machine_readable.sh script. + *) + +open Printf + +open Std_utils +open Tools_utils +open Getopt.OptionName + +let usage_msg = sprintf "%s: test the --machine-readable functionality" prog + +let opthandle = create_standard_options [] ~machine_readable:true usage_msg +let () = + Getopt.parse opthandle; + + print_endline "on-stdout"; + prerr_endline "on-stderr"; + + match machine_readable () with + | Some { pr } -> + pr "machine-readable\n" + | None -> () diff --git a/common/mlt...
2016 Jul 13
3
[PATCH v3 1/2] OCaml tools: add and use a Getopt module
..._options argspec in let args = ref [] in let anon_fun s = push_front s args in @@ -192,7 +184,8 @@ A short summary of the options is given below. For detailed help please read the man page virt-builder(1). ") prog in - Arg.parse argspec anon_fun usage_msg; + let opthandle = create_standard_options argspec ~anon_fun usage_msg in + Getopt.parse opthandle; (* Dereference options. *) let args = List.rev !args in diff --git a/customize/Makefile.am b/customize/Makefile.am index de3d7e0..f18e238 100644 --- a/customize/Makefile.am +++ b/customize/Makefile.am @@ -70,6 +70,7 @@ SOURCES_C...
2018 Aug 23
3
[PATCH v2 0/2] add output selection for --machine-readable
Hi, this adds the possibility to select the output for --machine-readable in OCaml tools. The possible choices are: * --machine-readable: to stdout, like before * --machine-readable=file:name-of-file: to the specified file * --machine-readable=stream:stdout: explicitly to stdout * --machine-readable=stream:stderr: explicitly to stderr This makes it possible to add additional output for
2019 Mar 28
0
[PATCH v2 3/4] common/mltools: allow fd for machine readable output
...in + | File f -> Some (open_out f) + | Fd fd -> + (* Note that Unix.file_descr is really just an int. *) + Some (Unix.out_channel_of_descr (Obj.magic fd)) in machine_readable_channel := chan ); !machine_readable_channel @@ -296,6 +300,11 @@ let create_standard_options argspec ?anon_fun ?(key_opts = false) ?(machine_read | n -> error (f_"invalid output stream for --machine-readable: %s") fmt in machine_readable_output := Channel chan + | "fd" -> + (try + machine_readable_output :=...
2019 Mar 22
0
[PATCH 3/4] common/mltools: allow fd for machine readable output
...-> None | Channel chan -> Some chan - | File f -> Some (open_out f) in + | File f -> Some (open_out f) + | Fd fd -> Some (c_out_channel_from_fd fd) in machine_readable_channel := chan ); !machine_readable_channel @@ -296,6 +299,11 @@ let create_standard_options argspec ?anon_fun ?(key_opts = false) ?(machine_read | n -> error (f_"invalid output stream for --machine-readable: %s") fmt in machine_readable_output := Channel chan + | "fd" -> + (try + machine_readable_output :=...
2018 Aug 20
1
[PATCH] common/mltools: getopt: add Getopt.OptString
...quot;string", set_optstr), "Set optional string"; ] let usage_msg = sprintf "%s: test the Getopt parser" prog +let print_optstring_value = function + | Unset -> "not set" + | NoValue -> "<none>" + | Value s -> s + let opthandle = create_standard_options argspec ~anon_fun usage_msg let () = Getopt.parse opthandle; @@ -66,4 +81,5 @@ let () = printf "clear_flag = %b\n" !clear_flag; printf "set_flag = %b\n" !set_flag; printf "set_int = %d\n" !si; - printf "set_string = %s\n" !ss + printf &quot...