On Saturday, 12 November 2016 16:37:49 CET Tomáš Golembiovský wrote:
> Signed-off-by: Tomáš Golembiovský <tgole...@redhat.com>
> ---
>  mllib/checksums.ml  | 11 +++++++++--
>  mllib/checksums.mli |  2 +-
>  2 files changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/mllib/checksums.ml b/mllib/checksums.ml
> index dfa8c3a..0907499 100644
> --- a/mllib/checksums.ml
> +++ b/mllib/checksums.ml
> @@ -45,7 +45,7 @@ let of_string csum_type csum_value =
>    | "sha512" -> SHA512 csum_value
>    | _ -> invalid_arg csum_type
>  
> -let verify_checksum csum filename =
> +let verify_checksum csum ?(tar) filename =

Round parenthesis are not needed here, ?tar works fine as well.

>    let prog, csum_ref =
>      match csum with
>      | SHA1 c -> "sha1sum", c
> @@ -53,7 +53,14 @@ let verify_checksum csum filename =
>      | SHA512 c -> "sha512sum", c
>    in
>  
> -  let cmd = sprintf "%s %s" prog (Filename.quote filename) in
> +  let cmd =
> +    match tar with
> +    | None ->
> +      sprintf "%s %s" prog (Filename.quote filename)
> +    | Some tar ->
> +      sprintf "tar xOf %s %s | %s"
> +        (Filename.quote tar) (Filename.quote filename) prog

This assumes the tar is uncompressed -- not a big issue, but I'd note
that down in the API doc in the .mli.

With the two small issues fixed, this LGTM.

Thanks,
-- 
Pino Toscano

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs

Reply via email to