Upgrade to solo5-elftool 0.4.0

This commit is contained in:
Reynir Björnsson 2025-02-04 20:12:42 +01:00
parent d6c0cd12ac
commit b5470e7866
2 changed files with 18 additions and 13 deletions

View file

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

View file

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