[Libguestfs] [supermin PATCH 1/2] prepare: keep config_files available for longer
Richard W.M. Jones
rjones at redhat.com
Mon Dec 3 17:06:05 UTC 2018
On Mon, Dec 03, 2018 at 05:17:32PM +0100, Pino Toscano wrote:
> This is just refactoring, with no behaviour changes.
> ---
> src/mode_prepare.ml | 40 ++++++++++++++++++++--------------------
> 1 file changed, 20 insertions(+), 20 deletions(-)
>
> diff --git a/src/mode_prepare.ml b/src/mode_prepare.ml
> index 7c8221e..7759c58 100644
> --- a/src/mode_prepare.ml
> +++ b/src/mode_prepare.ml
> @@ -128,28 +128,28 @@ let prepare debug (copy_kernel, format, host_cpu,
> * be missing either from the package or from the filesystem (the
> * latter case with --use-installed).
> *)
> - let files_from =
> - let config_files =
> - List.map (
> - fun (_, files) ->
> - filter_map (
> - function
> - | { ft_config = true; ft_path = path } -> Some path
> - | { ft_config = false } -> None
> - ) files
> - ) packages in
> - let config_files = List.flatten config_files in
> -
> - let config_files = List.filter (
> - fun path ->
> - try close_in (open_in (dir // path)); true
> - with Sys_error _ -> false
> - ) config_files in
> + let config_files =
> + List.map (
> + fun (_, files) ->
> + filter_map (
> + function
> + | { ft_config = true; ft_path = path } -> Some path
> + | { ft_config = false } -> None
> + ) files
> + ) packages in
> + let config_files = List.flatten config_files in
> +
> + let config_files = List.filter (
> + fun path ->
> + try close_in (open_in (dir // path)); true
> + with Sys_error _ -> false
> + ) config_files in
>
> - if debug >= 1 then
> - printf "supermin: there are %d config files\n"
> - (List.length config_files);
> + if debug >= 1 then
> + printf "supermin: there are %d config files\n"
> + (List.length config_files);
>
> + let files_from =
> (* Put the list of config files into a file, for tar to read. *)
> let files_from = tmpdir // "files-from.txt" in
> let chan = open_out files_from in
Yes just a refactor, so ACK.
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 physical machines to virtual machines. Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v
More information about the Libguestfs
mailing list