Fix error when reading solo5 manifest

Also simplify solo5 manifest code.
This commit is contained in:
Robur 2022-02-25 11:21:16 +00:00
parent 5f7e37fb4c
commit 9cf112a9ac
3 changed files with 4 additions and 10 deletions

View file

@ -256,10 +256,7 @@ let add_routes datadir configdir =
|> if_error "Error getting job build"
~log:(fun e -> Log.warn (fun m -> m "Error getting job build: %a" pp_error e))
>>= fun (build, main_binary, artifacts, same_input_same_output, different_input_same_output, same_input_different_output, latest, next, previous) ->
(match main_binary with
| Some main_binary -> Model.solo5_manifest datadir main_binary
| None -> Lwt_result.return None)
|> if_error "Error getting solo5 manifest" >>= fun solo5_manifest ->
let solo5_manifest = Option.bind main_binary (Model.solo5_manifest datadir) in
Views.Job_build.make
~name:job_name
~build

View file

@ -51,10 +51,8 @@ let build_artifacts build (module Db : CONN) =
List.map snd
let solo5_manifest datadir file =
try
let buf = Owee_buf.map_binary Fpath.(to_string (datadir // file.Builder_db.localpath)) in
Lwt.return (Solo5_elftool.query_manifest buf |> Result.map Option.some)
with Owee_buf.Invalid_format _ -> Lwt_result.return None
Solo5_elftool.query_manifest buf |> Result.to_option
let platforms_of_job id (module Db : CONN) =
Db.collect_list Builder_db.Build.get_platforms_for_job id

View file

@ -21,8 +21,7 @@ val build_artifact_data : Fpath.t -> Builder_db.file ->
val build_artifacts : [`build] Builder_db.id -> Caqti_lwt.connection ->
(Builder_db.file list, [> Caqti_error.call_or_retrieve ]) result Lwt.t
val solo5_manifest : Fpath.t -> Builder_db.file ->
(Solo5_elftool.mft option, [> `Msg of string ]) result Lwt.t
val solo5_manifest : Fpath.t -> Builder_db.file -> Solo5_elftool.mft option
val platforms_of_job : [`job] Builder_db.id -> Caqti_lwt.connection ->
(string list, [> Caqti_error.call_or_retrieve ]) result Lwt.t