From 131f5eba0f1a9a4fda15bc1fee5743220b97498d Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Thu, 26 Jan 2023 13:29:51 +0800 Subject: [PATCH 1/3] formula: deprecate `ignore_missing_libraries` We removed all uses of this method in Homebrew/core. See Homebrew/homebrew-core#111297. --- Library/Homebrew/formula.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index bb8a0e6bfd..752cd0cb4c 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -3438,6 +3438,7 @@ class Formula # Permit links to certain libraries that don't exist. Available on Linux only. def ignore_missing_libraries(*libs) + odeprecated "ignore_missing_libraries" unless Homebrew::SimulateSystem.simulating_or_running_on_linux? raise FormulaSpecificationError, "#{__method__} is available on Linux only" end From 4b318f738b94f0af67ac096106cb9c9c5a905b20 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Thu, 26 Jan 2023 13:46:48 +0800 Subject: [PATCH 2/3] Remove tests for `ignore_missing_libraries` The deprecation is causing these tests to fail. --- Library/Homebrew/test/formula_spec.rb | 48 --------------------------- 1 file changed, 48 deletions(-) diff --git a/Library/Homebrew/test/formula_spec.rb b/Library/Homebrew/test/formula_spec.rb index 723efa62b9..e7fdaf8cb7 100644 --- a/Library/Homebrew/test/formula_spec.rb +++ b/Library/Homebrew/test/formula_spec.rb @@ -1841,54 +1841,6 @@ describe Formula do end end - describe "#ignore_missing_libraries" do - after do - Homebrew::SimulateSystem.clear - end - - it "adds library to allowed_missing_libraries on Linux", :needs_linux do - Homebrew::SimulateSystem.clear - f = formula do - url "foo-1.0" - - ignore_missing_libraries "bar.so" - end - expect(f.class.allowed_missing_libraries.to_a).to eq(["bar.so"]) - end - - it "adds library to allowed_missing_libraries on macOS when simulating Linux", :needs_macos do - Homebrew::SimulateSystem.os = :linux - f = formula do - url "foo-1.0" - - ignore_missing_libraries "bar.so" - end - expect(f.class.allowed_missing_libraries.to_a).to eq(["bar.so"]) - end - - it "raises an error on macOS", :needs_macos do - Homebrew::SimulateSystem.clear - expect { - formula do - url "foo-1.0" - - ignore_missing_libraries "bar.so" - end - }.to raise_error("ignore_missing_libraries is available on Linux only") - end - - it "raises an error on Linux when simulating macOS", :needs_linux do - Homebrew::SimulateSystem.os = :macos - expect { - formula do - url "foo-1.0" - - ignore_missing_libraries "bar.so" - end - }.to raise_error("ignore_missing_libraries is available on Linux only") - end - end - describe "#generate_completions_from_executable" do let(:f) do Class.new(Testball) do From f576140ade886427a0b8dc88bbb2dfc2fd9974a7 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Thu, 26 Jan 2023 13:48:06 +0800 Subject: [PATCH 3/3] Remove Rubocop for `ignore_missing_libraries` This is no longer needed. --- Library/Homebrew/rubocops/components_order.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/Library/Homebrew/rubocops/components_order.rb b/Library/Homebrew/rubocops/components_order.rb index d4becfa86f..6759b22106 100644 --- a/Library/Homebrew/rubocops/components_order.rb +++ b/Library/Homebrew/rubocops/components_order.rb @@ -131,7 +131,6 @@ module RuboCop fails_with resource patch - ignore_missing_libraries ] on_system_allowed_methods += on_system_methods.map(&:to_s) _, offensive_node = check_order(component_precedence_list, on_system_block.body)