summaryrefslogtreecommitdiff
path: root/lib/input_foreman.ml
diff options
context:
space:
mode:
authorยท๐‘‘๐‘ด๐‘•๐‘‘๐‘ฉ๐‘ค2025-12-31 14:21:34 +0000
committerยท๐‘‘๐‘ด๐‘•๐‘‘๐‘ฉ๐‘ค2025-12-31 14:21:34 +0000
commitf0fc310fe424d5657f416a7fd1c908cb4590e8e9 (patch)
treeb59c3e9122fc4bd32efe5520933a86e8a0742ede /lib/input_foreman.ml
parente8504548c82c5b9bb4ee5a797c6e73db5db41357 (diff)
downloadnixtaml-f0fc310fe424d5657f416a7fd1c908cb4590e8e9.tar
nixtaml-f0fc310fe424d5657f416a7fd1c908cb4590e8e9.tar.gz
nixtaml-f0fc310fe424d5657f416a7fd1c908cb4590e8e9.tar.bz2
nixtaml-f0fc310fe424d5657f416a7fd1c908cb4590e8e9.tar.lz
nixtaml-f0fc310fe424d5657f416a7fd1c908cb4590e8e9.tar.xz
nixtaml-f0fc310fe424d5657f416a7fd1c908cb4590e8e9.tar.zst
nixtaml-f0fc310fe424d5657f416a7fd1c908cb4590e8e9.zip
Prefetch: File+Archive stdout result into module
Diffstat (limited to 'lib/input_foreman.ml')
-rw-r--r--lib/input_foreman.ml18
1 files changed, 8 insertions, 10 deletions
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