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

Error-free opam root changes #4638

Merged
merged 20 commits into from
May 28, 2021
Merged

Error-free opam root changes #4638

merged 20 commits into from
May 28, 2021

Conversation

rjbou
Copy link
Collaborator

@rjbou rjbou commented Apr 20, 2021

Permit a non blocking call from older versions of opam binary or lib.

On files, it adds opam-root-version field in root config file to discriminate root version and opam file version. The field opam-version is the opam-file-format version of the file. In OpamFile modules, format_version field is set on some modules to specify the file format version (eg. new field), and opam_file_format the opam-file-format version. An internal OpamFile.Config.root_version permit to determine the current root version of the binary. it need to be bumped at each opam_file_format bump (regardless of the file), according opam binary version.
opam-root-version is checked for all states loading, and for most state files reading. Also for root format upgrade mechanism.
The check/printing on the opam-version field is updated too. It must be printed on all files, and it is checked that it will be printed (OpamFormat.opam_version).

On format upgrade, latest compatible hard upgrade is still 2.0beta5, but intermediate roots (from 2.1alpha's) are set as hard upgrade: all files with opam-version: 2.1 downgraded to 2.0.

On state files should no more use OpamFile to read them outside state loading, there is functions to safely read them in OpamStateConfig. It concerns config, switch-config, switch-state, and repos-config.

Fixes #4636

@rjbou rjbou added the PR: WIP Not for merge at this stage label Apr 20, 2021
@rjbou rjbou added this to the 2.1.0~rc milestone Apr 20, 2021
@rjbou
Copy link
Collaborator Author

rjbou commented May 5, 2021

  • Another file had it format version updated, switch-export
  • Add switch invariant inference in the format upgrade, or update the check. For the moment if an invariant is kept empty it is always recomputed.
  • Some renamings & messages polishing
  • doc, doc & doc

Copy link
Member

@dra27 dra27 left a comment

Choose a reason for hiding this comment

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

This is looking great, thanks! Various comments (sometimes on comments) and suggestions.

Do you have a "story" for being able to do this on 2.0 without API changes?

Makefile Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
src/client/opamCliMain.ml Outdated Show resolved Hide resolved
src/format/opamFile.ml Outdated Show resolved Hide resolved
src/format/opamFile.mli Outdated Show resolved Hide resolved
src/state/opamRepositoryState.ml Outdated Show resolved Hide resolved
src/state/opamRepositoryState.ml Outdated Show resolved Hide resolved
src/state/opamStateConfig.ml Outdated Show resolved Hide resolved
src/state/opamSwitchState.ml Outdated Show resolved Hide resolved
src/state/opamSwitchState.ml Outdated Show resolved Hide resolved
@rjbou rjbou removed the PR: WIP Not for merge at this stage label May 18, 2021
src/format/opamFile.ml Outdated Show resolved Hide resolved
@rjbou
Copy link
Collaborator Author

rjbou commented May 25, 2021

All green, all conversations resolved, some commits to squash and it's good to merge!

rjbou added 11 commits May 27, 2021 13:14
They provide reading function that don't error are reading, do no show/stop at erros (unless strict mode is enabled)
… light upgrade from 2.0, using `opam_root_version'
permit read only loading, with best effort on file reading.
This is handled by function in `OpamStateConfig' that permit to load
state files: config, switch-config, switch-state, and repos-config.
…t also add an internal virtual version `2.1~~previous' that is its value for older config files when the field is undefined
@rjbou rjbou merged commit d1b967a into ocaml:master May 28, 2021
@rjbou rjbou mentioned this pull request Jul 1, 2021
2 tasks
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.

Introduce opam-root-version
3 participants