Skip to content
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

Allows in-source metadata to sit in opam/, and other fixes #3194

Merged
merged 5 commits into from Jan 26, 2018

Conversation

AltGr
Copy link
Member

@AltGr AltGr commented Jan 26, 2018

No description provided.

exported to the shell environment through `opam env` and
`~/.opam/opam-init/` scripts.
exported to the shell environment through `opam env` and `~/.opam/opam-init/`
scripts. Note that while it is guaranteed that dependents will see the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still a bit unclear to me. Specifically is opam env (+ user env at the moment) the environment in which builds happen on an opam install ? I.e. do all packages installed after the package that setenv:s see the environment update ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's unspecified. Actually, currently, in practice, both can happen, depending on wether the package doing the setenv: is modified during the same run or not (if it's untouched, you'll see the setenv:, otherwise not). Basically, builds happen with opam env as if all the packages that are modified during the run were removed, + the setenv:s of their dependencies.

Copy link
Contributor

@dbuenzli dbuenzli Jan 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's unspecified.

I don't think this is a good idea. Especially since for now opam still mixes the user environment in an opam install people might get different builds whether they eval $(opam env)'d or not before doing an opam install. I think that given how opam works now (no user environment isolation) the only reasonable semantics is that the setenv of all installed packages is available in subsequent installs; that way the results will be the same whether the user eval'd or not in subsequent opam installs.

This also enables to have "environment packages" that allow to setup environment without other packages necessarily being aware of them (these things would typically be installed a switch creation time or could be mandated to be so).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically, builds happen with opam env as if all the packages that are modified during the run were removed, + the setenv:s of their dependencies.

This actually doesn't depend on wether opam env was evaluated in the meantime, it will remain true even if it hasn't
(modulo the imperfection of reverting env changes if it has, but it's a separate issue)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand, opam install tries to fiddle with the user env beyond the addition of opam env ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More or less: opam install will internally revert the changes to the environment, then re-apply them according to the context.
This is very much what you want when running across switches:

eval $(opam env --switch foo)
opam install --switch bar somepkg

here we don't want the environment for the build of somepkg to be tainted by the setenv:s of unrelated switch foo. But this remains true even when in the same switch.

@AltGr AltGr merged commit f65cb8f into ocaml:master Jan 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants