From 7471b5291ade1f82b0e598693e7de7cc5901e5d4 Mon Sep 17 00:00:00 2001 From: Sungkeun Cho Date: Mon, 8 Jun 2020 04:33:27 -0700 Subject: [PATCH] [infer] Reinstall some packages when ocamlfind cannot find it Reviewed By: ezgicicek Differential Revision: D21885300 fbshipit-source-id: 0730c90fd --- scripts/opam_utils.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/opam_utils.sh b/scripts/opam_utils.sh index 2e4ec1eeb..b9b11f1a2 100644 --- a/scripts/opam_utils.sh +++ b/scripts/opam_utils.sh @@ -68,3 +68,12 @@ opam_switch_create_if_needed () { } opam_require_version_2 + +# removes packages that cannot be found by ocamlfind +opam_remove_broken_package () { + local pkg="$1" + if ! ocamlfind query "${pkg}"; then + echo "ocamlfind cannot find ${pkg} package. Removing the package..." + opam remove "${pkg}" || true + fi +}