Fix build of builder-web with more recent packages:

Cstruct.copy is deprecated
Mirage_crypto_rng_unix.initialize requires the RNG module as paramater (since mirage-crypto-rng 0.11.0)
Lwt_result.catch takes a function (unit -> 'a Lwt.t) since lwt 5.7.0
This commit is contained in:
Hannes Mehnert 2023-08-25 10:09:21 +02:00
parent 61575c0f79
commit 6f30d5d144
5 changed files with 7 additions and 7 deletions

View file

@ -892,7 +892,7 @@ let default_cmd, default_info =
Cmd.info ~doc "builder-db"
let () =
Mirage_crypto_rng_unix.initialize ();
Mirage_crypto_rng_unix.initialize (module Mirage_crypto_rng.Fortuna);
Cmdliner.Cmd.group
~default:default_cmd default_info
[ help_cmd; migrate_cmd;

View file

@ -22,12 +22,12 @@ depends: [
"cstruct" {>= "6.0.0"}
"bos"
"hex"
"lwt" {>= "5.6.0"}
"lwt" {>= "5.7.0"}
"caqti" {>= "1.8.0"}
"caqti-lwt"
"caqti-driver-sqlite3"
"pbkdf"
"mirage-crypto-rng"
"mirage-crypto-rng" {>= "0.11.0"}
"scrypt-kdf"
"opam-core"
"opam-format" {>= "2.1.0"}

View file

@ -247,7 +247,7 @@ module Viz_aux = struct
|> Lwt.return
|> if_error "Error finding a version of the requested visualization")
>>= fun viz_path ->
Lwt_result.catch (
Lwt_result.catch (fun () ->
Lwt_io.with_file ~mode:Lwt_io.Input
(Fpath.to_string viz_path)
Lwt_io.read

View file

@ -15,7 +15,7 @@ module Writer = struct
| `Await gz -> state.gz <- gz ; Lwt.return_unit
| `Flush gz ->
let max = Cstruct.length oc - Gz.Def.dst_rem gz in
let str = Cstruct.copy oc 0 max in
let str = Cstruct.to_string ~len:max oc in
Dream.write stream str >>= fun () ->
let { Cstruct.buffer; off= cs_off; len= cs_len; } = oc in
until_await (Gz.Def.dst gz buffer cs_off cs_len)
@ -76,7 +76,7 @@ let targz_response datadir finish (files : Builder_db.file list) (stream : Dream
| `Await _gz -> assert false
| `Flush gz | `End gz as flush_or_end ->
let max = Cstruct.length state.oc - Gz.Def.dst_rem gz in
let str = Cstruct.copy state.oc 0 max in
let str = Cstruct.to_string ~len:max state.oc in
Dream.write stream str >>= fun () -> match flush_or_end with
| `Flush gz ->
let { Cstruct.buffer; off= cs_off; len= cs_len; } = state.oc in

View file

@ -3,7 +3,7 @@ let ( >>| ) x f = Result.map f x
module type CONN = Caqti_blocking.CONNECTION
let () = Mirage_crypto_rng_unix.initialize ()
let () = Mirage_crypto_rng_unix.initialize (module Mirage_crypto_rng.Fortuna)
let iter f xs = List.fold_left (fun r x -> r >>= fun () -> f x) (Ok ()) xs
let get_opt message = function