[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libguestfs] [PATCH 01/10] builder: add format=FMT in repository .conf files



On Tue, Jul 28, 2015 at 11:24:41AM +0200, Pino Toscano wrote:
> First step in allow different formats for indexes of images, aside the
> current one.
> 
> The only accepted value is "native".
> ---
>  builder/builder.ml       |  5 ++++-
>  builder/sources.ml       | 16 ++++++++++++++++
>  builder/sources.mli      |  3 +++
>  builder/virt-builder.pod | 16 ++++++++++++++++
>  4 files changed, 39 insertions(+), 1 deletion(-)
> 
> diff --git a/builder/builder.ml b/builder/builder.ml
> index 1f618ad..d40ad8f 100644
> --- a/builder/builder.ml
> +++ b/builder/builder.ml
> @@ -161,6 +161,7 @@ let main () =
>          Sources.name = source; uri = source;
>          gpgkey = Utils.Fingerprint fingerprint;
>          proxy = Downloader.SystemProxy;
> +        format = Sources.FormatNative;
>        }
>    ) sources in
>    let sources = List.append sources repos in
> @@ -171,7 +172,9 @@ let main () =
>            let sigchecker =
>              Sigchecker.create ~gpg ~check_signature
>                ~gpgkey:source.Sources.gpgkey in
> -          Index_parser.get_index ~downloader ~sigchecker source
> +          match source.Sources.format with
> +          | Sources.FormatNative ->
> +            Index_parser.get_index ~downloader ~sigchecker source
>        ) sources
>      ) in
>    let index = remove_duplicates index in
> diff --git a/builder/sources.ml b/builder/sources.ml
> index b774762..b21e8fc 100644
> --- a/builder/sources.ml
> +++ b/builder/sources.ml
> @@ -27,7 +27,10 @@ type source = {
>    uri : string;
>    gpgkey : Utils.gpgkey_type;
>    proxy : Downloader.proxy_mode;
> +  format : source_format;
>  }
> +and source_format =
> +| FormatNative
>  
>  module StringSet = Set.Make (String)
>  
> @@ -75,8 +78,21 @@ let parse_conf file =
>              )
>            with
>              Not_found -> Downloader.SystemProxy in
> +        let format =
> +          try
> +            (match (List.assoc ("format", None) fields) with
> +            | "native" | "" -> FormatNative
> +            | fmt ->
> +              if verbose () then (
> +                eprintf (f_"%s: unknown repository type '%s' in %s, skipping it\n") prog fmt file;
> +              );
> +              invalid_arg fmt
> +            )
> +          with
> +            Not_found -> FormatNative in
>          {
>            name = n; uri = uri; gpgkey = gpgkey; proxy = proxy;
> +          format = format;
>          }
>        in
>        try (give_source n fields) :: acc
> diff --git a/builder/sources.mli b/builder/sources.mli
> index 2a94c54..e861310 100644
> --- a/builder/sources.mli
> +++ b/builder/sources.mli
> @@ -21,6 +21,9 @@ type source = {
>    uri : string;
>    gpgkey : Utils.gpgkey_type;
>    proxy : Downloader.proxy_mode;
> +  format : source_format;
>  }
> +and source_format =
> +| FormatNative
>  
>  val read_sources : unit -> source list
> diff --git a/builder/virt-builder.pod b/builder/virt-builder.pod
> index b4a341f..fc49d4d 100644
> --- a/builder/virt-builder.pod
> +++ b/builder/virt-builder.pod
> @@ -1169,6 +1169,22 @@ configuration.
>  If not present, the assumed value is to respect the proxy settings of the
>  system (i.e. as if B<system> would be specified).
>  
> +=item C<format=FORMAT>
> +
> +This optional field specifies the format of the repository.
> +The possible values are:
> +
> +=over 4
> +
> +=item B<native>
> +
> +The native format of the C<virt-builder> repository.  See also
> +L</Creating and signing the index file> below.
> +
> +=back
> +
> +If not present, the assumed value is C<native>.
> +
>  =back
>  
>  For serious virt-builder use, you may want to create your own
> -- 
> 2.1.0

ACK.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]