This commit is contained in:
parent
45648f15c1
commit
435c1174bc
2 changed files with 27 additions and 21 deletions
|
|
@ -5,7 +5,7 @@
|
|||
(libraries cmdliner bos fmt mirage-crypto ptime mte vif))
|
||||
|
||||
(executable
|
||||
(public_name gen_signatures_registry)
|
||||
(name gen_signatures_registry)
|
||||
(modules gen_signatures_registry)
|
||||
(public_name gen_taler_signatures)
|
||||
(name gen_taler_signatures)
|
||||
(modules gen_taler_signatures)
|
||||
(libraries angstrom bos fmt))
|
||||
|
|
|
|||
|
|
@ -51,12 +51,7 @@ module Recfile = struct
|
|||
let parse s = parse_string ~consume:All recfile s
|
||||
end
|
||||
|
||||
let url =
|
||||
"https://git-www.gnunet.org/gana.git/plain/gnunet-signatures/registry.rec"
|
||||
|
||||
let registry_file = "registry.rec"
|
||||
|
||||
let download () =
|
||||
let download ~output ~url =
|
||||
let open Bos in
|
||||
let res =
|
||||
OS.Cmd.run
|
||||
|
|
@ -65,7 +60,7 @@ let download () =
|
|||
% "--silent"
|
||||
% "--show-error"
|
||||
% "-o"
|
||||
% registry_file
|
||||
% output
|
||||
% "-X"
|
||||
% "GET"
|
||||
% url)
|
||||
|
|
@ -100,13 +95,7 @@ let parse_purposes records =
|
|||
| _ -> None)
|
||||
|> List.filter (fun v -> v.number >= 1000_l)
|
||||
|
||||
let () =
|
||||
download ();
|
||||
let content = read_file registry_file in
|
||||
match Recfile.parse content with
|
||||
| Error msg -> Fmt.failwith "Recfile parse error: %s" msg
|
||||
| Ok records ->
|
||||
let purposes = parse_purposes records in
|
||||
let print_module purposes =
|
||||
let header =
|
||||
{|(* This file was generated from the GANA database:
|
||||
https://git-www.gnunet.org/gana.git/tree/gnunet-signatures/registry.rec *)|}
|
||||
|
|
@ -116,3 +105,20 @@ let () =
|
|||
in
|
||||
Fmt.pr "%s\n\n%a@." header (Fmt.list ~sep:Fmt.nop pp) purposes;
|
||||
()
|
||||
|
||||
let url =
|
||||
"https://git-www.gnunet.org/gana.git/plain/gnunet-signatures/registry.rec"
|
||||
|
||||
(* tmp file *)
|
||||
let registry_file = "registry.rec"
|
||||
|
||||
let main () =
|
||||
download ~output:registry_file ~url;
|
||||
let content = read_file registry_file in
|
||||
match Recfile.parse content with
|
||||
| Error msg -> Fmt.failwith "Recfile parse error: %s" msg
|
||||
| Ok records ->
|
||||
print_module (parse_purposes records);
|
||||
()
|
||||
|
||||
let () = main ()
|
||||
Loading…
Add table
Add a link
Reference in a new issue