From f0fc310fe424d5657f416a7fd1c908cb4590e8e9 Mon Sep 17 00:00:00 2001 From: ยท๐‘‘๐‘ด๐‘•๐‘‘๐‘ฉ๐‘ค Date: Wed, 31 Dec 2025 14:21:34 +0000 Subject: Prefetch: File+Archive stdout result into module --- lib/input_foreman.ml | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'lib/input_foreman.ml') diff --git a/lib/input_foreman.ml b/lib/input_foreman.ml index ed6374a..4b8b3f1 100644 --- a/lib/input_foreman.ml +++ b/lib/input_foreman.ml @@ -295,14 +295,13 @@ let prefetch ~env ~proc_mgr ~name () : (unit, error) result = | Ok stdout -> begin Logs.debug (fun m -> m "Command output: %s" stdout); - match String.split_on_char '\n' (String.trim stdout) with - | hash :: path :: _ when Option.is_some (Eio.Path.native (Eio.Path.(Eio.Stdenv.fs env / path))) -> + match Prefetch.File.of_stdout ~env stdout with + | None -> Error (`Bad_output (method', stdout)) + | Some {path; hash_value} -> Ok ( - {input with hash = {input.hash with value = Some hash}}, + {input with hash = {input.hash with value = Some hash_value}}, path ) - | _ -> - Error (`Bad_output (method', stdout)) end | Error err -> Error err @@ -326,14 +325,13 @@ let prefetch ~env ~proc_mgr ~name () : (unit, error) result = | Ok stdout -> begin Logs.debug (fun m -> m "Command output: %s" stdout); - match String.split_on_char '\n' (String.trim stdout) with - | hash :: path :: _ when Option.is_some (Eio.Path.native (Eio.Path.(Eio.Stdenv.fs env / path))) -> + match Prefetch.Archive.of_stdout ~env stdout with + | None -> Error (`Bad_output (method', stdout)) + | Some {path; hash_value} -> Ok ( - {input with hash = {input.hash with value = Some hash}}, + {input with hash = {input.hash with value = Some hash_value}}, path ) - | _ -> - Error (`Bad_output (method', stdout)) end | Error err -> Error err -- cgit v1.2.3