-
Notifications
You must be signed in to change notification settings - Fork 374
OpamFile.OPAM API: No longer assume that internal opam repositories are directories #6679
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
a1a2d47 to
4d6c1c5
Compare
| === install 1 package | ||
| - install lot-of-files ~dev | ||
| SYSTEM mkdir ${BASEDIR}/OPAM/inst/.opam-switch/build/lot-of-files.~dev | ||
| SYSTEM copy ${BASEDIR}/OPAM/repo/default/packages/lot-of-files/lot-of-files.~dev/files/lot-of-files.install.in -> ${BASEDIR}/OPAM/inst/.opam-switch/build/lot-of-files.~dev/lot-of-files.install.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.
To investigate...
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.
It's simply that OpamSystem.write has no log
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.
maybe todo: have a look why action-disk test is not affected
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.
Added logging for read & write. To extract in its own PR
tests/reftests/extrafile.test
Outdated
| <default>/no-checksum.1: Errors. | ||
| error 3: File format error in 'extra-files' at line 11, column 2: expected [file checksum] | ||
| # Return code 1 # | ||
| <default>/no-checksum.1: Passed. |
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 change is due to the fact that now we take the opam file from repo state instead of the plain file from opam internal repo copy. Stored opam file in repo state removes the mismatching extra files, so there is no longer the error (extra-files field removed).
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.
We may change --package behaviour to be used only with pinned package...
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.
From dev meeting: we decided to put back the mechanism to retrieve the file from repo root. At first, we wanted to avoid it because extracting a file from a tarred repository is a consuming operation.
For the usages that are done in this PR (opam lint --package and opam pin with version and / or edit), it is conceivable to have this consuming operation as they are not operation that are done often, and it permit to keep the same behaviour (respectively linting without preprocessing and preserve format of opam files).
src/state/opamRepositoryState.ml
Outdated
| let get_repo_root rt repo = | ||
| get_root_raw rt.repos_global.root rt.repos_tmp repo.repo_name | ||
|
|
||
| let get_repo_files rt name dir = |
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.
| let get_repo_files rt name dir = | |
| (* We need to keep the argument as string to be able to have the | |
| non resolved path to concatenate. *) | |
| let get_repo_files rt name dir = |
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.
or use a basename
|
|
||
| (** Finds back the location of the opam file this package definition was loaded | ||
| from *) | ||
| val orig_opam_file: |
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.
renamed and moved to switch state to fit its new specification
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.
kept, cf #6679 (comment)
4d6c1c5 to
40d71f6
Compare
src/client/opamCommands.ml
Outdated
| let opam = OpamSwitchState.opam st nv in | ||
| match OpamPinned.orig_opam_file st (OpamPackage.name nv) opam with | ||
| | None -> raise Not_found | ||
| match OpamSwitchState.overlay_opam_file st name with |
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.
Something feels a bit off with the use of overlay_opam_file vs. the previous orig_opam_file, in here and with its use via ?format_from. I think we should probably avoid breaking compatibility on this and instead do something like copying the file to a temporary directory, and simply remove the ability for orig_opam_file to fetch things from the repository and only fallback to overlay if the original file isn't accessible. It was in OpamPinned after all
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 will keep backward compat only for already pinned packages. Pinned package from repo won't have the format kept as now.
| === install 1 package | ||
| - install lot-of-files ~dev | ||
| SYSTEM mkdir ${BASEDIR}/OPAM/inst/.opam-switch/build/lot-of-files.~dev | ||
| SYSTEM copy ${BASEDIR}/OPAM/repo/default/packages/lot-of-files/lot-of-files.~dev/files/lot-of-files.install.in -> ${BASEDIR}/OPAM/inst/.opam-switch/build/lot-of-files.~dev/lot-of-files.install.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.
It's simply that OpamSystem.write has no log
| # Return code 31 # | ||
| ### opam source escape-good-md5 | ||
| Successfully extracted to ${BASEDIR}/escape-good-md5.1 | ||
| [WARNING] Some errors extracting to ${BASEDIR}/escape-good-md5.1: |
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.
todo
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.
Ok, in fact it resolves an error that we had 👍
8c913af to
ae70eeb
Compare
ae70eeb to
59ffd38
Compare
08edd0b to
6eb5032
Compare
6eb5032 to
7fd7117
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.
Nice 4 hands job :D
…re directories Co-authored-by: Raja Boujbel <[email protected]>
7fd7117 to
1c71f5e
Compare
Extracted from #6625
Queued on
To allow to change the type of repository from a directory to something else, we need some of the internal functions that expects to be dealing with a directory to be rearranged a little.
In this PR, we do so for
OpamFile.OPAM.get_extra_fileswhich currently takes a function returning a directory (repository root), to return instead the list of files and content that users of the function actually expect.