-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Robust build infrastructure #1185
Conversation
This patch makes the build infrastructure for Links more robust. Previously, the build infrastructure would assume that it is running in an environment populated by OPAM. This assumption is too optimistic; for example a Docker container will give you a blank environment by default. To make it easier to install Links in such environments we now prefix dune build commands with `opam exec`. This command resolves the installation directory of dune and makes sure it is invoked with a suitable environment. Furthermore, the `gen_linkspath.exe` install helper would only test whether Links is being built by OPAM, and if that was not the case then it would assume Links was being built from sources in a local checkout of the git repository. This assumption is a tad optimistic too. So now, if we cannot detect either an OPAM installation or the git repository, then we fall back to a best effort guess based off the current working directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Tested successfully in a docker container.
I don't quite understand the need for |
That's correct. It is quite annoying having to do this all the time in, say, a Docker container. |
@thwfhk you can merge this PR when you have a minute (remember to choose the strategy "squash and merge"). |
I can expand a little upon what I said. This PR ought to remove some of the friction that you would otherwise experience when wanting to package Links as an artifact for a artifact evaluation submission. The build infrastructure is more portable as a result of this PR. |
I think @thwfhk is correct. This PR solved the issue with Docker containers, I had simply forgotten about it! |
This patch makes the build infrastructure for Links more robust. Previously, the build infrastructure would assume that it is running in an environment populated by OPAM. This assumption is too optimistic; for example a Docker container will give you a blank environment by default. To make it easier to install Links in such environments we now prefix dune build commands with
opam exec
. This command resolves the installation directory of dune and makes sure it is invoked with a suitable environment.Furthermore, the
gen_linkspath.exe
install helper would only test whether Links is being built by OPAM, and if that was not the case then it would assume Links was being built from sources in a local checkout of the git repository. This assumption is a tad optimistic too. So now, if we cannot detect either an OPAM installation or the git repository, then we fall back to a best effort guess based off the current working directory.