-
Notifications
You must be signed in to change notification settings - Fork 374
Make the computation of pkg:opamfile match its specification #6659
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
Conversation
91d7523 to
892ce35
Compare
|
Discussed yesterday during the dev meeting: The original PR that added this variable is #4402 (opam 2.1) and while we expect very few people to actually use it, One solution we can do is to change the definition of the variable to the following:
However this definition is close to the the current/previous behaviour and with #6625 in mind, we want to avoid reading in repositories (it takes a small but non-negligible amount of time to extract a file from the tar.gz file). Another solution could be to put the file (when missing) in TMPDIR from its definition already available in RAM. This could require some rework of the code by resolving the function to Yet another solution could be to move the opam file to the internal directory before any action (at the moment it is only put there after the install) and we could remove it if something wrong happened. To do that we would have to check whether we have any invariant somewhere in the code that relies on the "if a package is in the 'packages' directory, it is installed" invariant. |
892ce35 to
3bdd5df
Compare
|
In the end i've chose the second solution. I looked at the third solution but found it too complicated to implement and potentially dangerous as the invariant seems to be used |
3bdd5df to
3ebfe8f
Compare
32298da to
7cee6ab
Compare
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.
I think the is the good way to do it, especially if we don't have the invariant about packages/ directory.
I've added a test for internal variables in an opam file, that completes the one in var-option that is specific for opamfile.
Maybe the PR / changes need to be updated as we change the specification, so in it no longer making it match the old specification.
| ret (OpamPath.Switch.Overlay.opam st.switch_global.root st.switch (OpamPackage.name nv)) | ||
| else if OpamPackage.Set.mem nv st.packages then | ||
| let opam = OpamPackage.Map.find nv st.opams in | ||
| let temp_dir = OpamFilename.mk_tmp_dir () in |
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.
This temporary file won't be cleaned, but it is the wanted behaviour.
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.
In fact, there is no need to keep it, as it is only available during opam run.
7cee6ab to
3858ef5
Compare
| <><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> | ||
| -> installed dep.1 | ||
| Done. | ||
| ### opam install i-am-a-repo-pkg -vv | "${OPAMVERSION}" -> "++current++" | '[0-9a-z]{64}' -> '+hash+' | $MD5 -> +archive-hash+ | sed-cmd bash tar rsync | etc -> etc |
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.
| etc -> etc is a workaround to force installed-files lines to go into path rewriter. I don't know if it worth have the installed-files moved in the windows/unix test to avoid that or have the (more) exact output ?
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.
I think it's fine for now. Maybe we can think of something to handle path rewriting better in the future but it'll do for now
3858ef5 to
014e288
Compare
014e288 to
0483114
Compare
0483114 to
5fe4134
Compare
d59d121 to
729a4f5
Compare
729a4f5 to
9a19c0c
Compare
Extracted from #6625
Fixes #5346