Scripts: fix test chain reset script

This commit is contained in:
Benjamin Canou 2018-07-02 11:02:59 +02:00
parent 74732d7711
commit 61acb40784

View File

@ -14,6 +14,7 @@
#mod_use "../src/lib_stdlib/utils.ml";;
#mod_use "../src/lib_crypto/base58.ml";;
open Lwt.Infix;;
let prefix = "BLockGenesisGenesisGenesisGenesisGenesis"
let rec genesis () =
@ -30,8 +31,15 @@ let rec genesis () =
let genesis, date = genesis ()
let () =
Lwt_main.run (Lwt_io.lines_to_file "alphanet_version"
(Lwt_stream.of_list [date]))
Lwt_main.run @@
let stream = Lwt_io.lines_of_file "alphanet_version" in
Lwt_stream.to_list stream >>= function
| [] | _ :: _ :: _ -> failwith "bad alphanet_version file"
| [ line ] -> match String.split_on_char 'Z' line with
| [ _ ; branch ] ->
let contents = if String.trim branch = "" then date else date ^ branch in
Lwt_io.lines_to_file "alphanet_version" (Lwt_stream.of_list [ contents ])
| _ -> failwith "bad alphanet_version file"
let sed =
Format.sprintf
@ -47,8 +55,8 @@ let _ =
let sed =
Format.sprintf
"sed -i \
-e 's/name = \"TEZOS[^\"]*\" ;/name = \"TEZOS_%s\" ;/' \
"sed -E -i \
-e 's/name = \"(TEZOS[A_Z]+)[^\"]*\" ;/name = \"\\1%s\" ;/' \
../src/lib_shell/distributed_db_message.ml"
date