Skip to content

Do not include compiler packages flagged with avoid-version/deprecated in the invariant when calling 'opam switch create [name] <version>'#6494

Merged
kit-ty-kate merged 2 commits intoocaml:masterfrom
kit-ty-kate:switch-create-no-avoid-version
May 2, 2025
Merged

Conversation

@kit-ty-kate
Copy link
Copy Markdown
Member

Yet another alternative to #6465 #6466 and #6493

@kit-ty-kate kit-ty-kate added this to the 2.4.0~alpha2 milestone Apr 29, 2025
@kit-ty-kate kit-ty-kate force-pushed the switch-create-no-avoid-version branch from 1e97dc5 to d6cb6ba Compare April 29, 2025 09:31
@kit-ty-kate kit-ty-kate marked this pull request as ready for review April 29, 2025 10:26
@kit-ty-kate kit-ty-kate requested a review from rjbou April 29, 2025 10:26
@kit-ty-kate kit-ty-kate force-pushed the switch-create-no-avoid-version branch from d6cb6ba to 5ab94c8 Compare April 30, 2025 15:50
…d in the invariant when calling 'opam switch create [name] <version>'
@kit-ty-kate kit-ty-kate force-pushed the switch-create-no-avoid-version branch from 5ab94c8 to cf31f73 Compare April 30, 2025 15:53
Comment on lines +753 to +754
not (OpamFile.OPAM.has_flag Pkgflag_AvoidVersion opam) &&
not (OpamFile.OPAM.has_flag Pkgflag_Deprecated opam))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

There is several places in the code where there is an avoid version || deprecated or its negation. It may worth to have a function that returns, in order to factorise. Not necessary for this PR though.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I opened #6503 to track this suggestion


<><> Upgrading repositories from older opam format ><><><><><><><><><><><><><><>
Upgrading repository "from-link"...
### :a: switch create <version> should not have packages tagged with
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
### :a: switch create <version> should not have packages tagged with
### :C: Invariant setting of newly created switch, with avoid version & deprecated flag
### :C:a: switch create <version> should not have packages tagged with

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This reftest does not have sections

-> installed ocaml-system.5.3.0
-> installed reverse-ocaml.5.3.0
Done.
### :b: switch create <version> should not have packages tagged with
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
### :b: switch create <version> should not have packages tagged with
### :C:b: switch create <version> should not have packages tagged with

@kit-ty-kate kit-ty-kate merged commit e6454e1 into ocaml:master May 2, 2025
44 checks passed
@kit-ty-kate kit-ty-kate deleted the switch-create-no-avoid-version branch May 2, 2025 16:28
kit-ty-kate added a commit to kit-ty-kate/opam-repository that referenced this pull request May 4, 2025
This makes sure opam switches do not end up with ocaml-system unknowingly. opam switches can still use it as long as that requirement is explicit. This fixes a large number of issues encountered by users. See ocaml/opam#6494 and ocaml/opam#6307
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants