Create a new switch if not pre-installed#242
Conversation
yes that's a bit annoying. One of the great thing about the current behavior is that the failure mode is pretty clear. I am wondering if we should try to compare version in bash and do the switch only if that's below 4.03 (I am not sure I really like that this solution either). |
|
I'm not super fond of making those scripts more complex but as you pointed out the current error is better than silently falling back to switch creation unexpectedly! If you want to add a check in the script I think it would need to be more accurate than < 4.03 since I guess some people could be interested in having variants (as in non base-compilers) in their CI. Maybe adding a Your call! |
|
Same here, I'm not super fond of making the script more complex. Maybe the right solution is to control that behavior via an |
|
One advantage of your patch is that we can now specify a particular patch release (e.g. OCAML_VERSION=4.07.0). How about just printing something to stdout to indicate that a custom switch is getting compiled with a note that things might be faster if the final .0 is dropped? That would be a simple change and not add yet another environment dial into the mix. |
|
Ok let's merge this, we can see if we can make things better later. |
CHANGES: * Set variables before installing ppas (ocaml/ocaml-ci-scripts#234, @samoht) * Fix name of system switch when using INSTALL_LOCAL=1 (ocaml/ocaml-ci-scripts#236, @samoht) * Fix .travis-docker.sh when opam 2 is used (ocaml/ocaml-ci-scripts#237, @gaborigloi) * Add support for BASE_REMOTE_BRANCH (ocaml/ocaml-ci-scripts#239, @lindig) * Create a new switch if not pre-installed (ocaml/ocaml-ci-scripts#242, @NathanReb) * Better lint for opam 1.2 files when using opam2 (ocaml/ocaml-ci-scripts#245, @samoht)
This adds a fallback when
opam switch OCAML_VERSIONfails, attempting to create the corresponding switch, addressing #241.This isn't perfect though since the pre-installed switches' names differ from the compiler names. One might wonder why their CI builds takes ages and have trouble figuring out it's because their
.travis.ymlcontains- OCAML_VERSION=4.07.0instead of- OCAML_VERSION=4.07.Not sure what should be done to avoid this!