Add deprecations and disables

Do the usual dance:
- commented `odeprecated` to `odeprecated`
- `odeprecated` to `odisabled`
- `odisabled` removed
This commit is contained in:
Mike McQuaid 2023-01-20 09:06:12 +00:00
parent b009077c14
commit 59c03cb2a6
No known key found for this signature in database
GPG Key ID: 3338A31AFDB1D829
17 changed files with 33 additions and 47 deletions

View File

@ -24,10 +24,10 @@ module Cask
attr_accessor :download, :allow_reassignment
def self.all
# 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
# 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
Tap.flat_map(&:cask_files).map do |f|
CaskLoader::FromTapPathLoader.new(f).load(config: nil)

View File

@ -84,8 +84,8 @@ module Homebrew
all = args.eval_all?
if args.all?
unless all
odeprecated "brew deps --all",
"brew deps --eval-all or HOMEBREW_EVAL_ALL"
odisabled "brew deps --all",
"brew deps --eval-all or HOMEBREW_EVAL_ALL"
end
all = true
end

View File

@ -45,7 +45,7 @@ module Homebrew
args = desc_args.parse
if !args.eval_all? && !Homebrew::EnvConfig.eval_all?
odeprecated "brew desc", "brew desc --eval-all or HOMEBREW_EVAL_ALL"
odisabled "brew desc", "brew desc --eval-all or HOMEBREW_EVAL_ALL"
end
search_type = if args.search?

View File

@ -110,7 +110,7 @@ module Homebrew
elsif args.json
all = args.eval_all?
if !all && args.all? && !Homebrew::EnvConfig.eval_all?
odeprecated "brew info --all", "brew info --eval-all or HOMEBREW_EVAL_ALL"
odisabled "brew info --all", "brew info --eval-all or HOMEBREW_EVAL_ALL"
all = true
end

View File

@ -38,7 +38,7 @@ module Homebrew
all = args.eval_all?
if args.all?
odeprecated "brew info --all", "brew info --eval-all" if !all && !Homebrew::EnvConfig.eval_all?
odisabled "brew info --all", "brew info --eval-all" if !all && !Homebrew::EnvConfig.eval_all?
all = true
end

View File

@ -46,7 +46,7 @@ module Homebrew
options = { aliases: args.aliases?, no_simulate: args.no_simulate? }
taps = if args.no_named?
if !args.eval_all? && !Homebrew::EnvConfig.eval_all?
odeprecated "brew readall", "brew readall --eval-all or HOMEBREW_EVAL_ALL"
odisabled "brew readall", "brew readall --eval-all or HOMEBREW_EVAL_ALL"
end
Tap
else

View File

@ -78,7 +78,7 @@ module Homebrew
if args.desc?
if !args.eval_all? && !Homebrew::EnvConfig.eval_all?
odeprecated "brew search --desc", "brew search --desc --eval-all or HOMEBREW_EVAL_ALL"
odisabled "brew search --desc", "brew search --desc --eval-all or HOMEBREW_EVAL_ALL"
end
Search.search_descriptions(string_or_regex, args)
elsif args.pull_request?

View File

@ -109,14 +109,14 @@ module Homebrew
all = args.eval_all?
if args.all?
unless all
odeprecated "brew uses --all",
"brew uses --eval-all or HOMEBREW_EVAL_ALL"
odisabled "brew uses --all",
"brew uses --eval-all or HOMEBREW_EVAL_ALL"
end
all = true
end
if !args.installed? && !(all || Homebrew::EnvConfig.eval_all?)
odeprecated "brew uses", "brew uses --eval-all or HOMEBREW_EVAL_ALL"
odisabled "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

View File

@ -134,17 +134,16 @@ module Homebrew
[Formula.installed, Cask::Caskroom.casks]
elsif args.no_named?
if !args.eval_all? && !Homebrew::EnvConfig.eval_all?
odeprecated "brew audit",
"brew audit --eval-all or HOMEBREW_EVAL_ALL"
odisabled "brew audit",
"brew audit --eval-all or HOMEBREW_EVAL_ALL"
end
no_named_args = true
[Formula.all, Cask::Cask.all]
else
# TODO: Add deprecation
# if args.named.any? { |named_arg| named_arg.end_with?(".rb") }
# odeprecated "brew audit [path ...]",
# "brew audit [name ...]"
# end
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) }

View File

@ -30,7 +30,7 @@ module Homebrew
def generate_man_completions
args = generate_man_completions_args.parse
odeprecated "brew generate-man-completions --fail-if-not-changed" if args.fail_if_not_changed?
odisabled "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?)

View File

@ -59,7 +59,7 @@ module Homebrew
all = args.eval_all?
if args.all?
odeprecated "brew livecheck --all", "brew livecheck --eval-all" if !all && !Homebrew::EnvConfig.eval_all?
odisabled "brew livecheck --all", "brew livecheck --eval-all" if !all && !Homebrew::EnvConfig.eval_all?
all = true
end

View File

@ -51,7 +51,7 @@ module Homebrew
HOMEBREW_LIBRARY_PATH.cd do
if args.update? || args.update_all?
odeprecated "brew typecheck --update --fail-if-not-changed" if args.fail_if_not_changed?
odisabled "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

View File

@ -56,7 +56,7 @@ module Homebrew
all = args.eval_all?
if args.total?
if !all && !Homebrew::EnvConfig.eval_all?
odeprecated "brew unbottled --total", "brew unbottled --total --eval-all or HOMEBREW_EVAL_ALL"
odisabled "brew unbottled --total", "brew unbottled --total --eval-all or HOMEBREW_EVAL_ALL"
end
all = true
end
@ -100,7 +100,7 @@ module Homebrew
formulae = all_formulae = args.named.to_formulae
elsif args.dependents?
if !args.eval_all? && !Homebrew::EnvConfig.eval_all?
odeprecated "brew unbottled --dependents", "brew unbottled --all --dependents or HOMEBREW_EVAL_ALL"
odisabled "brew unbottled --dependents", "brew unbottled --all --dependents or HOMEBREW_EVAL_ALL"
end
formulae = all_formulae = Formula.all

View File

@ -28,7 +28,7 @@ module Homebrew
def update_license_data
args = update_license_data_args.parse
odeprecated "brew update-license-data --fail-if-not-changed" if args.fail_if_not_changed?
odisabled "brew update-license-data --fail-if-not-changed" if args.fail_if_not_changed?
SPDX.download_latest_license_data!
diff = system_command "git", args: [

View File

@ -14,7 +14,6 @@ class LinkageChecker
libdl.so.2
libm.so.6
libmvec.so.1
libnsl.so.1
libnss_files.so.2
libpthread.so.0
libresolv.so.2
@ -41,13 +40,9 @@ class LinkageChecker
# 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
odeprecated "linkage to libnsl.so.1", "libnsl.so.3 in the libnsl formula",
disable: fail_on_libnsl1?(strict: strict),
disable_for_developers: false
odisabled "linkage to libnsl.so.1", "libnsl.so.3 in the libnsl formula"
end
def display_normal_output
@ -61,19 +56,14 @@ class LinkageChecker
end
def broken_library_linkage?(test: false, strict: false)
generic_broken_library_linkage?(test: test, strict: strict) || (fail_on_libnsl1?(strict: strict) && @libnsl_found)
generic_broken_library_linkage?(test: test, 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.

View File

@ -1017,7 +1017,6 @@ class Formula
# The generated launchd {.plist} file path.
sig { returns(Pathname) }
def plist_path
# TODO: Add deprecation
# odeprecated "formula.plist_path", "formula.launchd_service_path"
launchd_service_path
end
@ -1836,10 +1835,10 @@ class Formula
# this should only be used when users specify `--all` to a command
# @private
def self.all
# 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
# 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
files.map do |file|
Formulary.factory(file)
@ -3153,7 +3152,6 @@ class Formula
#
# @deprecated Please use {Homebrew::Service.require_root} instead.
def plist_options(options)
# TODO: Deprecate
# odeprecated "plist_options", "service.require_root"
@plist_startup = options[:startup]
@plist_manual = options[:manual]

View File

@ -398,9 +398,8 @@ module Kernel
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