Upgrade to solo5-elftool 0.4.0 #17

Merged
reynir merged 1 commit from solo5-elftool.0.4.0 into main 2025-02-05 14:57:47 +00:00
2 changed files with 18 additions and 13 deletions
Showing only changes of commit b5470e7866 - Show all commits

View file

@ -46,8 +46,8 @@ depends: [
"cmarkit" {>= "0.3.0"}
"tar" {>= "3.0.0"}
"tar-unix" {>= "3.0.0"}
"owee"
"solo5-elftool" {>= "0.3.0" & < "0.4.0"}
"cachet"
"solo5-elftool" {>= "0.4.0"}
"decompress" {>= "1.5.0"}
"digestif" {>= "1.2.0"}
"uuidm" {>= "0.9.9"}

View file

@ -59,17 +59,22 @@ let build_artifacts build (module Db : CONN) =
List.map snd
let solo5_manifest datadir file =
(* inlined from Owee_buf.map_binary *)
let path = Fpath.(to_string (datadir // artifact_path file)) in
let fd = Unix.openfile path [Unix.O_RDONLY] 0 in
let len = Unix.lseek fd 0 Unix.SEEK_END in
let buf =
Bigarray.array1_of_genarray
(Unix.map_file fd Bigarray.int8_unsigned
Bigarray.c_layout false [|len|]) in
Unix.close fd;
(* end of inlined code *)
Solo5_elftool.query_manifest buf |> Result.to_option
let cachet =
let path = Fpath.(to_string (datadir // artifact_path file)) in
let fd = Unix.openfile path [Unix.O_RDONLY] 0 in
let len = Unix.lseek fd 0 Unix.SEEK_END in
let buf =
Bigarray.array1_of_genarray
(Unix.map_file fd Bigarray.char
Bigarray.c_layout false [|len|]) in
Unix.close fd;
let map () ~pos len =
let len = min len (max 0 (Bigarray.Array1.dim buf - pos)) in
Bigarray.Array1.sub buf pos len
in
Cachet.make ~pagesize:8 ~map ()
in
Solo5_elftool.query_manifest cachet |> Result.to_option
let platforms_of_job id (module Db : CONN) =
Db.collect_list Builder_db.Build.get_platforms_for_job id