Skip to content

Commit

Permalink
dev-cmd/bump: Ignore Repology if the livecheck uses GithubLatest
Browse files Browse the repository at this point in the history
- I got frustrated when I fixed the build and test failures for
  https://github.com/Homebrew/homebrew-core/pull /95430 only to have the
  audit step say it was a pre-release.
- Repology can list versions that are GitHub pre-releases. Pre-release
  versions of software are things we don't generally want to ship:
  there's an audit specifically for that.
- This fixes `brew bump` to not mark a Repology version as the newest if
  the formula's livecheck strategy is `GithubLatest`. If the livecheck
  doesn't exist, or its update strategy is something other than
  `GithubLatest`, Repology's reported package version is respected.
  • Loading branch information
issyl0 committed Feb 19, 2022
1 parent 374adf7 commit 32c189b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions Library/Homebrew/dev-cmd/bump.rb
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,14 @@ def livecheck_result(formula_or_cask)
version_info = Livecheck.latest_version(
formula_or_cask,
referenced_formula_or_cask: referenced_formula_or_cask,
json: true, full_name: false, verbose: false, debug: false
json: true, full_name: false, verbose: true, debug: false
)
latest = version_info[:latest] if version_info.present?
return "unable to get versions" if version_info.blank?

return "unable to get versions" if latest.blank?
latest = version_info[:latest]
strategy = version_info[:meta][:strategy] if version_info[:meta]

Version.new(latest)
[Version.new(latest), strategy]
rescue => e
"error: #{e}"
end
Expand All @@ -233,7 +234,7 @@ def retrieve_and_display_info_and_open_pr(formula_or_cask, name, repositories, a
version_name = "cask version "
end

livecheck_latest = livecheck_result(formula_or_cask)
livecheck_latest, livecheck_strategy = livecheck_result(formula_or_cask)

repology_latest = if repositories.present?
Repology.latest_version(repositories)
Expand All @@ -243,7 +244,7 @@ def retrieve_and_display_info_and_open_pr(formula_or_cask, name, repositories, a

new_version = if livecheck_latest.is_a?(Version) && livecheck_latest > current_version
livecheck_latest
elsif repology_latest.is_a?(Version) && repology_latest > current_version
elsif repology_latest.is_a?(Version) && repology_latest > current_version && livecheck_strategy != "GithubLatest"
repology_latest
end.presence

Expand Down

0 comments on commit 32c189b

Please sign in to comment.