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

Don't confirm pinning invariant packages #4571

Merged
merged 1 commit into from
Mar 7, 2021
Merged

Conversation

dra27
Copy link
Member

@dra27 dra27 commented Feb 27, 2021

Related to #4569, but not itself a bug. Pinning an invariant package still displays this prompt:

$ opam pin add ocaml-base-compiler --dev-repo
[WARNING] Package ocaml-base-compiler is part of the base packages of this compiler.
Are you sure you want to override this and pin it anyway? [Y/n]

This prompt made sense in 2.0 where the base packages were locked, but it has no place any more with the glory of switch invariants!

Combined with #4569 and forthcoming amendments PRs to ocaml/ocaml and ocaml/opam-repository, this makes pinning the compiler work naturally! 🎉

@dra27 dra27 added the AREA: UI label Feb 27, 2021
@dra27 dra27 added this to the 2.1.0~rc milestone Feb 27, 2021
@rjbou
Copy link
Collaborator

rjbou commented Mar 3, 2021

Should we ask were the pinned package & version are not consistent with the invariant ? We can't detect all underlying conflicts without launching the solver, but at least check with the invariant formula. Ftm it is pinned but uninstallable.

@dra27
Copy link
Member Author

dra27 commented Mar 3, 2021

I think it's OK as it stands:

dra@thor:~/opam$ ./opam switch invariant
["ocaml" {= "4.12.0"}]

dra@thor:~/opam$ ./opam pin add ocaml-base-compiler --dev-repo
[ocaml-base-compiler.4.12.0] synchronised (git+https://github.com/dra27/ocaml.git#4.12)
ocaml-base-compiler is now pinned to git+https://github.com/dra27/ocaml.git#4.12 (version 4.12.0)

[ERROR] Package conflict!
  * No agreement on the version of ocaml:
    - (invariant) → ocaml = 4.12.0
    - ocaml-base-compiler >= 4.12.0 → ocaml = 4.12.1
    You can temporarily relax the switch invariant with `--update-invariant'

[NOTE] Pinning command successful, but your installed packages may be out of sync.

dra@thor:~/opam$ ./opam install ocaml-base-compiler --update-invariant

<><> Synchronising pinned packages ><><><><><><><><><><><><><><><><><><><><><><>
[ocaml-base-compiler.4.12.0] synchronised (no changes)

The following actions will be performed:
  ↻ recompile ocaml-base-compiler 4.12.0*
  ↻ recompile ocaml-config        2                [uses ocaml-base-compiler]
  ↗ upgrade   ocaml               4.12.0 to 4.12.1 [upstream or system changes]
===== ↻ 2   ↗ 1 =====
Do you want to continue? [Y/n] y

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
⬇ retrieved ocaml-base-compiler.4.12.0  (git+https://github.com/dra27/ocaml.git#4.12)
⊘ removed   ocaml.4.12.0
⊘ removed   ocaml-config.2
⊘ removed   ocaml-base-compiler.4.12.0
∗ installed ocaml-base-compiler.4.12.0
∗ installed ocaml-config.2
∗ installed ocaml.4.12.1
[NOTE] Switch invariant was updated to ["ocaml" {= "4.12.1"}]
       Use `opam switch set-invariant' to change it.
Done.

dra@thor:~/opam$ ./opam pin remove ocaml-base-compiler --update-invariant
Ok, ocaml-base-compiler is no longer pinned to git+https://github.com/dra27/ocaml.git#4.12 (version 4.12.0)
The following actions will be performed:
  ↻ recompile ocaml-base-compiler 4.12.0
  ↻ recompile ocaml-config        2                [uses ocaml-base-compiler]
  ↘ downgrade ocaml               4.12.1 to 4.12.0 [upstream or system changes]
===== ↻ 2   ↘ 1 =====
Do you want to continue? [Y/n] y

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
⬇ retrieved ocaml-base-compiler.4.12.0  (cached)
⊘ removed   ocaml.4.12.1
⊘ removed   ocaml-config.2
⊘ removed   ocaml-base-compiler.4.12.0
∗ installed ocaml-base-compiler.4.12.0
∗ installed ocaml-config.2
∗ installed ocaml.4.12.0
[NOTE] Switch invariant was updated to ["ocaml" {= "4.12.0"}]
       Use `opam switch set-invariant' to change it.
Done.

I think at each stage opam explains what you need to do and in future you can remember to have opam pin add ocaml-base-compiler --dev-repo --update-invariant?

@dra27 dra27 merged commit 1c9f023 into ocaml:master Mar 7, 2021
@dra27 dra27 deleted the pinning-base branch March 7, 2021 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants