Revert "Add deprecations and disables"
This commit is contained in:
parent
ff5e517949
commit
6882ac17e7
@ -24,10 +24,10 @@ module Cask
|
|||||||
attr_accessor :download, :allow_reassignment
|
attr_accessor :download, :allow_reassignment
|
||||||
|
|
||||||
def self.all
|
def self.all
|
||||||
# TODO: ideally avoid using ARGV by moving to e.g. CLI::Parser
|
# TODO: uncomment for 3.7.0 and ideally avoid using ARGV by moving to e.g. CLI::Parser
|
||||||
if ARGV.exclude?("--eval-all") && !Homebrew::EnvConfig.eval_all?
|
# if !ARGV.include?("--eval-all") && !Homebrew::EnvConfig.eval_all?
|
||||||
odeprecated "Cask::Cask#all without --all or HOMEBREW_EVAL_ALL"
|
# odeprecated "Cask::Cask#all without --all or HOMEBREW_EVAL_ALL"
|
||||||
end
|
# end
|
||||||
|
|
||||||
Tap.flat_map(&:cask_files).map do |f|
|
Tap.flat_map(&:cask_files).map do |f|
|
||||||
CaskLoader::FromTapPathLoader.new(f).load(config: nil)
|
CaskLoader::FromTapPathLoader.new(f).load(config: nil)
|
||||||
|
|||||||
@ -84,8 +84,8 @@ module Homebrew
|
|||||||
all = args.eval_all?
|
all = args.eval_all?
|
||||||
if args.all?
|
if args.all?
|
||||||
unless all
|
unless all
|
||||||
odisabled "brew deps --all",
|
odeprecated "brew deps --all",
|
||||||
"brew deps --eval-all or HOMEBREW_EVAL_ALL"
|
"brew deps --eval-all or HOMEBREW_EVAL_ALL"
|
||||||
end
|
end
|
||||||
all = true
|
all = true
|
||||||
end
|
end
|
||||||
|
|||||||
@ -45,7 +45,7 @@ module Homebrew
|
|||||||
args = desc_args.parse
|
args = desc_args.parse
|
||||||
|
|
||||||
if !args.eval_all? && !Homebrew::EnvConfig.eval_all?
|
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
|
end
|
||||||
|
|
||||||
search_type = if args.search?
|
search_type = if args.search?
|
||||||
|
|||||||
@ -110,7 +110,7 @@ module Homebrew
|
|||||||
elsif args.json
|
elsif args.json
|
||||||
all = args.eval_all?
|
all = args.eval_all?
|
||||||
if !all && args.all? && !Homebrew::EnvConfig.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
|
all = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -38,7 +38,7 @@ module Homebrew
|
|||||||
|
|
||||||
all = args.eval_all?
|
all = args.eval_all?
|
||||||
if args.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
|
all = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -46,7 +46,7 @@ module Homebrew
|
|||||||
options = { aliases: args.aliases?, no_simulate: args.no_simulate? }
|
options = { aliases: args.aliases?, no_simulate: args.no_simulate? }
|
||||||
taps = if args.no_named?
|
taps = if args.no_named?
|
||||||
if !args.eval_all? && !Homebrew::EnvConfig.eval_all?
|
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
|
end
|
||||||
Tap
|
Tap
|
||||||
else
|
else
|
||||||
|
|||||||
@ -78,7 +78,7 @@ module Homebrew
|
|||||||
|
|
||||||
if args.desc?
|
if args.desc?
|
||||||
if !args.eval_all? && !Homebrew::EnvConfig.eval_all?
|
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
|
end
|
||||||
Search.search_descriptions(string_or_regex, args)
|
Search.search_descriptions(string_or_regex, args)
|
||||||
elsif args.pull_request?
|
elsif args.pull_request?
|
||||||
|
|||||||
@ -109,14 +109,14 @@ module Homebrew
|
|||||||
all = args.eval_all?
|
all = args.eval_all?
|
||||||
if args.all?
|
if args.all?
|
||||||
unless all
|
unless all
|
||||||
odisabled "brew uses --all",
|
odeprecated "brew uses --all",
|
||||||
"brew uses --eval-all or HOMEBREW_EVAL_ALL"
|
"brew uses --eval-all or HOMEBREW_EVAL_ALL"
|
||||||
end
|
end
|
||||||
all = true
|
all = true
|
||||||
end
|
end
|
||||||
|
|
||||||
if !args.installed? && !(all || Homebrew::EnvConfig.eval_all?)
|
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
|
end
|
||||||
if show_formulae_and_casks || args.formula?
|
if show_formulae_and_casks || args.formula?
|
||||||
deps += args.installed? ? Formula.installed : Formula.all
|
deps += args.installed? ? Formula.installed : Formula.all
|
||||||
|
|||||||
@ -134,16 +134,17 @@ module Homebrew
|
|||||||
[Formula.installed, Cask::Caskroom.casks]
|
[Formula.installed, Cask::Caskroom.casks]
|
||||||
elsif args.no_named?
|
elsif args.no_named?
|
||||||
if !args.eval_all? && !Homebrew::EnvConfig.eval_all?
|
if !args.eval_all? && !Homebrew::EnvConfig.eval_all?
|
||||||
odisabled "brew audit",
|
odeprecated "brew audit",
|
||||||
"brew audit --eval-all or HOMEBREW_EVAL_ALL"
|
"brew audit --eval-all or HOMEBREW_EVAL_ALL"
|
||||||
end
|
end
|
||||||
no_named_args = true
|
no_named_args = true
|
||||||
[Formula.all, Cask::Cask.all]
|
[Formula.all, Cask::Cask.all]
|
||||||
else
|
else
|
||||||
if args.named.any? { |named_arg| named_arg.end_with?(".rb") }
|
# TODO: Add deprecation
|
||||||
odeprecated "brew audit [path ...]",
|
# if args.named.any? { |named_arg| named_arg.end_with?(".rb") }
|
||||||
"brew audit [name ...]"
|
# odeprecated "brew audit [path ...]",
|
||||||
end
|
# "brew audit [name ...]"
|
||||||
|
# end
|
||||||
|
|
||||||
args.named.to_formulae_and_casks
|
args.named.to_formulae_and_casks
|
||||||
.partition { |formula_or_cask| formula_or_cask.is_a?(Formula) }
|
.partition { |formula_or_cask| formula_or_cask.is_a?(Formula) }
|
||||||
|
|||||||
@ -30,7 +30,7 @@ module Homebrew
|
|||||||
def generate_man_completions
|
def generate_man_completions
|
||||||
args = generate_man_completions_args.parse
|
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
|
Commands.rebuild_internal_commands_completion_list
|
||||||
Manpages.regenerate_man_pages(quiet: args.quiet?)
|
Manpages.regenerate_man_pages(quiet: args.quiet?)
|
||||||
|
|||||||
@ -59,7 +59,7 @@ module Homebrew
|
|||||||
|
|
||||||
all = args.eval_all?
|
all = args.eval_all?
|
||||||
if args.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
|
all = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -51,7 +51,7 @@ module Homebrew
|
|||||||
|
|
||||||
HOMEBREW_LIBRARY_PATH.cd do
|
HOMEBREW_LIBRARY_PATH.cd do
|
||||||
if args.update? || args.update_all?
|
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 = [
|
excluded_gems = [
|
||||||
"did_you_mean", # RBI file is already provided by Sorbet
|
"did_you_mean", # RBI file is already provided by Sorbet
|
||||||
|
|||||||
@ -56,7 +56,7 @@ module Homebrew
|
|||||||
all = args.eval_all?
|
all = args.eval_all?
|
||||||
if args.total?
|
if args.total?
|
||||||
if !all && !Homebrew::EnvConfig.eval_all?
|
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
|
end
|
||||||
all = true
|
all = true
|
||||||
end
|
end
|
||||||
@ -100,7 +100,7 @@ module Homebrew
|
|||||||
formulae = all_formulae = args.named.to_formulae
|
formulae = all_formulae = args.named.to_formulae
|
||||||
elsif args.dependents?
|
elsif args.dependents?
|
||||||
if !args.eval_all? && !Homebrew::EnvConfig.eval_all?
|
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
|
end
|
||||||
formulae = all_formulae = Formula.all
|
formulae = all_formulae = Formula.all
|
||||||
|
|
||||||
|
|||||||
@ -28,7 +28,7 @@ module Homebrew
|
|||||||
|
|
||||||
def update_license_data
|
def update_license_data
|
||||||
args = update_license_data_args.parse
|
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!
|
SPDX.download_latest_license_data!
|
||||||
diff = system_command "git", args: [
|
diff = system_command "git", args: [
|
||||||
|
|||||||
@ -14,6 +14,7 @@ class LinkageChecker
|
|||||||
libdl.so.2
|
libdl.so.2
|
||||||
libm.so.6
|
libm.so.6
|
||||||
libmvec.so.1
|
libmvec.so.1
|
||||||
|
libnsl.so.1
|
||||||
libnss_files.so.2
|
libnss_files.so.2
|
||||||
libpthread.so.0
|
libpthread.so.0
|
||||||
libresolv.so.2
|
libresolv.so.2
|
||||||
@ -40,9 +41,13 @@ class LinkageChecker
|
|||||||
# If there's no library deprecated/disabled handling left:
|
# 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
|
# - 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
|
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
|
end
|
||||||
|
|
||||||
def display_normal_output
|
def display_normal_output
|
||||||
@ -56,14 +61,19 @@ class LinkageChecker
|
|||||||
end
|
end
|
||||||
|
|
||||||
def broken_library_linkage?(test: false, strict: false)
|
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
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def fail_on_libnsl1?(strict:)
|
||||||
|
strict || ENV["HOMEBREW_DISALLOW_LIBNSL1"].present?
|
||||||
|
end
|
||||||
|
|
||||||
def check_dylibs(rebuild_cache:)
|
def check_dylibs(rebuild_cache:)
|
||||||
generic_check_dylibs(rebuild_cache: 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" }
|
@libnsl_found = true if @system_dylibs.any? { |s| File.basename(s) == "libnsl.so.1" }
|
||||||
|
|
||||||
# glibc and gcc are implicit dependencies.
|
# glibc and gcc are implicit dependencies.
|
||||||
|
|||||||
@ -1017,7 +1017,8 @@ class Formula
|
|||||||
# The generated launchd {.plist} file path.
|
# The generated launchd {.plist} file path.
|
||||||
sig { returns(Pathname) }
|
sig { returns(Pathname) }
|
||||||
def plist_path
|
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
|
launchd_service_path
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1835,10 +1836,10 @@ class Formula
|
|||||||
# this should only be used when users specify `--all` to a command
|
# this should only be used when users specify `--all` to a command
|
||||||
# @private
|
# @private
|
||||||
def self.all
|
def self.all
|
||||||
# TODO: ideally avoid using ARGV by moving to e.g. CLI::Parser
|
# TODO: uncomment for 3.7.0 and ideally avoid using ARGV by moving to e.g. CLI::Parser
|
||||||
if ARGV.exclude?("--eval-all") && !Homebrew::EnvConfig.eval_all?
|
# if !ARGV.include?("--eval-all") && !Homebrew::EnvConfig.eval_all?
|
||||||
odeprecated "Formula#all without --all or HOMEBREW_EVAL_ALL"
|
# odeprecated "Formula#all without --all or HOMEBREW_EVAL_ALL"
|
||||||
end
|
# end
|
||||||
|
|
||||||
files.map do |file|
|
files.map do |file|
|
||||||
Formulary.factory(file)
|
Formulary.factory(file)
|
||||||
@ -3164,7 +3165,8 @@ class Formula
|
|||||||
#
|
#
|
||||||
# @deprecated Please use {Homebrew::Service.require_root} instead.
|
# @deprecated Please use {Homebrew::Service.require_root} instead.
|
||||||
def plist_options(options)
|
def plist_options(options)
|
||||||
odeprecated "plist_options", "service.require_root"
|
# TODO: Deprecate
|
||||||
|
# odeprecated "plist_options", "service.require_root"
|
||||||
@plist_startup = options[:startup]
|
@plist_startup = options[:startup]
|
||||||
@plist_manual = options[:manual]
|
@plist_manual = options[:manual]
|
||||||
end
|
end
|
||||||
@ -3449,7 +3451,6 @@ class Formula
|
|||||||
|
|
||||||
# Permit links to certain libraries that don't exist. Available on Linux only.
|
# Permit links to certain libraries that don't exist. Available on Linux only.
|
||||||
def ignore_missing_libraries(*libs)
|
def ignore_missing_libraries(*libs)
|
||||||
odeprecated "ignore_missing_libraries"
|
|
||||||
unless Homebrew::SimulateSystem.simulating_or_running_on_linux?
|
unless Homebrew::SimulateSystem.simulating_or_running_on_linux?
|
||||||
raise FormulaSpecificationError, "#{__method__} is available on Linux only"
|
raise FormulaSpecificationError, "#{__method__} is available on Linux only"
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1051,9 +1051,9 @@ class FormulaInstaller
|
|||||||
|
|
||||||
return unless service
|
return unless service
|
||||||
|
|
||||||
launchd_service_path = formula.launchd_service_path
|
plist_path = formula.plist_path
|
||||||
launchd_service_path.atomic_write(service)
|
plist_path.atomic_write(service)
|
||||||
launchd_service_path.chmod 0644
|
plist_path.chmod 0644
|
||||||
log = formula.var/"log"
|
log = formula.var/"log"
|
||||||
log.mkpath if service.include? log.to_s
|
log.mkpath if service.include? log.to_s
|
||||||
rescue Exception => e # rubocop:disable Lint/RescueException
|
rescue Exception => e # rubocop:disable Lint/RescueException
|
||||||
|
|||||||
@ -131,6 +131,7 @@ module RuboCop
|
|||||||
fails_with
|
fails_with
|
||||||
resource
|
resource
|
||||||
patch
|
patch
|
||||||
|
ignore_missing_libraries
|
||||||
]
|
]
|
||||||
on_system_allowed_methods += on_system_methods.map(&:to_s)
|
on_system_allowed_methods += on_system_methods.map(&:to_s)
|
||||||
_, offensive_node = check_order(component_precedence_list, on_system_block.body)
|
_, offensive_node = check_order(component_precedence_list, on_system_block.body)
|
||||||
|
|||||||
@ -44,6 +44,17 @@ describe Caveats do
|
|||||||
expect(described_class.new(f).caveats).to include("provides a launchd plist which can only be used on macOS!")
|
expect(described_class.new(f).caveats).to include("provides a launchd plist which can only be used on macOS!")
|
||||||
end
|
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
|
it "prints plist login information when f.plist_startup is nil" do
|
||||||
f = formula do
|
f = formula do
|
||||||
url "foo-1.0"
|
url "foo-1.0"
|
||||||
@ -54,6 +65,39 @@ describe Caveats do
|
|||||||
expect(described_class.new(f).caveats).to include("login")
|
expect(described_class.new(f).caveats).to include("login")
|
||||||
end
|
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
|
it "gives information about service" do
|
||||||
f = formula do
|
f = formula do
|
||||||
url "foo-1.0"
|
url "foo-1.0"
|
||||||
@ -97,6 +141,7 @@ describe Caveats do
|
|||||||
service do
|
service do
|
||||||
run [bin/"cmd"]
|
run [bin/"cmd"]
|
||||||
end
|
end
|
||||||
|
plist_options startup: true
|
||||||
end
|
end
|
||||||
|
|
||||||
allow_any_instance_of(Object).to receive(:which).with("launchctl").and_return(nil)
|
allow_any_instance_of(Object).to receive(:which).with("launchctl").and_return(nil)
|
||||||
@ -104,13 +149,13 @@ describe Caveats do
|
|||||||
expect(described_class.new(f).caveats).to include("service which can only be used on macOS or systemd!")
|
expect(described_class.new(f).caveats).to include("service which can only be used on macOS or systemd!")
|
||||||
end
|
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
|
f = formula do
|
||||||
url "foo-1.0"
|
url "foo-1.0"
|
||||||
service do
|
service do
|
||||||
run [bin/"cmd"]
|
run [bin/"cmd"]
|
||||||
require_root true
|
|
||||||
end
|
end
|
||||||
|
plist_options startup: true
|
||||||
end
|
end
|
||||||
cmd = "#{HOMEBREW_CELLAR}/formula_name/1.0/bin/cmd"
|
cmd = "#{HOMEBREW_CELLAR}/formula_name/1.0/bin/cmd"
|
||||||
allow(Homebrew).to receive(:_system).and_return(true)
|
allow(Homebrew).to receive(:_system).and_return(true)
|
||||||
@ -131,6 +176,21 @@ describe Caveats do
|
|||||||
expect(described_class.new(f).caveats).to include("login")
|
expect(described_class.new(f).caveats).to include("login")
|
||||||
end
|
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
|
it "gives information about require_root restarting services after upgrade" do
|
||||||
f = formula do
|
f = formula do
|
||||||
url "foo-1.0"
|
url "foo-1.0"
|
||||||
|
|||||||
@ -203,11 +203,11 @@ describe FormulaInstaller do
|
|||||||
describe "#install_service" do
|
describe "#install_service" do
|
||||||
it "works if plist is set" do
|
it "works if plist is set" do
|
||||||
formula = Testball.new
|
formula = Testball.new
|
||||||
path = formula.launchd_service_path
|
path = formula.plist_path
|
||||||
formula.opt_prefix.mkpath
|
formula.opt_prefix.mkpath
|
||||||
|
|
||||||
expect(formula).to receive(:plist).twice.and_return("PLIST")
|
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)
|
installer = described_class.new(formula)
|
||||||
expect {
|
expect {
|
||||||
@ -219,7 +219,7 @@ describe FormulaInstaller do
|
|||||||
|
|
||||||
it "works if service is set" do
|
it "works if service is set" do
|
||||||
formula = Testball.new
|
formula = Testball.new
|
||||||
launchd_service_path = formula.launchd_service_path
|
plist_path = formula.plist_path
|
||||||
service_path = formula.systemd_service_path
|
service_path = formula.systemd_service_path
|
||||||
service = Homebrew::Service.new(formula)
|
service = Homebrew::Service.new(formula)
|
||||||
formula.opt_prefix.mkpath
|
formula.opt_prefix.mkpath
|
||||||
@ -227,7 +227,7 @@ describe FormulaInstaller do
|
|||||||
expect(formula).to receive(:plist).and_return(nil)
|
expect(formula).to receive(:plist).and_return(nil)
|
||||||
expect(formula).to receive(:service?).exactly(3).and_return(true)
|
expect(formula).to receive(:service?).exactly(3).and_return(true)
|
||||||
expect(formula).to receive(:service).exactly(5).and_return(service)
|
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(formula).to receive(:systemd_service_path).and_call_original
|
||||||
|
|
||||||
expect(service).to receive(:timed?).and_return(false)
|
expect(service).to receive(:timed?).and_return(false)
|
||||||
@ -240,13 +240,13 @@ describe FormulaInstaller do
|
|||||||
installer.install_service
|
installer.install_service
|
||||||
}.not_to output(/Error: Failed to install service files/).to_stderr
|
}.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(service_path).to exist
|
||||||
end
|
end
|
||||||
|
|
||||||
it "works if timed service is set" do
|
it "works if timed service is set" do
|
||||||
formula = Testball.new
|
formula = Testball.new
|
||||||
launchd_service_path = formula.launchd_service_path
|
plist_path = formula.plist_path
|
||||||
service_path = formula.systemd_service_path
|
service_path = formula.systemd_service_path
|
||||||
timer_path = formula.systemd_timer_path
|
timer_path = formula.systemd_timer_path
|
||||||
service = Homebrew::Service.new(formula)
|
service = Homebrew::Service.new(formula)
|
||||||
@ -255,7 +255,7 @@ describe FormulaInstaller do
|
|||||||
expect(formula).to receive(:plist).and_return(nil)
|
expect(formula).to receive(:plist).and_return(nil)
|
||||||
expect(formula).to receive(:service?).exactly(3).and_return(true)
|
expect(formula).to receive(:service?).exactly(3).and_return(true)
|
||||||
expect(formula).to receive(:service).exactly(6).and_return(service)
|
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_service_path).and_call_original
|
||||||
expect(formula).to receive(:systemd_timer_path).and_call_original
|
expect(formula).to receive(:systemd_timer_path).and_call_original
|
||||||
|
|
||||||
@ -270,19 +270,19 @@ describe FormulaInstaller do
|
|||||||
installer.install_service
|
installer.install_service
|
||||||
}.not_to output(/Error: Failed to install service files/).to_stderr
|
}.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(service_path).to exist
|
||||||
expect(timer_path).to exist
|
expect(timer_path).to exist
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns without definition" do
|
it "returns without definition" do
|
||||||
formula = Testball.new
|
formula = Testball.new
|
||||||
path = formula.launchd_service_path
|
path = formula.plist_path
|
||||||
formula.opt_prefix.mkpath
|
formula.opt_prefix.mkpath
|
||||||
|
|
||||||
expect(formula).to receive(:plist).and_return(nil)
|
expect(formula).to receive(:plist).and_return(nil)
|
||||||
expect(formula).to receive(:service?).exactly(3).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)
|
expect(formula).not_to receive(:to_systemd_unit)
|
||||||
|
|
||||||
installer = described_class.new(formula)
|
installer = described_class.new(formula)
|
||||||
@ -295,13 +295,13 @@ describe FormulaInstaller do
|
|||||||
|
|
||||||
it "errors with duplicate definition" do
|
it "errors with duplicate definition" do
|
||||||
formula = Testball.new
|
formula = Testball.new
|
||||||
path = formula.launchd_service_path
|
path = formula.plist_path
|
||||||
formula.opt_prefix.mkpath
|
formula.opt_prefix.mkpath
|
||||||
|
|
||||||
expect(formula).to receive(:plist).and_return("plist")
|
expect(formula).to receive(:plist).and_return("plist")
|
||||||
expect(formula).to receive(:service?).and_return(true)
|
expect(formula).to receive(:service?).and_return(true)
|
||||||
expect(formula).not_to receive(:service)
|
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)
|
installer = described_class.new(formula)
|
||||||
expect {
|
expect {
|
||||||
|
|||||||
@ -1845,6 +1845,54 @@ describe Formula do
|
|||||||
end
|
end
|
||||||
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
|
describe "#generate_completions_from_executable" do
|
||||||
let(:f) do
|
let(:f) do
|
||||||
Class.new(Testball) do
|
Class.new(Testball) do
|
||||||
|
|||||||
@ -398,8 +398,9 @@ module Kernel
|
|||||||
end
|
end
|
||||||
|
|
||||||
# GZips the given paths, and returns the gzipped paths.
|
# GZips the given paths, and returns the gzipped paths.
|
||||||
|
# TODO: Add deprecation
|
||||||
|
# odeprecated "Utils.gzip" "Utils::Gzip.compress"
|
||||||
def gzip(*paths)
|
def gzip(*paths)
|
||||||
odeprecated "Utils.gzip", "Utils::Gzip.compress"
|
|
||||||
Utils::Gzip.compress(*paths)
|
Utils::Gzip.compress(*paths)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user