Include extra-files in switch export if full is provided, on import create an overlay directory with the file contents#4040
Conversation
cfaae0d to
4078ad8
Compare
rjbou
left a comment
There was a problem hiding this comment.
Thanks for the PR!
Indeed, keep extra files files permits to be sure to keep consistency between opam file & rest of the package.
On base64, opam-solver has in its dependencies extlib, so an base64 lib is already available. You need to add the dependency for opam-client in the dune & opam file.
To be more concise in the export file, I tend more to base64 encoding.
|
Also, I would change the title to "Switch export and import: include extra_files in embedded opams" or something like that. To include all installed opam file, there is the |
|
thanks for the review, and the suggestion for the title. I managed (let's see what CI thinks) to use the extlib base64, and renamed the fields. |
|
Thanks... indeed that is something that was missing, but I couldn't find a satisfying way to do it. I must say that I am not really convinced by the choice of Here are a few options I could think of (this is to open discussions, I am not sure about the best design for this...):
What do you think ? |
|
I'd first strive for a solution to limit the extra-files embedding for import and export. I'm keen to get to a state where an I initially went for a
that sounds good to me. Unfortunately I don't know the opam codebase well enough to implement this. would you be up for helping out? :) |
b6cc077 to
0e953f7
Compare
|
To further add to the discussion, I added preliminary functionality which rewrites git urls by specific commits. This is crucial for reproducibility. It makes me wonder where/how this "import/export" is used at the moment, or rather whether the changes I want for reproducibility should be hidden behind optional arguments or maybe even a different code path. Another change (this time in orb) cleans up the environment before proceeding further. Opam already at initialisation time captures the environment, that's why I needed to do it before the opam library is loaded somehow. It feels a bit clunky. I'm interested what you think about making the minimizing the environment for opam a default? I.e. is there a reason to not do that? only having |
|
For the last solution, there are several steps:
You can pick the two first steps in my repo, branch |
0e953f7 to
2d53cc4
Compare
|
I did the steps asked for, apart from " on |
freeze is provided, on import create an overlay directory with the file contents
rjbou
left a comment
There was a problem hiding this comment.
Thanks for this rewriting. Some comments, & I still need to test the PR.
|
For the |
freeze is provided, on import create an overlay directory with the file contentsfull is provided, on import create an overlay directory with the file contents
|
hi, thanks to @rjbou for refactoring, this works fine for me -- best be squashed and read as a single commit. It implements the top approach suggested by @AltGr in #4040 (comment)
About using Previously (before my last commit), each Please let me know what you think, and how to progress. I'd be happy to get this merged before 2.1 (/cc @AltGr). My testing of this PR was done as follows:
|
|
When I was talking about using the |
if extra_files is used, embed the files as base64 encoded data in the opam file (key x-hash, value the base64 encoded data) on import, lookup x-hash in opam file, base64 decode, and validate the hash OpamSwitchCommand.export: optionally pass switch
…vided, export an extra-files map
…dir is not available
Co-Authored-By: R. Boujbel <rjbou@ocamlpro.com>
Co-Authored-By: Louis Gesbert <louis.gesbert@ocamlpro.com>
b9db138 to
6ea4494
Compare
|
updated & rebased |
Why I'm doing this? I worked on reproducible builds and tooling thereof, where it is very convenient to use opam export and import for rebuilding the same artifact. The current situation that an export contains only a subset of packages (and thus an import may be incomplete or using package metadata from elsewhere) does not fit well into the reproducible builds concept.
This PR embeds https://github.com/mirage/ocaml-base64 into opam, I'm happy to remove this and use a dependency for that (but I didn't know how to add depedencies for opam) -- or use a hex encoding if prefered.//cc @rjbou