builder: use Sigchecker.gpgkey_type for the fingerprint

Use Sigchecker.gpgkey_type instead of just string as type in the
sources list; adapt the listing code (and its expected output) to that.

No behaviour change which eases a bit the addition of new sources with
other key types.
This commit is contained in:
Pino Toscano
2014-02-25 17:29:07 +01:00
committed by Richard W.M. Jones
parent c09f5bbc70
commit ad38e68c34
4 changed files with 26 additions and 11 deletions

View File

@@ -136,13 +136,16 @@ let main () =
(* Download the sources. *)
let downloader = Downloader.create ~debug ~curl ~cache in
let sources = List.map (
fun (source, fingerprint) ->
source, Sigchecker.Fingerprint fingerprint
) sources in
let index : Index_parser.index =
List.concat (
List.map (
fun (source, fingerprint) ->
fun (source, key) ->
let sigchecker =
Sigchecker.create ~debug ~gpg ~check_signature
~gpgkey:(Sigchecker.Fingerprint fingerprint) in
Sigchecker.create ~debug ~gpg ~check_signature ~gpgkey:key in
Index_parser.get_index ~prog ~debug ~downloader ~sigchecker source
) sources
) in

View File

@@ -65,9 +65,15 @@ and list_entries_long ~sources index =
| Some locale -> split_locale locale in
List.iter (
fun (source, fingerprint) ->
fun (source, key) ->
printf (f_"Source URI: %s\n") source;
printf (f_"Fingerprint: %s\n") fingerprint;
(match key with
| Sigchecker.No_Key -> ()
| Sigchecker.Fingerprint fp ->
printf (f_"Fingerprint: %s\n") fp;
| Sigchecker.KeyFile kf ->
printf (f_"Key: %s\n") kf;
);
printf "\n"
) sources;
@@ -160,10 +166,16 @@ and list_entries_json ~sources index =
printf " \"version\": %d,\n" 1;
printf " \"sources\": [\n";
iteri (
fun i (source, fingerprint) ->
fun i (source, key) ->
printf " {\n";
printf " \"uri\": \"%s\",\n" source;
printf " \"fingerprint\": \"%s\"\n" fingerprint;
(match key with
| Sigchecker.No_Key -> ()
| Sigchecker.Fingerprint fp ->
printf " \"fingerprint\": \"%s\",\n" fp;
| Sigchecker.KeyFile kf ->
printf " \"key\": \"%s\",\n" kf;
);
printf " \"uri\": \"%s\"\n" source;
printf " }%s\n" (trailing_comma i (List.length sources))
) sources;
printf " ],\n";

View File

@@ -16,4 +16,4 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
val list_entries : list_format:([ `Short | `Long | `Json ]) -> sources:(string * string) list -> Index_parser.index -> unit
val list_entries : list_format:([ `Short | `Long | `Json ]) -> sources:(string * Sigchecker.gpgkey_type) list -> Index_parser.index -> unit

View File

@@ -117,8 +117,8 @@ if [ "$json_list" != "{
\"version\": 1,
\"sources\": [
{
\"uri\": \"$VIRT_BUILDER_SOURCE\",
\"fingerprint\": \"F777 4FB1 AD07 4A7E 8C87 67EA 9173 8F73 E1B7 68A0\"
\"fingerprint\": \"F777 4FB1 AD07 4A7E 8C87 67EA 9173 8F73 E1B7 68A0\",
\"uri\": \"$VIRT_BUILDER_SOURCE\"
}
],
\"templates\": [