refactor throttled update logic to improve efficiency
This commit is contained in:
parent
e9c7c26e0a
commit
963605e682
@ -571,13 +571,13 @@ module Homebrew
|
|||||||
imagemagick@6
|
imagemagick@6
|
||||||
].freeze
|
].freeze
|
||||||
|
|
||||||
THROTTLED_DENYLIST = {
|
THROTTLED_FORMULAE = {
|
||||||
"aws-sdk-cpp" => "10",
|
"aws-sdk-cpp" => 10,
|
||||||
"awscli@1" => "10",
|
"awscli@1" => 10,
|
||||||
"balena-cli" => "10",
|
"balena-cli" => 10,
|
||||||
"gatsby-cli" => "10",
|
"gatsby-cli" => 10,
|
||||||
"quicktype" => "10",
|
"quicktype" => 10,
|
||||||
"vim" => "50",
|
"vim" => 50,
|
||||||
}.freeze
|
}.freeze
|
||||||
|
|
||||||
UNSTABLE_ALLOWLIST = {
|
UNSTABLE_ALLOWLIST = {
|
||||||
@ -667,15 +667,6 @@ module Homebrew
|
|||||||
problem head_spec_message unless VERSIONED_HEAD_SPEC_ALLOWLIST.include?(formula.name)
|
problem head_spec_message unless VERSIONED_HEAD_SPEC_ALLOWLIST.include?(formula.name)
|
||||||
end
|
end
|
||||||
|
|
||||||
THROTTLED_DENYLIST.each do |f, v|
|
|
||||||
next if formula.stable.nil?
|
|
||||||
|
|
||||||
version = formula.stable.version.to_s.split(".").last.to_i
|
|
||||||
if f == formula.name && version.modulo(v.to_i).nonzero?
|
|
||||||
problem "should only be updated every #{v} releases on multiples of #{v}"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
stable = formula.stable
|
stable = formula.stable
|
||||||
return unless stable
|
return unless stable
|
||||||
return unless stable.url
|
return unless stable.url
|
||||||
@ -686,6 +677,12 @@ module Homebrew
|
|||||||
.split(".", 3)
|
.split(".", 3)
|
||||||
.map(&:to_i)
|
.map(&:to_i)
|
||||||
|
|
||||||
|
formula_suffix = stable_version_string.split(".").last.to_i
|
||||||
|
throttled_rate = THROTTLED_FORMULAE[formula.name]
|
||||||
|
if throttled_rate && formula_suffix.modulo(throttled_rate).nonzero?
|
||||||
|
problem "should only be updated every #{throttled_rate} releases on multiples of #{throttled_rate}"
|
||||||
|
end
|
||||||
|
|
||||||
case (url = stable.url)
|
case (url = stable.url)
|
||||||
when /[\d._-](alpha|beta|rc\d)/
|
when /[\d._-](alpha|beta|rc\d)/
|
||||||
matched = Regexp.last_match(1)
|
matched = Regexp.last_match(1)
|
||||||
|
|||||||
@ -542,7 +542,7 @@ module Homebrew
|
|||||||
include_examples "formulae exist", described_class::VERSIONED_KEG_ONLY_ALLOWLIST
|
include_examples "formulae exist", described_class::VERSIONED_KEG_ONLY_ALLOWLIST
|
||||||
include_examples "formulae exist", described_class::VERSIONED_HEAD_SPEC_ALLOWLIST
|
include_examples "formulae exist", described_class::VERSIONED_HEAD_SPEC_ALLOWLIST
|
||||||
include_examples "formulae exist", described_class::USES_FROM_MACOS_ALLOWLIST
|
include_examples "formulae exist", described_class::USES_FROM_MACOS_ALLOWLIST
|
||||||
include_examples "formulae exist", described_class::THROTTLED_DENYLIST.keys
|
include_examples "formulae exist", described_class::THROTTLED_FORMULAE.keys
|
||||||
include_examples "formulae exist", described_class::UNSTABLE_ALLOWLIST.keys
|
include_examples "formulae exist", described_class::UNSTABLE_ALLOWLIST.keys
|
||||||
include_examples "formulae exist", described_class::GNOME_DEVEL_ALLOWLIST.keys
|
include_examples "formulae exist", described_class::GNOME_DEVEL_ALLOWLIST.keys
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user