From 3ebc8ed24583cd7d10c45330eaa43c18d4cfad14 Mon Sep 17 00:00:00 2001 From: Kate Date: Fri, 27 Jan 2023 13:23:28 +0000 Subject: [PATCH] Hackish workaround for https://github.com/ocurrent/obuilder/issues/77 --- lib/opam_build.ml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/opam_build.ml b/lib/opam_build.ml index a1a4d532..ec8e6b92 100644 --- a/lib/opam_build.ml +++ b/lib/opam_build.ml @@ -37,8 +37,16 @@ let opam_install ~variant ~opam_version ~pin ~lower_bounds ~with_tests ~pkg = [] ) @ [ run ~network "opam %s || true" (match opam_version with `V2_1 | `Dev -> "update --depexts" | `V2_0 -> "depext -u"); + ] @ + (if with_tests then [ + (* TODO: Remove this hack when https://github.com/ocurrent/obuilder/issues/77 is fixed *) + (* NOTE: This hack will fail for packages that have src: "git+https://..." *) + run ~cache ~network "((%sopam reinstall --with-test %s) > /dev/null 2>&1 ; echo \"exit code: $?\") || true" + (match opam_version with `V2_1 | `Dev -> "" | `V2_0 -> fmt "opam depext%s %s && " with_tests_opt pkg) pkg + ] else []) @ [ (* TODO: Replace by two calls to opam install + opam install -t using the OPAMDROPINSTALLEDPACKAGES feature *) - run ~cache ~network + (* NOTE: See above for the ~network:(if with_tests ...) hack *) + run ~cache ~network:(if with_tests then [] else network) {|%sopam reinstall%s %s; res=$?; test "$res" != 31 && exit "$res";