Livecheck: Skip Internet Archive stable URLs
This commit is contained in:
parent
f36d1a7fb6
commit
aae91cacae
@ -357,15 +357,19 @@ module Homebrew
|
|||||||
stable_from_google_code_archive = formula&.stable&.url&.match?(
|
stable_from_google_code_archive = formula&.stable&.url&.match?(
|
||||||
%r{https?://storage\.googleapis\.com/google-code-archive-downloads/}i,
|
%r{https?://storage\.googleapis\.com/google-code-archive-downloads/}i,
|
||||||
)
|
)
|
||||||
|
stable_from_internet_archive = formula&.stable&.url&.match?(%r{https?://web\.archive\.org/}i)
|
||||||
stable_is_gist = formula&.stable&.url&.match?(%r{https?://gist\.github(?:usercontent)?\.com/}i)
|
stable_is_gist = formula&.stable&.url&.match?(%r{https?://gist\.github(?:usercontent)?\.com/}i)
|
||||||
if formula_or_cask.livecheck.skip? ||
|
if formula_or_cask.livecheck.skip? ||
|
||||||
((stable_from_google_code_archive ||
|
((stable_from_google_code_archive ||
|
||||||
|
stable_from_internet_archive ||
|
||||||
stable_is_gist) && !formula&.livecheckable?)
|
stable_is_gist) && !formula&.livecheckable?)
|
||||||
skip_message = if formula_or_cask.livecheck.skip_msg.is_a?(String) &&
|
skip_message = if formula_or_cask.livecheck.skip_msg.is_a?(String) &&
|
||||||
formula_or_cask.livecheck.skip_msg.present?
|
formula_or_cask.livecheck.skip_msg.present?
|
||||||
formula_or_cask.livecheck.skip_msg.to_s.presence
|
formula_or_cask.livecheck.skip_msg.to_s.presence
|
||||||
elsif stable_from_google_code_archive
|
elsif stable_from_google_code_archive
|
||||||
"Stable URL is from Google Code Archive"
|
"Stable URL is from Google Code Archive"
|
||||||
|
elsif stable_from_internet_archive
|
||||||
|
"Stable URL is from Internet Archive"
|
||||||
elsif stable_is_gist
|
elsif stable_is_gist
|
||||||
"Stable URL is a GitHub Gist"
|
"Stable URL is a GitHub Gist"
|
||||||
end
|
end
|
||||||
|
@ -241,6 +241,22 @@ describe Homebrew::Livecheck do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "a formula with an Internet Archive stable URL" do
|
||||||
|
let(:f_internet_archive) do
|
||||||
|
formula("test_internet_archive") do
|
||||||
|
desc "Internet Archive test formula"
|
||||||
|
homepage "https://brew.sh"
|
||||||
|
url "https://web.archive.org/web/20200101000000/https://brew.sh/test-0.0.1.tgz"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
it "skips" do
|
||||||
|
expect { livecheck.skip_conditions(f_internet_archive) }
|
||||||
|
.to output("test_internet_archive : skipped - Stable URL is from Internet Archive\n").to_stdout
|
||||||
|
.and not_to_output.to_stderr
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context "a formula with a `livecheck` block containing `skip`" do
|
context "a formula with a `livecheck` block containing `skip`" do
|
||||||
let(:f_skip) do
|
let(:f_skip) do
|
||||||
formula("test_skip") do
|
formula("test_skip") do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user