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

opam switch import doesn't set invariant #5933

Open
Khady opened this issue Apr 24, 2024 · 6 comments
Open

opam switch import doesn't set invariant #5933

Khady opened this issue Apr 24, 2024 · 6 comments
Assignees

Comments

@Khady
Copy link
Contributor

Khady commented Apr 24, 2024

tested with opam 2.1.2, I don't know what's the status with opam 2.2

I have an export file which contains

compiler: ["ahrefs-setup.git" "ocaml-base-compiler.4.14.0"]

I believe that it corresponds to the invariant of the switch, but I might be wrong.

If I do opam sw import --sw=. sw.export and opam sw invariant it appears that my switch has no invariant set.

I have to do opam sw import --sw=. sw.export --packages=ahrefs-setup,ocaml-base-compiler.4.14.0 to get things setup as expected.

@kit-ty-kate
Copy link
Member

I confirm, this is still the case with opam 2.2

@rjbou
Copy link
Collaborator

rjbou commented May 6, 2024

Are you importing in a switch that already exist ?

@kit-ty-kate
Copy link
Member

yes, but in any case it should be done. One thing that's also broken is that exporting a switch doesn't export the invariant, only the "compiler packages" so exporting/importing does result in the same invariant.

@rjbou
Copy link
Collaborator

rjbou commented May 6, 2024

The current workflow is to not update the invariant when the switch already exists. The idea behind is if the switch already exists, user already set the invariant. Imported switch will then result on pinning and trying to install mentioned packages.
We could change that behaviour, but carefully as it will affect user switch, by asking for confirmation for example.

In the case where the switch doesn't exist, yes, the invariant should be the same than the previous switch. As the invariant is inferred, we need to add the information in the export file and update the format.

@Khady
Copy link
Contributor Author

Khady commented May 6, 2024

I had the issue when importing in a non existing switch I believe.

@kit-ty-kate
Copy link
Member

That one particular case is fixed in 2.2 then (the rest is still to be fixed ofc)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants