Skip to content

Commit

Permalink
Merge pull request #399 from mtelvers/solver-timeout
Browse files Browse the repository at this point in the history
Use 0install solver
  • Loading branch information
mtelvers authored Dec 3, 2024
2 parents 619aac5 + 0442e06 commit 8bcc473
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 241 deletions.
22 changes: 7 additions & 15 deletions opam-ci-check/lib/opam_build.ml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ let cache ~variant =
Obuilder_spec.Cache.v "homebrew" ~target:"/Users/mac1000/Library/Caches/Homebrew" ]
let network = ["host"]

let opam_install ~variant ~opam_version ~pin ~lower_bounds ~with_tests ~revdep ~pkg =
let opam_install ~variant ~opam_version ~pin ~lower_bounds ~with_tests ~pkg =
let pkg_s = OpamPackage.to_string pkg in
let with_tests_opt = if with_tests then " --with-test" else "" in
let cache = cache ~variant in
Expand All @@ -23,13 +23,6 @@ let opam_install ~variant ~opam_version ~pin ~lower_bounds ~with_tests ~revdep ~
else
[]
) @
(if revdep || lower_bounds then
[
run "opam option solver=builtin-0install";
]
else
[]
) @
(if pin then
let version =
let idx = String.index pkg_s '.' + 1 in
Expand Down Expand Up @@ -122,10 +115,9 @@ let setup_repository ?(local=false) ~variant ~for_docker ~opam_version () =
Otherwise the "opam pin" after the "opam repository set-url" will fail (cannot find the new package for some reason) *)
run "%s -f %s/bin/opam-%s %s/bin/opam" ln prefix opam_version_str prefix ::
run ~network "opam init --reinit%s -ni" opamrc :: (* TODO: Remove ~network when https://github.com/ocurrent/ocaml-dockerfile/pull/132 is merged *)
run "uname -rs && opam exec -- ocaml -version && opam --version" ::
run "%sopam config report" (match opam_version with `V2_1 | `V2_2 | `V2_3 | `Dev -> "opam option solver=builtin-0install && " | `V2_0 -> "") ::
env "OPAMDOWNLOADJOBS" "1" :: (* Try to avoid github spam detection *)
env "OPAMERRLOGLEN" "0" :: (* Show the whole log if it fails *)
env "OPAMSOLVERTIMEOUT" "1000" :: (* Increase timeout. Poor mccs is doing its best *)
env "OPAMPRECISETRACKING" "1" :: (* Mitigate https://github.com/ocaml/opam/issues/3997 *)
env "CI" "true" :: env "OPAM_REPO_CI" "true" :: (* Advertise CI for test frameworks *)
[
Expand All @@ -146,19 +138,19 @@ let spec ?(local=false) ~for_docker ~opam_version ~base ~variant ~revdep ~lower_
let opam_install = opam_install ~variant ~opam_version in
let revdep = match revdep with
| None -> []
| Some revdep -> opam_install ~pin:false ~lower_bounds:false ~with_tests:false ~revdep:true ~pkg:revdep
| Some revdep -> opam_install ~pin:false ~lower_bounds:false ~with_tests:false ~pkg:revdep
and tests = match with_tests, revdep with
| true, None -> opam_install ~pin:false ~lower_bounds:false ~with_tests:true ~revdep:false ~pkg
| true, Some revdep -> opam_install ~pin:false ~lower_bounds:false ~with_tests:true ~revdep:true ~pkg:revdep
| true, None -> opam_install ~pin:false ~lower_bounds:false ~with_tests:true ~pkg
| true, Some revdep -> opam_install ~pin:false ~lower_bounds:false ~with_tests:true ~pkg:revdep
| false, _ -> []
and lower_bounds = match lower_bounds with
| true -> opam_install ~pin:false ~lower_bounds:true ~with_tests:false ~revdep:false ~pkg
| true -> opam_install ~pin:false ~lower_bounds:true ~with_tests:false ~pkg
| false -> []
in
Obuilder_spec.stage ~from:base (
set_personality ~variant
@ setup_repository ~local ~variant ~for_docker ~opam_version ()
@ opam_install ~pin:true ~lower_bounds:false ~with_tests:false ~revdep:false ~pkg
@ opam_install ~pin:true ~lower_bounds:false ~with_tests:false ~pkg
@ lower_bounds
@ revdep
@ tests
Expand Down
13 changes: 4 additions & 9 deletions opam-ci-check/test/build.t
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ Test the build command:
WORKDIR /home/opam
RUN sudo ln -f /usr/bin/opam-dev /usr/bin/opam
RUN opam init --reinit -ni
RUN uname -rs && opam exec -- ocaml -version && opam --version
RUN opam option solver=builtin-0install && opam config report
ENV OPAMDOWNLOADJOBS="1"
ENV OPAMERRLOGLEN="0"
ENV OPAMSOLVERTIMEOUT="1000"
ENV OPAMPRECISETRACKING="1"
ENV CI="true"
ENV OPAM_REPO_CI="true"
Expand Down Expand Up @@ -57,10 +56,9 @@ Test the build command:
WORKDIR /home/opam
RUN sudo ln -f /usr/bin/opam-dev /usr/bin/opam
RUN opam init --reinit -ni
RUN uname -rs && opam exec -- ocaml -version && opam --version
RUN opam option solver=builtin-0install && opam config report
ENV OPAMDOWNLOADJOBS="1"
ENV OPAMERRLOGLEN="0"
ENV OPAMSOLVERTIMEOUT="1000"
ENV OPAMPRECISETRACKING="1"
ENV CI="true"
ENV OPAM_REPO_CI="true"
Expand Down Expand Up @@ -92,10 +90,9 @@ Test the build command:
WORKDIR /home/opam
RUN sudo ln -f /usr/bin/opam-dev /usr/bin/opam
RUN opam init --reinit -ni
RUN uname -rs && opam exec -- ocaml -version && opam --version
RUN opam option solver=builtin-0install && opam config report
ENV OPAMDOWNLOADJOBS="1"
ENV OPAMERRLOGLEN="0"
ENV OPAMSOLVERTIMEOUT="1000"
ENV OPAMPRECISETRACKING="1"
ENV CI="true"
ENV OPAM_REPO_CI="true"
Expand All @@ -122,7 +119,6 @@ Test the build command:
ENV OPAMCRITERIA="+removed,+count[version-lag,solution]"
ENV OPAMFIXUPCRITERIA="+removed,+count[version-lag,solution]"
ENV OPAMUPGRADECRITERIA="+removed,+count[version-lag,solution]"
RUN opam option solver=builtin-0install
RUN opam reinstall conf-pkg-config.4; \
res=$?; \
test "$res" != 31 && exit "$res"; \
Expand All @@ -146,10 +142,9 @@ Test the build command:
WORKDIR /home/opam
RUN sudo ln -f /usr/bin/opam-dev /usr/bin/opam
RUN opam init --reinit -ni
RUN uname -rs && opam exec -- ocaml -version && opam --version
RUN opam option solver=builtin-0install && opam config report
ENV OPAMDOWNLOADJOBS="1"
ENV OPAMERRLOGLEN="0"
ENV OPAMSOLVERTIMEOUT="1000"
ENV OPAMPRECISETRACKING="1"
ENV CI="true"
ENV OPAM_REPO_CI="true"
Expand Down
Loading

0 comments on commit 8bcc473

Please sign in to comment.