Skip to content

Commit

Permalink
switch to digestif
Browse files Browse the repository at this point in the history
  • Loading branch information
zapashcanon committed Feb 2, 2024
1 parent a9f445f commit e2fbee1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
(graphics :dev)
(tiny_httpd :dev)
(ocamlformat :dev)
sha
digestif
xmlm
pyml
re2
Expand Down
2 changes: 1 addition & 1 deletion owi.opam
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ depends: [
"graphics" {dev}
"tiny_httpd" {dev}
"ocamlformat" {dev}
"sha"
"digestif"
"xmlm"
"pyml"
"re2"
Expand Down
10 changes: 7 additions & 3 deletions src/cmd_c.ml
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,13 @@ let metadata ~workspace arch property files =
let file = String.concat " " (List.map Fpath.to_string files) in
let hash =
List.fold_left
(fun _ f -> Sha256.file (Fpath.to_string f))
Sha256.zero files
(fun context file ->
match Bos.OS.File.read file with
| Error (`Msg msg) -> failwith msg
| Ok str -> Digestif.SHA256.feed_string context str )
Digestif.SHA256.empty files
in
let hash = Digestif.SHA256.to_hex (Digestif.SHA256.get hash) in
let time = Unix.time () |> Unix.localtime in
let test_metadata =
`El
Expand All @@ -194,7 +198,7 @@ let metadata ~workspace arch property files =
; el "producer" "owic"
; el "specification" (String.trim spec)
; el "programfile" file
; el "programhash" (Sha256.to_hex hash)
; el "programhash" hash
; el "entryfunction" "main"
; el "architecture" (Format.sprintf "%dbit" arch)
; el "creationtime" (Format.asprintf "%a" pp_tm time)
Expand Down
2 changes: 1 addition & 1 deletion src/dune
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
(private_modules convert lexer menhir_parser spectest wutf8 tracing)
(libraries
bos
digestif
dune-site
encoding
hc
Expand All @@ -80,7 +81,6 @@
ppxlib
pyml
re2
sha
sedlex
uutf
runtime_events
Expand Down

0 comments on commit e2fbee1

Please sign in to comment.