Skip to content

opam upgrade: Do not show the not-up-to-date message with packages tagged with avoid-version#6273

Merged
rjbou merged 2 commits intoocaml:masterfrom
kit-ty-kate:no-avoid-version-upgrade
Feb 5, 2025
Merged

opam upgrade: Do not show the not-up-to-date message with packages tagged with avoid-version#6273
rjbou merged 2 commits intoocaml:masterfrom
kit-ty-kate:no-avoid-version-upgrade

Conversation

@kit-ty-kate
Copy link
Copy Markdown
Member

Fixes #6271

Copy link
Copy Markdown
Collaborator

@rjbou rjbou left a comment

Choose a reason for hiding this comment

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

I needs a test too.

let name = OpamPackage.name pkg in
let pkgs = OpamPackage.packages_of_name t.packages name in
let latest =
OpamPackage.Set.fold (fun pkg latest ->
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.

this variable named pkg and the one defined 4 lines above are not the "same package" but have the same name, this can be misleading when reading the code.

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 disagree. Since the name above doesn't have any use below i think it's better to shadow it. The same pattern is used in different places in our code already and i think it make sense to use it here

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.

The same pattern is used true, usually it is a map that is populated through intertwined fold, and in that case it is more clear. But i'm sure that we can find this pattern for other case :)

(OpamPackage.names_of_packages to_check)
OpamPackage.Set.fold (fun pkg acc ->
let name = OpamPackage.name pkg in
let pkgs = OpamPackage.packages_of_name t.packages name in
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.

I don't know if it worth working on the set of version instead of package one.

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.

it simplifies the code greatly. Otherwise we would need to have an intermediate map of set and update it

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.

avoid-version packages should be ignored when opam upgrade refuses to upgrade

2 participants