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

dev-cmd/bump: fix comparison of versions with comma-separated values #18480

Merged
merged 1 commit into from
Oct 2, 2024

Conversation

khipp
Copy link
Member

@khipp khipp commented Oct 2, 2024

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

This PR fixes an issue when running brew bump with casks that use version stanzas containing comma-separated values.

The problem occurs when the number of components increases (e.g., 9.5,286 ==> 9.5.1,287), since the versions are compared token by token, leading to incorrect results (e.g., 1 < 286).
To resolve this, instances of LivecheckVersion are used to split the comma-separated values into individual Version objects.

Before:

$ brew bump --cask banktivity
==> banktivity
Current cask version:     9.5,286
Latest livecheck version: unable to get versions
...

After:

$ brew bump --cask banktivity
==> banktivity
Current cask version:     9.5,286
Latest livecheck version: 9.5.1,287
...

Related to Homebrew/homebrew-cask#182564.

@p-linnane p-linnane requested a review from samford October 2, 2024 14:25
Copy link
Member

@samford samford left a comment

Choose a reason for hiding this comment

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

Nice catch. Your explanation makes sense to me (Version ignores delimiters when doing comparisons, so . and , are treated the same) and this fix worked as expected when tested locally.

Thanks, @khipp!

@MikeMcQuaid MikeMcQuaid merged commit a54e9c5 into Homebrew:master Oct 2, 2024
27 checks passed
@khipp khipp deleted the fix-auto-bump branch October 2, 2024 21:13
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.

3 participants