revise startup, address urls pointing to same sha256 and support mirrors (upstream and in opam file) #24

Merged
hannes merged 7 commits from startup into main 2024-11-20 10:38:22 +00:00
Showing only changes of commit a9c249ea86 - Show all commits

View file

@ -158,7 +158,8 @@ module Make
let url_csums, errs = Opam_file.extract_urls path data in let url_csums, errs = Opam_file.extract_urls path data in
List.iter (fun (`Msg msg) -> add_parse_error path msg) errs; List.iter (fun (`Msg msg) -> add_parse_error path msg) errs;
let upstream hm = let upstream hm =
List.fold_left (fun set (hash, hash_value) -> HM.fold
(fun hash hash_value set ->
List.fold_left (fun set cache_url -> List.fold_left (fun set cache_url ->
let url = let url =
cache_url ^ "/" ^ Archive_checksum.Hash.to_string hash ^ cache_url ^ "/" ^ Archive_checksum.Hash.to_string hash ^
@ -166,7 +167,7 @@ module Make
in in
SSet.add url set) SSet.add url set)
set (K.upstream_caches ())) set (K.upstream_caches ()))
SSet.empty (HM.bindings hm) hm SSet.empty
in in
List.fold_left (fun acc (url, csums, mirrors) -> List.fold_left (fun acc (url, csums, mirrors) ->
if HM.cardinal csums = 0 then if HM.cardinal csums = 0 then