Skip to content

Commit

Permalink
builder: add format=FMT in repository .conf files
Browse files Browse the repository at this point in the history
First step in allow different formats for indexes of images, aside the
current one.

The only accepted value is "native".
  • Loading branch information
ptoscano committed Jul 28, 2015
1 parent 6c9ea04 commit a1a1e8e
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 1 deletion.
5 changes: 4 additions & 1 deletion builder/builder.ml
Expand Up @@ -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
Expand All @@ -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
Expand Down
16 changes: 16 additions & 0 deletions builder/sources.ml
Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions builder/sources.mli
Expand Up @@ -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
16 changes: 16 additions & 0 deletions builder/virt-builder.pod
Expand Up @@ -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
Expand Down

0 comments on commit a1a1e8e

Please sign in to comment.