diff --git a/mirage/unikernel.ml b/mirage/unikernel.ml index 415024b..a8f5e06 100644 --- a/mirage/unikernel.ml +++ b/mirage/unikernel.ml @@ -103,6 +103,8 @@ module Make let parse_errors = ref SM.empty + let reset_parse_errors () = parse_errors := SM.empty + let add_parse_error filename error = parse_errors := SM.add filename error !parse_errors @@ -188,6 +190,8 @@ module Make let failed_downloads = ref SM.empty + let reset_failed_downloads () = failed_downloads := SM.empty + let add_failed url ts reason = remove_active url; failed_downloads := SM.add url (ts, reason) !failed_downloads @@ -214,6 +218,21 @@ module Make | `Bad_response _ -> `Bad_response | `Mimic _ -> `Mimic + let compare_failed_key a b = match a, b with + | `Write_error, `Write_error -> 0 + | `Write_error, _ -> -1 + | _, `Write_error -> 1 + | `Swap, `Swap -> 0 + | `Swap, _ -> -1 + | _, `Swap -> 1 + | `Bad_checksum, `Bad_checksum -> 0 + | `Bad_checksum, _ -> -1 + | _, `Bad_checksum -> 1 + | `Bad_response, `Bad_response -> 0 + | `Bad_response, _ -> -1 + | _, `Bad_response -> 1 + | `Mimic, `Mimic -> 0 + let pp_key ppf = function | `Write_error -> Fmt.pf ppf "Write error" | `Swap -> Fmt.pf ppf "Swap error" @@ -669,6 +688,7 @@ stamp: %S modified git_kv >>= fun modified -> Logs.info (fun m -> m "git: %s" commit_id); let repo = repo remote commit_id in + reset_parse_errors (); Tarball.of_git repo git_kv >|= fun (index, urls) -> t.commit_id <- commit_id ; t.modified <- modified ; @@ -719,6 +739,7 @@ stamp: %S let content = SM.bindings !failed_downloads |> group_by |> + List.sort (fun (a, _) (b, _) -> compare_failed_key a b) |> List.map (fun (key, els) -> let header = Fmt.str "