Skip to content

Commit

Permalink
Skip deleted packages in analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
punchagan committed Dec 16, 2024
1 parent beef79d commit 64494c8
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lib/analyse.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 "@[<v2>Results:@,%a@]" Yojson.Safe.(pretty_print ~std:true) (to_yojson r);
r
Expand Down

0 comments on commit 64494c8

Please sign in to comment.