RFC: allow recursive lookup of opam files for opam pin .#3174
RFC: allow recursive lookup of opam files for opam pin .#3174hnrgrgr wants to merge 5 commits intoocaml:masterfrom
opam pin .#3174Conversation
The semantics of this fields is to restrict the files copied from the directory `sources/<package>` to the directory `build/<package>`. A later patch might allow the `rsync` backend to only synchronize in `sources` the `subpath`. Another patch might allow a `VCS` backend not to rebuild a pinned package when the 'sources' were modified, but only outside of the 'subpath'.
|
Thanks! This sounds great :) For the recursive pin, I have a few questions and ideas of corner cases:
Not sure. For VC, we could add commands to check for changes in a specific dir, but that would be involved (the In any case, it's too late for merging this into 2.0.0, but I'm looking forward to merging it after the release :). Thanks! |
|
Also, for |
|
Something that crossed my mind, for |
When a source tree contains multiple package definitions, the current usage is to define every opam file in the project root. But `jbuilder` is also able to handle opam file in subdirectories (typically in a `vendors` subdirectory). It might useful to add the same flexibility in opam.
All those commands are based on `OpamAuxCommand.resolve_local_pinned`. The command now apply not only to all pinned packages to the exact path `<dir>`, but to package where `<path>/<subpath>' is below '<dir>'.
|
I just updated the PR:
Currently In both cases, it would make sense to detect the VC repo, I will have a look.
I believe my review was exhaustive, at least for what I have been able to track in the sources. From a user perspective, I tested
It looks like unpinning in
I made a small amendment in how this PR interacts with I also added a flag |
|
This looks great, thanks! Only thing missing, as you point out, could be a little more control on how/when
but what if Also, what do you do on NB: in Anyway, I am pin-pointing possible corner cases, but this is good! I'll be glad to merge after 2.0.0. |
|
Superseded by #3499 |
This prototype allows
opam pin .to pin opam files found in subdirectories.Rational
When a source tree contains multiple package definitions, the current usage is to define every opam file in the project root. But
jbuilderis also able to handle opam file in subdirectories (typically in avendorssubdirectory). It might useful to add the same flexibility in opam.Note: running a script that individually pin all subpackages, e.g. https://gitlab.com/tezos/tezos/blob/master/scripts/opam-pin.sh, would not allow to use
--kind=gitfor subdirectories.Proposed implementation
This prototype contains two patches:
The first patch extends
OpamFile.URLto add asubpathfield. When building such a package, the source will be fetched as usual, but then only the 'subpath' of the fetched source will be copied to the 'build_dir'. This field is only useful "VCS" backends, and not for the 'rsync' backend.The second patch implements a recursive lookup of opam files. Opam files found in subdirectories are pinned with a correct 'subpath'.
User interface
With this prototype implementation there is only two ways for using the new 'subpath' field: either commit the 'subpath' field in the opam repository, or use
opam pin ..A more complete CLI might add:
opam pin add tezos-base git+https://gitlab.com/tezos/tezos --subpath lib_baseopam pin . --recif we do not want to activate the recursive lookup by defaultopam update -u .only update/upgrade sources for development packages found in subdirectoriesopam upgrade . --installedonly upgrade installed package (the current behaviour is to propose installation of all the sub package)Note
After a thought, we might implement the 'recursive' lookup without relying on the new
subpathfield but this way we might more easily ignore updates that do not modify the 'subpath' of a given package.