[Libguestfs] [PATCH] v2v: linux: simplify RPM database cleaning

Richard W.M. Jones rjones at redhat.com
Thu Aug 18 12:15:40 UTC 2016


On Thu, Aug 18, 2016 at 02:02:43PM +0200, Pino Toscano wrote:
> Iterate on the array directly, instead of converting it to a list to do
> the same; also, avoid a temporary variable for it.
> ---
>  v2v/convert_linux.ml | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/v2v/convert_linux.ml b/v2v/convert_linux.ml
> index f9aa334..9941750 100644
> --- a/v2v/convert_linux.ml
> +++ b/v2v/convert_linux.ml
> @@ -85,9 +85,7 @@ let rec convert ~keep_serial_console (g : G.guestfs) inspect source rcaps =
>    Linux.augeas_init g;
>  
>    (* Clean RPM database.  This must be done early to avoid RHBZ#1143866. *)
> -  let dbfiles = g#glob_expand "/var/lib/rpm/__db.00?" in
> -  let dbfiles = Array.to_list dbfiles in
> -  List.iter g#rm_f dbfiles;
> +  Array.iter g#rm_f (g#glob_expand "/var/lib/rpm/__db.00?");

ACK.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/




More information about the Libguestfs mailing list