[Libguestfs] [PATCH v9 7/7] New tool: virt-builder-repository

Pino Toscano ptoscano at redhat.com
Wed Sep 20 12:16:48 UTC 2017


On Monday, 18 September 2017 17:53:52 CEST Cédric Bosdonnat wrote:
> virt-builder-repository allows users to easily create or update
> a virt-builder source repository out of disk images. The tool can
> be run in either interactive or automated mode.
> ---

Remember the Unicode quotes also in the pod documentation.

> +virt_builder_repository_CFLAGS = \
> +	-pthread \
> +	$(WARN_CFLAGS) $(WERROR_CFLAGS) \
> +	-Wno-unused-macros \
> +	$(LIBLZMA_CFLAGS) \

Most probably the lzma cflags are not needed.

> +  if res <> 0 then
> +    error (f_"i‘xz’ command failed");

Small typo.

> +let get_mime_type filepath =
> +  let file_cmd = "file --mime-type --brief " ^ (quote filepath) in
> +  match external_command file_cmd with
> +  | [] -> ""

If an empty output can be a valid output from file, then I'd say to
make this return None, and then act accordingly later on.

> +  | lines -> List.hd lines

This can be simplified:

  | line :: _ -> line

> +  let rec ask_arch guess =
> +    let arches = [ "x86_64"; "aarch64"; "armv7l"; "i686"; "ppc64"; "ppc64le"; "s390x" ] in
> +    match (ask (s_"Architecture: ") ~default:guess ~values:arches) with
> +    | None -> ask_arch guess
> +    | Some x ->
> +      if x = "" then
> +        ask_arch guess
> +      else
> +        x

Most probably this Some x match can be split in two cases:

  | Some "" -> ask_arch guess
  | Some x -> x

> +  if images == [] then (

== -> =.

> +  (* Generate entries for uncompressed images *)
> +  let images_entries = List.fold_right (
> +    fun filename acc ->
> +      let image_entry = process_image acc filename cmdline.repo tmprepo
> +                                      index cmdline.interactive cmdline.no_compression

Could you please wrap this long line?

> +    if shell_command cmd <> 0 then
> +      error (f_"failed to export GPG key %s") gpgkey;

" ... the GPG key ..."

-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20170920/eaa7937f/attachment.sig>


More information about the Libguestfs mailing list