Skip to content

SkipConditions: special case unsigned deprecations #20366

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

Merged
merged 2 commits into from
Aug 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Library/Homebrew/livecheck/skip_conditions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ module SkipConditions
}
private_class_method def self.cask_deprecated(cask, livecheck_defined, full_name: false, verbose: false)
return {} if !cask.deprecated? || livecheck_defined
return {} if cask.disable_date && cask.deprecation_reason == :unsigned

Livecheck.status_hash(cask, "deprecated", full_name:, verbose:)
end
Expand Down
44 changes: 30 additions & 14 deletions Library/Homebrew/test/livecheck/skip_conditions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@

let(:casks) do
{
basic: Cask::Cask.new("test") do
basic: Cask::Cask.new("test") do
version "0.0.1,2"

url "https://brew.sh/test-0.0.1.tgz"
url "https://brew.sh/test-#{version.csv.first}.tgz"
name "Test"
desc "Test cask"
homepage "https://brew.sh"
Expand All @@ -92,32 +92,42 @@
regex(/"stable":"(\d+(?:\.\d+)+)"/i)
end
end,
deprecated: Cask::Cask.new("test_deprecated") do
deprecated: Cask::Cask.new("test_deprecated") do
version "0.0.1"
sha256 :no_check

url "https://brew.sh/test-0.0.1.tgz"
url "https://brew.sh/test-#{version}.tgz"
name "Test Deprecate"
desc "Deprecated test cask"
homepage "https://brew.sh"

deprecate! date: "2020-06-25", because: :discontinued
end,
disabled: Cask::Cask.new("test_disabled") do
disabled: Cask::Cask.new("test_disabled") do
version "0.0.1"
sha256 :no_check

url "https://brew.sh/test-0.0.1.tgz"
url "https://brew.sh/test-#{version}.tgz"
name "Test Disable"
desc "Disabled test cask"
homepage "https://brew.sh"

disable! date: "2020-06-25", because: :discontinued
end,
extract_plist: Cask::Cask.new("test_extract_plist_skip") do
future_disable_unsigned: Cask::Cask.new("test_future_disable_unsigned") do
version "0.0.1"

url "https://brew.sh/test-0.0.1.tgz"
url "https://brew.sh/test-#{version}.tgz"
name "Test Future Disabled Unsigned"
desc "Future Disable Unsigned test cask"
homepage "https://brew.sh"

disable! date: "3000-06-25", because: :unsigned
end,
extract_plist: Cask::Cask.new("test_extract_plist_skip") do
version "0.0.1"

url "https://brew.sh/test-#{version}.tgz"
name "Test ExtractPlist Skip"
desc "Skipped test cask"
homepage "https://brew.sh"
Expand All @@ -126,7 +136,7 @@
strategy :extract_plist
end
end,
latest: Cask::Cask.new("test_latest") do
latest: Cask::Cask.new("test_latest") do
version :latest
sha256 :no_check

Expand All @@ -135,7 +145,7 @@
desc "Latest test cask"
homepage "https://brew.sh"
end,
unversioned: Cask::Cask.new("test_unversioned") do
unversioned: Cask::Cask.new("test_unversioned") do
version "1.2.3"
sha256 :no_check

Expand All @@ -144,10 +154,10 @@
desc "Unversioned test cask"
homepage "https://brew.sh"
end,
skip: Cask::Cask.new("test_skip") do
skip: Cask::Cask.new("test_skip") do
version "0.0.1"

url "https://brew.sh/test-0.0.1.tgz"
url "https://brew.sh/test-#{version}.tgz"
name "Test Skip"
desc "Skipped test cask"
homepage "https://brew.sh"
Expand All @@ -156,10 +166,10 @@
skip
end
end,
skip_with_message: Cask::Cask.new("test_skip_with_message") do
skip_with_message: Cask::Cask.new("test_skip_with_message") do
version "0.0.1"

url "https://brew.sh/test-0.0.1.tgz"
url "https://brew.sh/test-#{version}.tgz"
name "Test Skip"
desc "Skipped test cask"
homepage "https://brew.sh"
Expand Down Expand Up @@ -374,6 +384,12 @@
end
end

context "when a cask without a `livecheck` block is deprecated with a future disable date because `:unsigned`" do
it "does not skip" do
expect(skip_conditions.skip_information(casks[:future_disable_unsigned])).to eq({})
end
end

context "when a cask has a `livecheck` block using `ExtractPlist` and `--extract-plist` is not used" do
it "skips" do
expect(skip_conditions.skip_information(casks[:extract_plist], extract_plist: false))
Expand Down
Loading