provide deterministic output by using a Map.Make(String) instead of a hashtable#51
provide deterministic output by using a Map.Make(String) instead of a hashtable#51hannesm merged 1 commit intomirage:masterfrom
Conversation
… hashtable this is crucial for reproducible builds of unikernels that use crunch
|
//cc @mirage/core any objections to this change (including the API change to avoid global mutable state)? It'd be great to get this released soon |
|
LGTM What about the date? Does it still make sense to include it in the generated file? |
|
the date embedded into a crunched module is either it is nice to have a |
|
Definitely fine by me |
|
I checked the clients of In addition, it is noteworthy that if you'd used the API before and wanted to crunch multiple separate artifacts, you'd get the wrong output after the first one, since the hash tables were not cleared between runs. This PR fixes this as well (by making the state explicit). |
CHANGES: * Make crunch reproducible: use a Map.Make(String) instead of Hashtbl. Iterating over the former is guaranteed to be sorted over the keys. (mirage/ocaml-crunch#51 @hannesm) * The state (Map.t) is passed explicit to `scan_file`, `output_implementation` and `walk_directory_tree`. The value `empty` is provided to construct an empty `t`. (mirage/ocaml-crunch#51 @hannesm)
this is crucial for reproducible builds of unikernels that use crunch