diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 1a60e448cb..bcaa832e25 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -3437,6 +3437,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 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) diff --git a/Library/Homebrew/test/formula_spec.rb b/Library/Homebrew/test/formula_spec.rb index 59b344e37b..6248ca8a9d 100644 --- a/Library/Homebrew/test/formula_spec.rb +++ b/Library/Homebrew/test/formula_spec.rb @@ -1845,54 +1845,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