From 6882ac17e742666402e4ff936b58227113b688c9 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 7 Feb 2023 15:13:19 +0100 Subject: [PATCH] Revert "Add deprecations and disables" --- Library/Homebrew/cask/cask.rb | 8 +-- Library/Homebrew/cmd/deps.rb | 4 +- Library/Homebrew/cmd/desc.rb | 2 +- Library/Homebrew/cmd/info.rb | 2 +- Library/Homebrew/cmd/options.rb | 2 +- Library/Homebrew/cmd/readall.rb | 2 +- Library/Homebrew/cmd/search.rb | 2 +- Library/Homebrew/cmd/uses.rb | 6 +- Library/Homebrew/dev-cmd/audit.rb | 13 ++-- .../dev-cmd/generate-man-completions.rb | 2 +- Library/Homebrew/dev-cmd/livecheck.rb | 2 +- Library/Homebrew/dev-cmd/typecheck.rb | 2 +- Library/Homebrew/dev-cmd/unbottled.rb | 4 +- .../Homebrew/dev-cmd/update-license-data.rb | 2 +- .../extend/os/linux/linkage_checker.rb | 14 +++- Library/Homebrew/formula.rb | 15 +++-- Library/Homebrew/formula_installer.rb | 6 +- Library/Homebrew/rubocops/components_order.rb | 1 + Library/Homebrew/test/caveats_spec.rb | 64 ++++++++++++++++++- .../Homebrew/test/formula_installer_spec.rb | 24 +++---- Library/Homebrew/test/formula_spec.rb | 48 ++++++++++++++ Library/Homebrew/utils.rb | 3 +- 22 files changed, 175 insertions(+), 53 deletions(-) diff --git a/Library/Homebrew/cask/cask.rb b/Library/Homebrew/cask/cask.rb index 8d37c14cf2f4c..8a6f7fb7c1764 100644 --- a/Library/Homebrew/cask/cask.rb +++ b/Library/Homebrew/cask/cask.rb @@ -24,10 +24,10 @@ class Cask attr_accessor :download, :allow_reassignment def self.all - # TODO: ideally avoid using ARGV by moving to e.g. CLI::Parser - if ARGV.exclude?("--eval-all") && !Homebrew::EnvConfig.eval_all? - odeprecated "Cask::Cask#all without --all or HOMEBREW_EVAL_ALL" - end + # TODO: uncomment for 3.7.0 and ideally avoid using ARGV by moving to e.g. CLI::Parser + # if !ARGV.include?("--eval-all") && !Homebrew::EnvConfig.eval_all? + # odeprecated "Cask::Cask#all without --all or HOMEBREW_EVAL_ALL" + # end Tap.flat_map(&:cask_files).map do |f| CaskLoader::FromTapPathLoader.new(f).load(config: nil) diff --git a/Library/Homebrew/cmd/deps.rb b/Library/Homebrew/cmd/deps.rb index 2ca0ca80bcd17..541f341e4a8b9 100644 --- a/Library/Homebrew/cmd/deps.rb +++ b/Library/Homebrew/cmd/deps.rb @@ -84,8 +84,8 @@ def deps all = args.eval_all? if args.all? unless all - odisabled "brew deps --all", - "brew deps --eval-all or HOMEBREW_EVAL_ALL" + odeprecated "brew deps --all", + "brew deps --eval-all or HOMEBREW_EVAL_ALL" end all = true end diff --git a/Library/Homebrew/cmd/desc.rb b/Library/Homebrew/cmd/desc.rb index 5fa27f4656043..b38a8ae11f66a 100644 --- a/Library/Homebrew/cmd/desc.rb +++ b/Library/Homebrew/cmd/desc.rb @@ -45,7 +45,7 @@ def desc args = desc_args.parse if !args.eval_all? && !Homebrew::EnvConfig.eval_all? - odisabled "brew desc", "brew desc --eval-all or HOMEBREW_EVAL_ALL" + odeprecated "brew desc", "brew desc --eval-all or HOMEBREW_EVAL_ALL" end search_type = if args.search? diff --git a/Library/Homebrew/cmd/info.rb b/Library/Homebrew/cmd/info.rb index 0393daa4ac5fb..9495fde636360 100644 --- a/Library/Homebrew/cmd/info.rb +++ b/Library/Homebrew/cmd/info.rb @@ -110,7 +110,7 @@ def info elsif args.json all = args.eval_all? if !all && args.all? && !Homebrew::EnvConfig.eval_all? - odisabled "brew info --all", "brew info --eval-all or HOMEBREW_EVAL_ALL" + odeprecated "brew info --all", "brew info --eval-all or HOMEBREW_EVAL_ALL" all = true end diff --git a/Library/Homebrew/cmd/options.rb b/Library/Homebrew/cmd/options.rb index d83f8255293e5..4b80fa5ad52d9 100644 --- a/Library/Homebrew/cmd/options.rb +++ b/Library/Homebrew/cmd/options.rb @@ -38,7 +38,7 @@ def options all = args.eval_all? if args.all? - odisabled "brew info --all", "brew info --eval-all" if !all && !Homebrew::EnvConfig.eval_all? + odeprecated "brew info --all", "brew info --eval-all" if !all && !Homebrew::EnvConfig.eval_all? all = true end diff --git a/Library/Homebrew/cmd/readall.rb b/Library/Homebrew/cmd/readall.rb index 7c9c3d71042cd..2c7bd4d0af559 100644 --- a/Library/Homebrew/cmd/readall.rb +++ b/Library/Homebrew/cmd/readall.rb @@ -46,7 +46,7 @@ def readall options = { aliases: args.aliases?, no_simulate: args.no_simulate? } taps = if args.no_named? if !args.eval_all? && !Homebrew::EnvConfig.eval_all? - odisabled "brew readall", "brew readall --eval-all or HOMEBREW_EVAL_ALL" + odeprecated "brew readall", "brew readall --eval-all or HOMEBREW_EVAL_ALL" end Tap else diff --git a/Library/Homebrew/cmd/search.rb b/Library/Homebrew/cmd/search.rb index 386d07ebdaeb1..bcf50ebf70c99 100644 --- a/Library/Homebrew/cmd/search.rb +++ b/Library/Homebrew/cmd/search.rb @@ -78,7 +78,7 @@ def search if args.desc? if !args.eval_all? && !Homebrew::EnvConfig.eval_all? - odisabled "brew search --desc", "brew search --desc --eval-all or HOMEBREW_EVAL_ALL" + odeprecated "brew search --desc", "brew search --desc --eval-all or HOMEBREW_EVAL_ALL" end Search.search_descriptions(string_or_regex, args) elsif args.pull_request? diff --git a/Library/Homebrew/cmd/uses.rb b/Library/Homebrew/cmd/uses.rb index 0b4e6b0f735cb..c194823d44600 100644 --- a/Library/Homebrew/cmd/uses.rb +++ b/Library/Homebrew/cmd/uses.rb @@ -109,14 +109,14 @@ def intersection_of_dependents(use_runtime_dependents, used_formulae, args:) all = args.eval_all? if args.all? unless all - odisabled "brew uses --all", - "brew uses --eval-all or HOMEBREW_EVAL_ALL" + odeprecated "brew uses --all", + "brew uses --eval-all or HOMEBREW_EVAL_ALL" end all = true end if !args.installed? && !(all || Homebrew::EnvConfig.eval_all?) - odisabled "brew uses", "brew uses --eval-all or HOMEBREW_EVAL_ALL" + odeprecated "brew uses", "brew uses --eval-all or HOMEBREW_EVAL_ALL" end if show_formulae_and_casks || args.formula? deps += args.installed? ? Formula.installed : Formula.all diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 62cf434b25929..25d2990883fb6 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -134,16 +134,17 @@ def audit [Formula.installed, Cask::Caskroom.casks] elsif args.no_named? if !args.eval_all? && !Homebrew::EnvConfig.eval_all? - odisabled "brew audit", - "brew audit --eval-all or HOMEBREW_EVAL_ALL" + odeprecated "brew audit", + "brew audit --eval-all or HOMEBREW_EVAL_ALL" end no_named_args = true [Formula.all, Cask::Cask.all] else - if args.named.any? { |named_arg| named_arg.end_with?(".rb") } - odeprecated "brew audit [path ...]", - "brew audit [name ...]" - end + # TODO: Add deprecation + # if args.named.any? { |named_arg| named_arg.end_with?(".rb") } + # odeprecated "brew audit [path ...]", + # "brew audit [name ...]" + # end args.named.to_formulae_and_casks .partition { |formula_or_cask| formula_or_cask.is_a?(Formula) } diff --git a/Library/Homebrew/dev-cmd/generate-man-completions.rb b/Library/Homebrew/dev-cmd/generate-man-completions.rb index 1732a7a4454a3..cacae0ff9e199 100644 --- a/Library/Homebrew/dev-cmd/generate-man-completions.rb +++ b/Library/Homebrew/dev-cmd/generate-man-completions.rb @@ -30,7 +30,7 @@ def generate_man_completions_args def generate_man_completions args = generate_man_completions_args.parse - odisabled "brew generate-man-completions --fail-if-not-changed" if args.fail_if_not_changed? + odeprecated "brew generate-man-completions --fail-if-not-changed" if args.fail_if_not_changed? Commands.rebuild_internal_commands_completion_list Manpages.regenerate_man_pages(quiet: args.quiet?) diff --git a/Library/Homebrew/dev-cmd/livecheck.rb b/Library/Homebrew/dev-cmd/livecheck.rb index a9a4312577cbb..3b87f7bf13d71 100644 --- a/Library/Homebrew/dev-cmd/livecheck.rb +++ b/Library/Homebrew/dev-cmd/livecheck.rb @@ -59,7 +59,7 @@ def livecheck all = args.eval_all? if args.all? - odisabled "brew livecheck --all", "brew livecheck --eval-all" if !all && !Homebrew::EnvConfig.eval_all? + odeprecated "brew livecheck --all", "brew livecheck --eval-all" if !all && !Homebrew::EnvConfig.eval_all? all = true end diff --git a/Library/Homebrew/dev-cmd/typecheck.rb b/Library/Homebrew/dev-cmd/typecheck.rb index 05aa18303590c..b68a18834e47f 100644 --- a/Library/Homebrew/dev-cmd/typecheck.rb +++ b/Library/Homebrew/dev-cmd/typecheck.rb @@ -51,7 +51,7 @@ def typecheck HOMEBREW_LIBRARY_PATH.cd do if args.update? || args.update_all? - odisabled "brew typecheck --update --fail-if-not-changed" if args.fail_if_not_changed? + odeprecated "brew typecheck --update --fail-if-not-changed" if args.fail_if_not_changed? excluded_gems = [ "did_you_mean", # RBI file is already provided by Sorbet diff --git a/Library/Homebrew/dev-cmd/unbottled.rb b/Library/Homebrew/dev-cmd/unbottled.rb index 5fa7c6e33630c..be766a15f278d 100644 --- a/Library/Homebrew/dev-cmd/unbottled.rb +++ b/Library/Homebrew/dev-cmd/unbottled.rb @@ -56,7 +56,7 @@ def unbottled all = args.eval_all? if args.total? if !all && !Homebrew::EnvConfig.eval_all? - odisabled "brew unbottled --total", "brew unbottled --total --eval-all or HOMEBREW_EVAL_ALL" + odeprecated "brew unbottled --total", "brew unbottled --total --eval-all or HOMEBREW_EVAL_ALL" end all = true end @@ -100,7 +100,7 @@ def formulae_all_installs_from_args(args, all) formulae = all_formulae = args.named.to_formulae elsif args.dependents? if !args.eval_all? && !Homebrew::EnvConfig.eval_all? - odisabled "brew unbottled --dependents", "brew unbottled --all --dependents or HOMEBREW_EVAL_ALL" + odeprecated "brew unbottled --dependents", "brew unbottled --all --dependents or HOMEBREW_EVAL_ALL" end formulae = all_formulae = Formula.all diff --git a/Library/Homebrew/dev-cmd/update-license-data.rb b/Library/Homebrew/dev-cmd/update-license-data.rb index 05326a9ac1622..a83fe60055baa 100644 --- a/Library/Homebrew/dev-cmd/update-license-data.rb +++ b/Library/Homebrew/dev-cmd/update-license-data.rb @@ -28,7 +28,7 @@ def update_license_data_args def update_license_data args = update_license_data_args.parse - odisabled "brew update-license-data --fail-if-not-changed" if args.fail_if_not_changed? + odeprecated "brew update-license-data --fail-if-not-changed" if args.fail_if_not_changed? SPDX.download_latest_license_data! diff = system_command "git", args: [ diff --git a/Library/Homebrew/extend/os/linux/linkage_checker.rb b/Library/Homebrew/extend/os/linux/linkage_checker.rb index bb3ac1cf57f84..2f672353d3688 100644 --- a/Library/Homebrew/extend/os/linux/linkage_checker.rb +++ b/Library/Homebrew/extend/os/linux/linkage_checker.rb @@ -14,6 +14,7 @@ class LinkageChecker libdl.so.2 libm.so.6 libmvec.so.1 + libnsl.so.1 libnss_files.so.2 libpthread.so.0 libresolv.so.2 @@ -40,9 +41,13 @@ def display_deprecated_warning(strict: false) # If there's no library deprecated/disabled handling left: # - Remove the `display_` overrides here and the associated generic aliases in HOMEBREW_LIBRARY/linkage_checker.rb + odisabled "linkage to libcrypt.so.1", "libcrypt.so.2 in the libxcrypt formula" if @libcrypt_found + return unless @libnsl_found - odisabled "linkage to libnsl.so.1", "libnsl.so.3 in the libnsl formula" + odeprecated "linkage to libnsl.so.1", "libnsl.so.3 in the libnsl formula", + disable: fail_on_libnsl1?(strict: strict), + disable_for_developers: false end def display_normal_output @@ -56,14 +61,19 @@ def display_test_output(puts_output: true, strict: false) end def broken_library_linkage?(test: false, strict: false) - generic_broken_library_linkage?(test: test, strict: strict) || @libnsl_found + generic_broken_library_linkage?(test: test, strict: strict) || (fail_on_libnsl1?(strict: strict) && @libnsl_found) end private + def fail_on_libnsl1?(strict:) + strict || ENV["HOMEBREW_DISALLOW_LIBNSL1"].present? + end + def check_dylibs(rebuild_cache:) generic_check_dylibs(rebuild_cache: rebuild_cache) + @libcrypt_found = true if @system_dylibs.any? { |s| File.basename(s) == "libcrypt.so.1" } @libnsl_found = true if @system_dylibs.any? { |s| File.basename(s) == "libnsl.so.1" } # glibc and gcc are implicit dependencies. diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 18e34c6cf37bf..2f481a462368a 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -1017,7 +1017,8 @@ def service_name # The generated launchd {.plist} file path. sig { returns(Pathname) } def plist_path - odeprecated "formula.plist_path", "formula.launchd_service_path" + # TODO: Add deprecation + # odeprecated "formula.plist_path", "formula.launchd_service_path" launchd_service_path end @@ -1835,10 +1836,10 @@ def self.full_names # this should only be used when users specify `--all` to a command # @private def self.all - # TODO: ideally avoid using ARGV by moving to e.g. CLI::Parser - if ARGV.exclude?("--eval-all") && !Homebrew::EnvConfig.eval_all? - odeprecated "Formula#all without --all or HOMEBREW_EVAL_ALL" - end + # TODO: uncomment for 3.7.0 and ideally avoid using ARGV by moving to e.g. CLI::Parser + # if !ARGV.include?("--eval-all") && !Homebrew::EnvConfig.eval_all? + # odeprecated "Formula#all without --all or HOMEBREW_EVAL_ALL" + # end files.map do |file| Formulary.factory(file) @@ -3164,7 +3165,8 @@ def patch(strip = :p1, src = nil, &block) # # @deprecated Please use {Homebrew::Service.require_root} instead. def plist_options(options) - odeprecated "plist_options", "service.require_root" + # TODO: Deprecate + # odeprecated "plist_options", "service.require_root" @plist_startup = options[:startup] @plist_manual = options[:manual] end @@ -3449,7 +3451,6 @@ def link_overwrite(*paths) # 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/formula_installer.rb b/Library/Homebrew/formula_installer.rb index b479a7e8e907c..fa15e9a68e224 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -1051,9 +1051,9 @@ def install_service return unless service - launchd_service_path = formula.launchd_service_path - launchd_service_path.atomic_write(service) - launchd_service_path.chmod 0644 + plist_path = formula.plist_path + plist_path.atomic_write(service) + plist_path.chmod 0644 log = formula.var/"log" log.mkpath if service.include? log.to_s rescue Exception => e # rubocop:disable Lint/RescueException diff --git a/Library/Homebrew/rubocops/components_order.rb b/Library/Homebrew/rubocops/components_order.rb index 6759b22106c3e..d4becfa86f5ff 100644 --- a/Library/Homebrew/rubocops/components_order.rb +++ b/Library/Homebrew/rubocops/components_order.rb @@ -131,6 +131,7 @@ def check_on_system_block_content(component_precedence_list, on_system_block) 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/caveats_spec.rb b/Library/Homebrew/test/caveats_spec.rb index 463c3dd7a052c..ca6de291c75a5 100644 --- a/Library/Homebrew/test/caveats_spec.rb +++ b/Library/Homebrew/test/caveats_spec.rb @@ -44,6 +44,17 @@ def plist expect(described_class.new(f).caveats).to include("provides a launchd plist which can only be used on macOS!") end + it "prints plist startup information when f.plist_startup is not nil" do + f = formula do + url "foo-1.0" + def plist + "plist_test.plist" + end + plist_options startup: true + end + expect(described_class.new(f).caveats).to include("startup") + end + it "prints plist login information when f.plist_startup is nil" do f = formula do url "foo-1.0" @@ -54,6 +65,39 @@ def plist expect(described_class.new(f).caveats).to include("login") end + it "gives information about restarting services after upgrade" do + f = formula do + url "foo-1.0" + def plist + "plist_test.plist" + end + plist_options startup: true + end + f_obj = described_class.new(f) + plist_path = mktmpdir/"plist" + FileUtils.touch plist_path + allow(f_obj).to receive(:plist_path).and_return(plist_path) + allow(Homebrew).to receive(:_system).and_return(true) + allow(Homebrew).to receive(:_system).with("/bin/launchctl list #{f.plist_name} &>/dev/null").and_return(true) + allow(plist_path).to receive(:symlink?).and_return(true) + expect(f_obj.caveats).to include("restart #{f.full_name}") + expect(f_obj.caveats).to include("sudo") + end + + it "gives information about plist_manual" do + f = formula do + url "foo-1.0" + def plist + "plist_test.plist" + end + plist_options manual: "foo" + end + caveats = described_class.new(f).caveats + + expect(caveats).to include("background service") + expect(caveats).to include(f.plist_manual) + end + it "gives information about service" do f = formula do url "foo-1.0" @@ -97,6 +141,7 @@ def plist service do run [bin/"cmd"] end + plist_options startup: true end allow_any_instance_of(Object).to receive(:which).with("launchctl").and_return(nil) @@ -104,13 +149,13 @@ def plist expect(described_class.new(f).caveats).to include("service which can only be used on macOS or systemd!") end - it "prints service startup information when service.require_root is true" do + it "prints service startup information when f.plist_startup is not nil" do f = formula do url "foo-1.0" service do run [bin/"cmd"] - require_root true end + plist_options startup: true end cmd = "#{HOMEBREW_CELLAR}/formula_name/1.0/bin/cmd" allow(Homebrew).to receive(:_system).and_return(true) @@ -131,6 +176,21 @@ def plist expect(described_class.new(f).caveats).to include("login") end + it "gives information about plist_options restarting services after upgrade" do + f = formula do + url "foo-1.0" + service do + run [bin/"cmd"] + end + plist_options startup: true + end + cmd = "#{HOMEBREW_CELLAR}/formula_name/1.0/bin/cmd" + f_obj = described_class.new(f) + allow(Homebrew).to receive(:_system).and_return(true) + expect(Homebrew).to receive(:_system).with("ps aux | grep #{cmd}").and_return(true) + expect(f_obj.caveats).to include(" sudo brew services restart #{f.full_name}") + end + it "gives information about require_root restarting services after upgrade" do f = formula do url "foo-1.0" diff --git a/Library/Homebrew/test/formula_installer_spec.rb b/Library/Homebrew/test/formula_installer_spec.rb index eefe8aff75d3d..2b39cef1df962 100644 --- a/Library/Homebrew/test/formula_installer_spec.rb +++ b/Library/Homebrew/test/formula_installer_spec.rb @@ -203,11 +203,11 @@ class #{Formulary.class_s(dep_name)} < Formula describe "#install_service" do it "works if plist is set" do formula = Testball.new - path = formula.launchd_service_path + path = formula.plist_path formula.opt_prefix.mkpath expect(formula).to receive(:plist).twice.and_return("PLIST") - expect(formula).to receive(:launchd_service_path).and_call_original + expect(formula).to receive(:plist_path).and_call_original installer = described_class.new(formula) expect { @@ -219,7 +219,7 @@ class #{Formulary.class_s(dep_name)} < Formula it "works if service is set" do formula = Testball.new - launchd_service_path = formula.launchd_service_path + plist_path = formula.plist_path service_path = formula.systemd_service_path service = Homebrew::Service.new(formula) formula.opt_prefix.mkpath @@ -227,7 +227,7 @@ class #{Formulary.class_s(dep_name)} < Formula expect(formula).to receive(:plist).and_return(nil) expect(formula).to receive(:service?).exactly(3).and_return(true) expect(formula).to receive(:service).exactly(5).and_return(service) - expect(formula).to receive(:launchd_service_path).and_call_original + expect(formula).to receive(:plist_path).and_call_original expect(formula).to receive(:systemd_service_path).and_call_original expect(service).to receive(:timed?).and_return(false) @@ -240,13 +240,13 @@ class #{Formulary.class_s(dep_name)} < Formula installer.install_service }.not_to output(/Error: Failed to install service files/).to_stderr - expect(launchd_service_path).to exist + expect(plist_path).to exist expect(service_path).to exist end it "works if timed service is set" do formula = Testball.new - launchd_service_path = formula.launchd_service_path + plist_path = formula.plist_path service_path = formula.systemd_service_path timer_path = formula.systemd_timer_path service = Homebrew::Service.new(formula) @@ -255,7 +255,7 @@ class #{Formulary.class_s(dep_name)} < Formula expect(formula).to receive(:plist).and_return(nil) expect(formula).to receive(:service?).exactly(3).and_return(true) expect(formula).to receive(:service).exactly(6).and_return(service) - expect(formula).to receive(:launchd_service_path).and_call_original + expect(formula).to receive(:plist_path).and_call_original expect(formula).to receive(:systemd_service_path).and_call_original expect(formula).to receive(:systemd_timer_path).and_call_original @@ -270,19 +270,19 @@ class #{Formulary.class_s(dep_name)} < Formula installer.install_service }.not_to output(/Error: Failed to install service files/).to_stderr - expect(launchd_service_path).to exist + expect(plist_path).to exist expect(service_path).to exist expect(timer_path).to exist end it "returns without definition" do formula = Testball.new - path = formula.launchd_service_path + path = formula.plist_path formula.opt_prefix.mkpath expect(formula).to receive(:plist).and_return(nil) expect(formula).to receive(:service?).exactly(3).and_return(nil) - expect(formula).not_to receive(:launchd_service_path) + expect(formula).not_to receive(:plist_path) expect(formula).not_to receive(:to_systemd_unit) installer = described_class.new(formula) @@ -295,13 +295,13 @@ class #{Formulary.class_s(dep_name)} < Formula it "errors with duplicate definition" do formula = Testball.new - path = formula.launchd_service_path + path = formula.plist_path formula.opt_prefix.mkpath expect(formula).to receive(:plist).and_return("plist") expect(formula).to receive(:service?).and_return(true) expect(formula).not_to receive(:service) - expect(formula).not_to receive(:launchd_service_path) + expect(formula).not_to receive(:plist_path) installer = described_class.new(formula) expect { diff --git a/Library/Homebrew/test/formula_spec.rb b/Library/Homebrew/test/formula_spec.rb index 6248ca8a9d385..59b344e37bc4c 100644 --- a/Library/Homebrew/test/formula_spec.rb +++ b/Library/Homebrew/test/formula_spec.rb @@ -1845,6 +1845,54 @@ def install 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 diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index cb9aae4e0644b..24651e9579cff 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -398,8 +398,9 @@ def exec_browser(*args) end # GZips the given paths, and returns the gzipped paths. + # TODO: Add deprecation + # odeprecated "Utils.gzip" "Utils::Gzip.compress" def gzip(*paths) - odeprecated "Utils.gzip", "Utils::Gzip.compress" Utils::Gzip.compress(*paths) end