[Libguestfs] [PATCH] build: remove unreadable files after filtering
Richard W.M. Jones
rjones at redhat.com
Wed May 6 15:47:42 UTC 2015
On Mon, May 04, 2015 at 02:26:11PM +0200, Pino Toscano wrote:
> Move the removal of the files which don't exist or cannot be read, doing
> it after the filtering with excludefiles and hostfiles files.
> This avoid stat'ing files which will be excluded later anyway, hence
> reducing the I/O during a supermin build phase.
> ---
> src/build.ml | 32 ++++++++++++++++----------------
> 1 file changed, 16 insertions(+), 16 deletions(-)
>
> diff --git a/src/build.ml b/src/build.ml
> index b9b44ac..d7d0781 100644
> --- a/src/build.ml
> +++ b/src/build.ml
> @@ -125,22 +125,6 @@ let rec build debug
> if debug >= 1 then
> printf "supermin: build: %d files\n%!" (List.length files);
>
> - (* Remove files from the list which don't exist on the host or are
> - * unreadable to us.
> - *)
> - let files =
> - List.filter (
> - fun file ->
> - try ignore (lstat file.ft_source_path); true
> - with Unix_error _ ->
> - try ignore (lstat file.ft_path); true
> - with Unix_error _ -> false
> - ) files in
> -
> - if debug >= 1 then
> - printf "supermin: build: %d files, after removing unreadable files\n%!"
> - (List.length files);
> -
> (* Remove excludefiles from the list. Notes: (1) The current
> * implementation does not apply excludefiles to the base image. (2)
> * The current implementation does not apply excludefiles to the
> @@ -185,6 +169,22 @@ let rec build debug
> printf "supermin: build: %d files, after adding hostfiles\n%!"
> (List.length files);
>
> + (* Remove files from the list which don't exist on the host or are
> + * unreadable to us.
> + *)
> + let files =
> + List.filter (
> + fun file ->
> + try ignore (lstat file.ft_source_path); true
> + with Unix_error _ ->
> + try ignore (lstat file.ft_path); true
> + with Unix_error _ -> false
> + ) files in
> +
> + if debug >= 1 then
> + printf "supermin: build: %d files, after removing unreadable files\n%!"
> + (List.length files);
> +
> (* Difficult to explain what this does. See comment below. *)
> let files = munge files in
ACK. I have pushed this, thanks.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW
More information about the Libguestfs
mailing list