From 64494c84e0c804315854272bdaf10f64b96a7bd6 Mon Sep 17 00:00:00 2001 From: Puneeth Chaganti Date: Mon, 16 Dec 2024 13:09:31 +0530 Subject: [PATCH] Skip deleted packages in analysis --- lib/analyse.ml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/analyse.ml b/lib/analyse.ml index 791fc1a3..e95221f5 100644 --- a/lib/analyse.ml +++ b/lib/analyse.ml @@ -244,10 +244,14 @@ module Analysis = struct let ( // ) = Fpath.( / ) in Fpath.v "packages" // name // (name^"."^version) // "opam" - let add_package_data ~dir (pkg, kind) packages = - match packages with - | Error _ as err -> Lwt.return err - | Ok packages -> + let add_package_data ~dir ~job (pkg, kind) packages = + match (packages, kind) with + | Error _ as err, _ -> + Lwt.return err + | Ok packages, Deleted -> + Current.Job.log job "Skipping deleted package: %s" (OpamPackage.to_string pkg); + Lwt.return_ok packages + | Ok packages, _ -> let open Lwt_result.Syntax in let path = Fpath.to_string (package_to_path pkg) in let* content = get_opam ~cwd:dir path |> Lwt_result.map_error (fun _ -> `Msg "impossible") in @@ -266,7 +270,7 @@ module Analysis = struct let open Lwt_result.Syntax in let* changed_pkgs = find_changed_packages ~job ~master dir in let pkg_bindings = OpamPackage.Map.bindings changed_pkgs in - let+ packages = Lwt_list.fold_right_s (add_package_data ~dir) pkg_bindings (Ok []) in + let+ packages = Lwt_list.fold_right_s (add_package_data ~job ~dir) pkg_bindings (Ok []) in let r = { packages } in Current.Job.log job "@[Results:@,%a@]" Yojson.Safe.(pretty_print ~std:true) (to_yojson r); r