Deprecate/disable/delete code.

The next release after this is merged will be 4.1.0.

Co-authored-by: Markus Reiter <me@reitermark.us>
This commit is contained in:
Mike McQuaid 2023-07-06 16:47:09 +01:00
parent 5121567a9a
commit 7da934f7e2
No known key found for this signature in database
GPG Key ID: 3338A31AFDB1D829
57 changed files with 125 additions and 254 deletions

View File

@ -265,13 +265,6 @@ module Cask
add_error "cannot use the sha256 for an empty string: #{empty_sha256}" add_error "cannot use the sha256 for an empty string: #{empty_sha256}"
end end
sig { void }
def audit_appcast
return unless cask.appcast
add_error "`appcast` should be replaced with a `livecheck`."
end
sig { void } sig { void }
def audit_latest_with_livecheck def audit_latest_with_livecheck
return unless cask.version.latest? return unless cask.version.latest?

View File

@ -26,7 +26,7 @@ module Cask
def self.all def self.all
# TODO: ideally avoid using ARGV by moving to e.g. CLI::Parser # TODO: ideally avoid using ARGV by moving to e.g. CLI::Parser
if ARGV.exclude?("--eval-all") && !Homebrew::EnvConfig.eval_all? if ARGV.exclude?("--eval-all") && !Homebrew::EnvConfig.eval_all?
odeprecated "Cask::Cask#all without --all or HOMEBREW_EVAL_ALL" odisabled "Cask::Cask#all without --eval-all or HOMEBREW_EVAL_ALL"
end end
Tap.flat_map(&:cask_files).map do |f| Tap.flat_map(&:cask_files).map do |f|

View File

@ -34,7 +34,7 @@ module Cask
sig { override.returns(T.nilable(Version)) } sig { override.returns(T.nilable(Version)) }
def version def version
@version ||= Version.create(cask.version) @version ||= Version.new(cask.version)
end end
sig { sig {

View File

@ -211,8 +211,7 @@ module Cask
# @api public # @api public
def appcast(*args, **kwargs) def appcast(*args, **kwargs)
set_unique_stanza(:appcast, args.empty? && kwargs.empty?) do set_unique_stanza(:appcast, args.empty? && kwargs.empty?) do
# TODO: Remove the remaining audit for `appcast` usage when enabling this deprecation. odeprecated "the `appcast` stanza", "the `livecheck` stanza"
# odeprecated "the `appcast` stanza", "the `livecheck` stanza"
true true
end end
end end

View File

@ -11,8 +11,8 @@ module Cask
class Postflight < Base class Postflight < Base
include Staged include Staged
def suppress_move_to_applications(options = {}) def suppress_move_to_applications(_options = {})
# TODO: Remove from all casks because it is no longer needed odeprecated "Cask::DSL#suppress_move_to_applications"
end end
end end
end end

View File

@ -112,7 +112,7 @@ module Homebrew
skip_invalid_combinations = true skip_invalid_combinations = true
[ [
*MacOSVersions::SYMBOLS.keys, *MacOSVersion::SYMBOLS.keys,
:linux, :linux,
] ]
else else

View File

@ -166,6 +166,7 @@ module Homebrew
description += " (disabled#{"; replaced by #{replacement}" if replacement.present?})" description += " (disabled#{"; replaced by #{replacement}" if replacement.present?})"
end end
@parser.public_send(method, *names, *wrap_option_desc(description)) do |value| @parser.public_send(method, *names, *wrap_option_desc(description)) do |value|
# This odeprecated should stick around indefinitely.
odeprecated "the `#{names.first}` switch", replacement, disable: disable if !replacement.nil? || disable odeprecated "the `#{names.first}` switch", replacement, disable: disable if !replacement.nil? || disable
value = true if names.none? { |name| name.start_with?("--[no-]") } value = true if names.none? { |name| name.start_with?("--[no-]") }
@ -224,6 +225,7 @@ module Homebrew
description += " (disabled#{"; replaced by #{replacement}" if replacement.present?})" description += " (disabled#{"; replaced by #{replacement}" if replacement.present?})"
end end
@parser.on(*names, *wrap_option_desc(description), required) do |option_value| @parser.on(*names, *wrap_option_desc(description), required) do |option_value|
# This odisabled should stick around indefinitely.
odisabled "the `#{names.first}` flag", replacement unless replacement.nil? odisabled "the `#{names.first}` flag", replacement unless replacement.nil?
names.each do |name| names.each do |name|
@args[option_to_name(name)] = option_value @args[option_to_name(name)] = option_value

View File

@ -27,7 +27,8 @@ module Homebrew
switch "--force-bottle", switch "--force-bottle",
description: "Show the cache file used when pouring a bottle." description: "Show the cache file used when pouring a bottle."
flag "--bottle-tag=", flag "--bottle-tag=",
description: "Show the cache file used when pouring a bottle for the given tag." description: "Show the cache file used when pouring a bottle for the given tag.",
hidden: true
switch "--HEAD", switch "--HEAD",
description: "Show the cache file used when building from HEAD." description: "Show the cache file used when building from HEAD."
switch "--formula", "--formulae", switch "--formula", "--formulae",
@ -96,7 +97,7 @@ module Homebrew
arch: args.arch&.to_sym, arch: args.arch&.to_sym,
) )
bottle_tag = if (bottle_tag = args.bottle_tag&.to_sym) bottle_tag = if (bottle_tag = args.bottle_tag&.to_sym)
# TODO: odeprecate "--bottle-tag" odeprecated "brew --cache --bottle-tag", "brew --cache --os --arch"
Utils::Bottles::Tag.from_symbol(bottle_tag) Utils::Bottles::Tag.from_symbol(bottle_tag)
else else
Utils::Bottles::Tag.new(system: os, arch: arch) Utils::Bottles::Tag.new(system: os, arch: arch)

View File

@ -54,8 +54,6 @@ module Homebrew
switch "--eval-all", switch "--eval-all",
description: "Evaluate all available formulae and casks, whether installed or not, to list " \ description: "Evaluate all available formulae and casks, whether installed or not, to list " \
"their dependencies." "their dependencies."
switch "--all",
hidden: true
switch "--for-each", switch "--for-each",
description: "Switch into the mode used by the `--all` option, but only list dependencies " \ description: "Switch into the mode used by the `--all` option, but only list dependencies " \
"for each provided <formula>, one formula per line. This is used for " \ "for each provided <formula>, one formula per line. This is used for " \
@ -80,13 +78,6 @@ module Homebrew
args = deps_args.parse args = deps_args.parse
all = args.eval_all? all = args.eval_all?
if args.all?
unless all
odisabled "brew deps --all",
"brew deps --eval-all or HOMEBREW_EVAL_ALL"
end
all = true
end
Formulary.enable_factory_cache! Formulary.enable_factory_cache!

View File

@ -43,7 +43,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" raise UsageError, "`brew desc` needs `--eval-all` passed or `HOMEBREW_EVAL_ALL` set!"
end end
search_type = if args.search? search_type = if args.search?

View File

@ -59,9 +59,6 @@ module Homebrew
depends_on: "--json", depends_on: "--json",
description: "Evaluate all available formulae and casks, whether installed or not, to print their " \ description: "Evaluate all available formulae and casks, whether installed or not, to print their " \
"JSON. Implied if `HOMEBREW_EVAL_ALL` is set." "JSON. Implied if `HOMEBREW_EVAL_ALL` is set."
switch "--all",
hidden: true,
depends_on: "--json"
switch "--variations", switch "--variations",
depends_on: "--json", depends_on: "--json",
description: "Include the variations hash in each formula's JSON output." description: "Include the variations hash in each formula's JSON output."
@ -103,10 +100,6 @@ module Homebrew
print_analytics(args: args) print_analytics(args: args)
elsif args.json elsif args.json
all = args.eval_all? all = args.eval_all?
if !all && args.all? && !Homebrew::EnvConfig.eval_all?
odisabled "brew info --all", "brew info --eval-all or HOMEBREW_EVAL_ALL"
all = true
end
print_json(all, args: args) print_json(all, args: args)
elsif args.github? elsif args.github?

View File

@ -170,6 +170,7 @@ module Homebrew
# Can't use `replacement: false` because `install_args` are used by # Can't use `replacement: false` because `install_args` are used by
# `build.rb`. Instead, `hide_from_man_page` and don't do anything with # `build.rb`. Instead, `hide_from_man_page` and don't do anything with
# this argument here. # this argument here.
# This odisabled should stick around indefinitely.
odisabled "brew install --env", "`env :std` in specific formula files" odisabled "brew install --env", "`env :std` in specific formula files"
end end

View File

@ -20,8 +20,6 @@ module Homebrew
switch "--eval-all", switch "--eval-all",
description: "Evaluate all available formulae and casks, whether installed or not, to show their " \ description: "Evaluate all available formulae and casks, whether installed or not, to show their " \
"options." "options."
switch "--all",
hidden: true
flag "--command=", flag "--command=",
description: "Show options for the specified <command>." description: "Show options for the specified <command>."
@ -35,10 +33,6 @@ module Homebrew
args = options_args.parse args = options_args.parse
all = args.eval_all? all = args.eval_all?
if args.all?
odisabled "brew info --all", "brew info --eval-all" if !all && !Homebrew::EnvConfig.eval_all?
all = true
end
if all if all
puts_options Formula.all.sort, args: args puts_options Formula.all.sort, args: args

View File

@ -38,9 +38,7 @@ module Homebrew
def readall def readall
args = readall_args.parse args = readall_args.parse
if args.no_simulate? odeprecated "--no-simulate", "nothing (i.e. not passing `--os` or `--arch`)" if args.no_simulate?
# odeprecated "--no-simulate", "nothing (i.e. not passing `--os` or `--arch`)"
end
if args.syntax? && args.no_named? if args.syntax? && args.no_named?
scan_files = "#{HOMEBREW_LIBRARY_PATH}/**/*.rb" scan_files = "#{HOMEBREW_LIBRARY_PATH}/**/*.rb"
@ -57,8 +55,9 @@ module Homebrew
options[:os_arch_combinations] = args.os_arch_combinations if args.os || args.arch options[:os_arch_combinations] = args.os_arch_combinations if args.os || args.arch
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" raise UsageError, "`brew readall` needs a tap or `--eval-all` passed or `HOMEBREW_EVAL_ALL` set!"
end end
Tap Tap
else else
args.named.to_installed_taps args.named.to_installed_taps

View File

@ -75,8 +75,9 @@ 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" raise UsageError, "`brew search --desc` needs `--eval-all` passed or `HOMEBREW_EVAL_ALL` set!"
end end
Search.search_descriptions(string_or_regex, args) Search.search_descriptions(string_or_regex, args)
elsif args.pull_request? elsif args.pull_request?
search_pull_requests(query, args) search_pull_requests(query, args)

View File

@ -743,7 +743,7 @@ class ReporterHub
def dump(auto_update: false) def dump(auto_update: false)
report_all = ENV["HOMEBREW_UPDATE_REPORT_ALL_FORMULAE"].present? report_all = ENV["HOMEBREW_UPDATE_REPORT_ALL_FORMULAE"].present?
if report_all && !Homebrew::EnvConfig.no_install_from_api? if report_all && !Homebrew::EnvConfig.no_install_from_api?
odeprecated "HOMEBREW_UPDATE_REPORT_ALL_FORMULAE" odisabled "HOMEBREW_UPDATE_REPORT_ALL_FORMULAE"
opoo "This will not report all formulae because Homebrew cannot get this data from the API." opoo "This will not report all formulae because Homebrew cannot get this data from the API."
report_all = false report_all = false
end end

View File

@ -32,8 +32,6 @@ module Homebrew
switch "--eval-all", switch "--eval-all",
description: "Evaluate all available formulae and casks, whether installed or not, to show " \ description: "Evaluate all available formulae and casks, whether installed or not, to show " \
"their dependents." "their dependents."
switch "--all",
hidden: true
switch "--include-build", switch "--include-build",
description: "Include all formulae that specify <formula> as `:build` type dependency." description: "Include all formulae that specify <formula> as `:build` type dependency."
switch "--include-test", switch "--include-test",
@ -110,17 +108,11 @@ module Homebrew
deps deps
else else
all = args.eval_all? all = args.eval_all?
if args.all?
unless 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?) if !args.installed? && !(all || Homebrew::EnvConfig.eval_all?)
odisabled "brew uses", "brew uses --eval-all or HOMEBREW_EVAL_ALL" raise UsageError, "`brew uses` needs `--installed` or `--eval-all` passed or `HOMEBREW_EVAL_ALL` set!"
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
end end

View File

@ -44,15 +44,10 @@ module Homebrew
switch "--eval-all", switch "--eval-all",
description: "Evaluate all available formulae and casks, whether installed or not, to audit them. " \ description: "Evaluate all available formulae and casks, whether installed or not, to audit them. " \
"Implied if `HOMEBREW_EVAL_ALL` is set." "Implied if `HOMEBREW_EVAL_ALL` is set."
switch "--all",
hidden: true
switch "--new", "--new-formula", "--new-cask", switch "--new", "--new-formula", "--new-cask",
description: "Run various additional style checks to determine if a new formula or cask is eligible " \ description: "Run various additional style checks to determine if a new formula or cask is eligible " \
"for Homebrew. This should be used when creating new formula and implies " \ "for Homebrew. This should be used when creating new formula and implies " \
"`--strict` and `--online`." "`--strict` and `--online`."
switch "--[no-]appcast",
description: "Audit the appcast.",
replacement: false
switch "--[no-]signing", switch "--[no-]signing",
description: "Audit for signed apps, which are required on ARM" description: "Audit for signed apps, which are required on ARM"
switch "--token-conflicts", switch "--token-conflicts",
@ -136,6 +131,7 @@ 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?
# This odisabled should probably stick around indefinitely.
odisabled "brew audit", odisabled "brew audit",
"brew audit --eval-all or HOMEBREW_EVAL_ALL" "brew audit --eval-all or HOMEBREW_EVAL_ALL"
end end
@ -143,8 +139,8 @@ module Homebrew
[Formula.all, Cask::Cask.all] [Formula.all, Cask::Cask.all]
else else
if args.named.any? { |named_arg| named_arg.end_with?(".rb") } if args.named.any? { |named_arg| named_arg.end_with?(".rb") }
odeprecated "brew audit [path ...]", odisabled "brew audit [path ...]",
"brew audit [name ...]" "brew audit [name ...]"
end end
args.named.to_formulae_and_casks args.named.to_formulae_and_casks
@ -235,7 +231,7 @@ module Homebrew
require "cask/auditor" require "cask/auditor"
if args.display_failures_only? if args.display_failures_only?
odeprecated "`brew audit <cask> --display-failures-only`", "`brew audit <cask>` without the argument" odisabled "`brew audit <cask> --display-failures-only`", "`brew audit <cask>` without the argument"
end end
end end

View File

@ -474,7 +474,7 @@ module Homebrew
name, old_alias_version = versioned_alias.split("@") name, old_alias_version = versioned_alias.split("@")
new_alias_regex = (old_alias_version.split(".").length == 1) ? /^\d+/ : /^\d+\.\d+/ new_alias_regex = (old_alias_version.split(".").length == 1) ? /^\d+/ : /^\d+\.\d+/
new_alias_version, = *new_formula_version.to_s.match(new_alias_regex) new_alias_version, = *new_formula_version.to_s.match(new_alias_regex)
return if Version.create(new_alias_version) <= Version.create(old_alias_version) return if Version.new(new_alias_version) <= Version.new(old_alias_version)
[versioned_alias, "#{name}@#{new_alias_version}"] [versioned_alias, "#{name}@#{new_alias_version}"]
end end

View File

@ -101,7 +101,7 @@ module Homebrew
raise Cask::CaskAlreadyCreatedError, token if cask_path.exist? raise Cask::CaskAlreadyCreatedError, token if cask_path.exist?
version = if args.set_version version = if args.set_version
Version.create(args.set_version) Version.new(args.set_version)
else else
Version.detect(url.gsub(token, "").gsub(/x86(_64)?/, "")) Version.detect(url.gsub(token, "").gsub(/x86(_64)?/, ""))
end end

View File

@ -14,12 +14,6 @@ module Homebrew
description <<~EOS description <<~EOS
Generate Homebrew's manpages and shell completions. Generate Homebrew's manpages and shell completions.
EOS EOS
switch "--fail-if-not-changed",
hidden: true,
description: "Return a failing status code if no changes are detected in the manpage outputs. " \
"This can be used to notify CI when the manpages are out of date. Additionally, " \
"the date used in new manpages will match those in the existing manpages (to allow " \
"comparison without factoring in the date)."
named_args :none named_args :none
end end
end end
@ -27,8 +21,6 @@ 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?
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?)
Completions.update_shell_completions! Completions.update_shell_completions!

View File

@ -27,8 +27,6 @@ module Homebrew
description: "Check formulae and casks within the given tap, specified as <user>`/`<repo>." description: "Check formulae and casks within the given tap, specified as <user>`/`<repo>."
switch "--eval-all", switch "--eval-all",
description: "Evaluate all available formulae and casks, whether installed or not, to check them." description: "Evaluate all available formulae and casks, whether installed or not, to check them."
switch "--all",
hidden: true
switch "--installed", switch "--installed",
description: "Check formulae and casks that are currently installed." description: "Check formulae and casks that are currently installed."
switch "--newer-only", switch "--newer-only",
@ -56,10 +54,6 @@ module Homebrew
args = livecheck_args.parse args = livecheck_args.parse
all = args.eval_all? all = args.eval_all?
if args.all?
odisabled "brew livecheck --all", "brew livecheck --eval-all" if !all && !Homebrew::EnvConfig.eval_all?
all = true
end
if args.debug? && args.verbose? if args.debug? && args.verbose?
puts args puts args

View File

@ -39,7 +39,7 @@ module Homebrew
def pr_publish def pr_publish
args = pr_publish_args.parse args = pr_publish_args.parse
odeprecated "`brew pr-publish --no-autosquash`" if args.no_autosquash? odisabled "`brew pr-publish --no-autosquash`" if args.no_autosquash?
tap = Tap.fetch(args.tap || CoreTap.instance.name) tap = Tap.fetch(args.tap || CoreTap.instance.name)
workflow = args.workflow || "publish-commit-bottles.yml" workflow = args.workflow || "publish-commit-bottles.yml"

View File

@ -21,10 +21,6 @@ module Homebrew
switch "--suggest-typed", switch "--suggest-typed",
depends_on: "--update", depends_on: "--update",
description: "Try upgrading `typed` sigils." description: "Try upgrading `typed` sigils."
switch "--fail-if-not-changed",
hidden: true,
description: "Return a failing status code if all gems are up to date " \
"and gem definitions do not need a tapioca update."
flag "--dir=", flag "--dir=",
description: "Typecheck all files in a specific directory." description: "Typecheck all files in a specific directory."
flag "--file=", flag "--file=",
@ -49,8 +45,6 @@ module Homebrew
HOMEBREW_LIBRARY_PATH.cd do HOMEBREW_LIBRARY_PATH.cd do
if update if update
odisabled "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
"webrobots", # RBI file is bugged "webrobots", # RBI file is bugged

View File

@ -56,8 +56,9 @@ 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" raise UsageError, "`brew unbottled --total` needs `--eval-all` passed or `HOMEBREW_EVAL_ALL` set!"
end end
all = true all = true
end end
@ -99,8 +100,9 @@ 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" raise UsageError, "`brew unbottled --dependents` needs `--eval-all` passed or `HOMEBREW_EVAL_ALL` set!"
end end
formulae = all_formulae = Formula.all formulae = all_formulae = Formula.all
@sort = " (sorted by number of dependents)" @sort = " (sorted by number of dependents)"

View File

@ -16,18 +16,12 @@ module Homebrew
description <<~EOS description <<~EOS
Update SPDX license data in the Homebrew repository. Update SPDX license data in the Homebrew repository.
EOS EOS
switch "--fail-if-not-changed",
hidden: true,
description: "Return a failing status code if current license data's version is the same as " \
"the upstream. This can be used to notify CI when the SPDX license data is out of date."
named_args :none named_args :none
end end
end end
def update_license_data def update_license_data
args = update_license_data_args.parse update_license_data_args.parse
odisabled "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: [

View File

@ -473,7 +473,7 @@ module Homebrew
def check_git_version def check_git_version
minimum_version = ENV.fetch("HOMEBREW_MINIMUM_GIT_VERSION") minimum_version = ENV.fetch("HOMEBREW_MINIMUM_GIT_VERSION")
return unless Utils::Git.available? return unless Utils::Git.available?
return if Version.create(Utils::Git.version) >= Version.create(minimum_version) return if Version.new(Utils::Git.version) >= Version.new(minimum_version)
git = Formula["git"] git = Formula["git"]
git_upgrade_cmd = git.any_version_installed? ? "upgrade" : "install" git_upgrade_cmd = git.any_version_installed? ? "upgrade" : "install"

View File

@ -737,7 +737,7 @@ class SubversionDownloadStrategy < VCSDownloadStrategy
# @api public # @api public
sig { returns(Time) } sig { returns(Time) }
def source_modified_time def source_modified_time
time = if Version.create(T.must(Utils::Svn.version)) >= Version.create("1.9") time = if Version.new(T.must(Utils::Svn.version)) >= Version.new("1.9")
out, = silent_command("svn", args: ["info", "--show-item", "last-changed-date"], chdir: cached_location) out, = silent_command("svn", args: ["info", "--show-item", "last-changed-date"], chdir: cached_location)
out out
else else

View File

@ -157,6 +157,7 @@ module Kernel
def odisabled(method, replacement = nil, options = {}) def odisabled(method, replacement = nil, options = {})
options = { disable: true, caller: caller }.merge(options) options = { disable: true, caller: caller }.merge(options)
# This odeprecated should stick around indefinitely.
odeprecated(method, replacement, options) odeprecated(method, replacement, options)
end end
@ -318,7 +319,7 @@ module Kernel
# GZips the given paths, and returns the gzipped paths. # GZips the given paths, and returns the gzipped paths.
def gzip(*paths) def gzip(*paths)
odeprecated "Utils.gzip", "Utils::Gzip.compress" odisabled "Utils.gzip", "Utils::Gzip.compress"
Utils::Gzip.compress(*paths) Utils::Gzip.compress(*paths)
end end
@ -503,13 +504,13 @@ module Kernel
sig { returns(String) } sig { returns(String) }
def preferred_shell def preferred_shell
odeprecated "preferred_shell" odisabled "preferred_shell"
Utils::Shell.preferred_path(default: "/bin/sh") Utils::Shell.preferred_path(default: "/bin/sh")
end end
sig { returns(String) } sig { returns(String) }
def shell_profile def shell_profile
odeprecated "shell_profile" odisabled "shell_profile"
Utils::Shell.profile Utils::Shell.profile
end end

View File

@ -26,47 +26,11 @@ class LinkageChecker
libquadmath.so.0 libquadmath.so.0
].freeze ].freeze
def display_deprecated_warning(strict: false)
# Steps when moving these to `odisabled`:
# - Remove the old library from SYSTEM_LIBRARY_ALLOWLIST above.
# - Remove the `disable` and `disable_for_developer` kwargs here.
# - Adjust the `broken_library_linkage?` override below to not check for the library.
# - Remove the relevant `fail_on_lib*?`.
# If there's no more deprecations left:
# - Remove the `broken_library_linkage?` override and the generic alias in HOMEBREW_LIBRARY/linkage_checker.rb.
#
# Steps when removing handling for a library entirely (assuming the steps to `odisabled` has already been done):
# - Remove the relevant setting of `@lib*_found` in `check_dylibs` below.
# - Remove the `odisabled` line
# 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
return unless @libnsl_found
odisabled "linkage to libnsl.so.1", "libnsl.so.3 in the libnsl formula"
end
def display_normal_output
generic_display_normal_output
display_deprecated_warning
end
def display_test_output(puts_output: true, strict: false)
generic_display_test_output(puts_output: puts_output, strict: strict)
display_deprecated_warning(strict: strict)
end
def broken_library_linkage?(test: false, strict: false)
generic_broken_library_linkage?(test: test, strict: strict) || @libnsl_found
end
private private
def check_dylibs(rebuild_cache:) def check_dylibs(rebuild_cache:)
generic_check_dylibs(rebuild_cache: rebuild_cache) generic_check_dylibs(rebuild_cache: rebuild_cache)
@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.
# No other linkage to system libraries is expected or desired. # No other linkage to system libraries is expected or desired.
@unwanted_system_dylibs = @system_dylibs.reject do |s| @unwanted_system_dylibs = @system_dylibs.reject do |s|

View File

@ -500,7 +500,7 @@ class Formula
# An old name for the formula. # An old name for the formula.
# @deprecated Use #{#oldnames} instead. # @deprecated Use #{#oldnames} instead.
def oldname def oldname
# odeprecated "Formula#oldname", "Formula#oldnames" odeprecated "Formula#oldname", "Formula#oldnames"
@oldname ||= oldnames.first @oldname ||= oldnames.first
end end
@ -1036,7 +1036,7 @@ 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" odisabled "formula.plist_path", "formula.launchd_service_path"
launchd_service_path launchd_service_path
end end
@ -1859,7 +1859,7 @@ class Formula
def self.all def self.all
# TODO: ideally avoid using ARGV by moving to e.g. CLI::Parser # TODO: ideally avoid using ARGV by moving to e.g. CLI::Parser
if ARGV.exclude?("--eval-all") && !Homebrew::EnvConfig.eval_all? if ARGV.exclude?("--eval-all") && !Homebrew::EnvConfig.eval_all?
odeprecated "Formula#all without --all or HOMEBREW_EVAL_ALL" odisabled "Formula#all without --eval-all or HOMEBREW_EVAL_ALL"
end end
(core_names + tap_files).map do |name_or_file| (core_names + tap_files).map do |name_or_file|
@ -3265,7 +3265,7 @@ 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" odisabled "plist_options", "service.require_root"
@plist_startup = options[:startup] @plist_startup = options[:startup]
@plist_manual = options[:manual] @plist_manual = options[:manual]
end end
@ -3550,7 +3550,7 @@ 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" odisabled "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

View File

@ -271,7 +271,7 @@ module Homebrew
next next
end end
if dep_f.oldname && dep.name.split("/").last == dep_f.oldname if dep_f.oldnames.include?(dep.name.split("/").last)
problem "Dependency '#{dep.name}' was renamed; use new name '#{dep_f.name}'." problem "Dependency '#{dep.name}' was renamed; use new name '#{dep_f.name}'."
end end
@ -699,10 +699,10 @@ module Homebrew
when %r{download\.gnome\.org/sources}, %r{ftp\.gnome\.org/pub/GNOME/sources}i when %r{download\.gnome\.org/sources}, %r{ftp\.gnome\.org/pub/GNOME/sources}i
version_prefix = stable.version.major_minor version_prefix = stable.version.major_minor
return if formula.tap&.audit_exception :gnome_devel_allowlist, formula.name, version_prefix return if formula.tap&.audit_exception :gnome_devel_allowlist, formula.name, version_prefix
return if stable_url_version < Version.create("1.0") return if stable_url_version < Version.new("1.0")
# All minor versions are stable in the new GNOME version scheme (which starts at version 40.0) # All minor versions are stable in the new GNOME version scheme (which starts at version 40.0)
# https://discourse.gnome.org/t/new-gnome-versioning-scheme/4235 # https://discourse.gnome.org/t/new-gnome-versioning-scheme/4235
return if stable_url_version >= Version.create("40.0") return if stable_url_version >= Version.new("40.0")
return if stable_url_minor_version.even? return if stable_url_minor_version.even?
problem "#{stable.version} is a development release" problem "#{stable.version} is a development release"

View File

@ -36,7 +36,7 @@ module Homebrew
end end
update_path update_path
@version = if @version @version = if @version
Version.create(@version) Version.new(@version)
else else
Version.detect(url) Version.detect(url)
end end

View File

@ -57,7 +57,7 @@ class FormulaInfo
def version(spec_type) def version(spec_type)
version_str = info["versions"][spec_type.to_s] version_str = info["versions"][spec_type.to_s]
version_str && Version.create(version_str) version_str && Version.new(version_str)
end end
def pkg_version(spec_type = :stable) def pkg_version(spec_type = :stable)

View File

@ -47,8 +47,6 @@ class LinkageChecker
display_items "Unwanted system libraries", @unwanted_system_dylibs display_items "Unwanted system libraries", @unwanted_system_dylibs
display_items "Files with missing rpath", @files_missing_rpaths display_items "Files with missing rpath", @files_missing_rpaths
end end
alias generic_display_normal_output display_normal_output
private :generic_display_normal_output
def display_reverse_output def display_reverse_output
return if @reverse_links.empty? return if @reverse_links.empty?
@ -75,8 +73,6 @@ class LinkageChecker
display_items "Undeclared dependencies with linkage", @undeclared_deps, puts_output: puts_output display_items "Undeclared dependencies with linkage", @undeclared_deps, puts_output: puts_output
display_items "Files with missing rpath", @files_missing_rpaths, puts_output: puts_output display_items "Files with missing rpath", @files_missing_rpaths, puts_output: puts_output
end end
alias generic_display_test_output display_test_output
private :generic_display_test_output
sig { params(test: T::Boolean, strict: T::Boolean).returns(T::Boolean) } sig { params(test: T::Boolean, strict: T::Boolean).returns(T::Boolean) }
def broken_library_linkage?(test: false, strict: false) def broken_library_linkage?(test: false, strict: false)
@ -89,8 +85,6 @@ class LinkageChecker
end end
issues.any?(&:present?) issues.any?(&:present?)
end end
alias generic_broken_library_linkage? broken_library_linkage?
private :generic_broken_library_linkage?
def unexpected_broken_dylibs def unexpected_broken_dylibs
return @unexpected_broken_dylibs if @unexpected_broken_dylibs return @unexpected_broken_dylibs if @unexpected_broken_dylibs

View File

@ -140,28 +140,27 @@ end
require "lazy_object" require "lazy_object"
module MacOSVersionErrorCompat
def const_missing(name)
if name == :MacOSVersionError
odeprecated "MacOSVersionError", "MacOSVersion::Error"
return MacOSVersion::Error
end
super
end
end
# `LazyObject` does not work for exceptions when used in `rescue` statements. # `LazyObject` does not work for exceptions when used in `rescue` statements.
class Object class Object
class << self class << self
module MacOSVersionErrorCompat
def const_missing(name)
if name == :MacOSVersionError
# odeprecated "MacOSVersionError", "MacOSVersion::Error"
return MacOSVersion::Error
end
super
end
end
private_constant :MacOSVersionErrorCompat
prepend MacOSVersionErrorCompat prepend MacOSVersionErrorCompat
end end
end end
module MacOSVersions module MacOSVersions
SYMBOLS = LazyObject.new do # rubocop:disable Style/MutableConstant SYMBOLS = LazyObject.new do # rubocop:disable Style/MutableConstant
# odeprecated "MacOSVersions::SYMBOLS", "MacOSVersion::SYMBOLS" odeprecated "MacOSVersions::SYMBOLS", "MacOSVersion::SYMBOLS"
MacOSVersion::SYMBOLS MacOSVersion::SYMBOLS
end end
end end
@ -170,7 +169,7 @@ module OS
module Mac module Mac
# TODO: Replace `::Version` with `Version` when this is removed. # TODO: Replace `::Version` with `Version` when this is removed.
Version = LazyObject.new do # rubocop:disable Style/MutableConstant Version = LazyObject.new do # rubocop:disable Style/MutableConstant
# odeprecated "OS::Mac::Version", "MacOSVersion" odeprecated "OS::Mac::Version", "MacOSVersion"
MacOSVersion MacOSVersion
end end
end end

View File

@ -0,0 +1,5 @@
# typed: strict
module MacOSVersionErrorCompat
include Kernel
end

View File

@ -19,7 +19,7 @@ class PkgVersion
def self.parse(path) def self.parse(path)
_, version, revision = *path.match(REGEX) _, version, revision = *path.match(REGEX)
version = Version.create(version) version = Version.new(version)
new(version, revision.to_i) new(version, revision.to_i)
end end

View File

@ -13,10 +13,10 @@ class MacOSRequirement < Requirement
# TODO: when Yosemite is removed here, keep these around as empty arrays so we # TODO: when Yosemite is removed here, keep these around as empty arrays so we
# can keep the deprecation/disabling code the same. # can keep the deprecation/disabling code the same.
DISABLED_MACOS_VERSIONS = [].freeze DISABLED_MACOS_VERSIONS = [
DEPRECATED_MACOS_VERSIONS = [
:yosemite, :yosemite,
].freeze ].freeze
DEPRECATED_MACOS_VERSIONS = [].freeze
def initialize(tags = [], comparator: ">=") def initialize(tags = [], comparator: ">=")
@version = begin @version = begin
@ -27,9 +27,11 @@ class MacOSRequirement < Requirement
end end
rescue MacOSVersion::Error => e rescue MacOSVersion::Error => e
if DISABLED_MACOS_VERSIONS.include?(e.version) if DISABLED_MACOS_VERSIONS.include?(e.version)
odisabled "depends_on :macos => :#{e.version}" # This odisabled should stick around indefinitely.
odisabled "`depends_on macos: :#{e.version}`"
elsif DEPRECATED_MACOS_VERSIONS.include?(e.version) elsif DEPRECATED_MACOS_VERSIONS.include?(e.version)
odeprecated "depends_on :macos => :#{e.version}" # This odeprecated should stick around indefinitely.
odeprecated "`depends_on macos: :#{e.version}`"
else else
raise raise
end end

View File

@ -92,7 +92,7 @@ class SoftwareSpec
raise "#{full_name}: version missing for \"#{r.name}\" resource!" if version.nil? raise "#{full_name}: version missing for \"#{r.name}\" resource!" if version.nil?
r.version(version.head? ? Version.create("HEAD") : version.dup) r.version(version.head? ? Version.new("HEAD") : version.dup)
end end
patches.each { |p| p.owner = self } patches.each { |p| p.owner = self }
end end
@ -203,17 +203,15 @@ class SoftwareSpec
end end
# @deprecated # @deprecated
# rubocop:disable Style/TrivialAccessors
def uses_from_macos_elements def uses_from_macos_elements
# TODO: remove all @uses_from_macos_elements when disabling or removing this method # TODO: remove all @uses_from_macos_elements when disabling or removing this method
# odeprecated "#uses_from_macos_elements", "#declared_deps" odeprecated "#uses_from_macos_elements", "#declared_deps"
@uses_from_macos_elements @uses_from_macos_elements
end end
# rubocop:enable Style/TrivialAccessors
# @deprecated # @deprecated
def uses_from_macos_names def uses_from_macos_names
# odeprecated "#uses_from_macos_names", "#declared_deps" odeprecated "#uses_from_macos_names", "#declared_deps"
uses_from_macos_elements.flat_map { |e| e.is_a?(Hash) ? e.keys : e } uses_from_macos_elements.flat_map { |e| e.is_a?(Hash) ? e.keys : e }
end end
@ -282,7 +280,7 @@ end
class HeadSoftwareSpec < SoftwareSpec class HeadSoftwareSpec < SoftwareSpec
def initialize(flags: []) def initialize(flags: [])
super super
@resource.version(Version.create("HEAD")) @resource.version(Version.new("HEAD"))
end end
def verify_download_integrity(_filename) def verify_download_integrity(_filename)

View File

@ -508,12 +508,7 @@ class Tap
sig { returns(T::Array[Pathname]) } sig { returns(T::Array[Pathname]) }
def formula_files def formula_files
@formula_files ||= if formula_dir.directory? @formula_files ||= if formula_dir.directory?
# TODO: odeprecate the non-official/old logic with a new minor release somehow? formula_dir.find.select(&method(:formula_file?))
if official?
formula_dir.find
else
formula_dir.children
end.select(&method(:formula_file?))
else else
[] []
end end
@ -542,12 +537,7 @@ class Tap
sig { returns(T::Array[Pathname]) } sig { returns(T::Array[Pathname]) }
def cask_files def cask_files
@cask_files ||= if cask_dir.directory? @cask_files ||= if cask_dir.directory?
# TODO: odeprecate the non-official/old logic with a new minor release somehow? cask_dir.find.select(&method(:ruby_file?))
if official?
cask_dir.find
else
cask_dir.children
end.select(&method(:ruby_file?))
else else
[] []
end end

View File

@ -832,15 +832,6 @@ describe Cask::Audit, :cask do
end end
end end
describe "appcast" do
context "when the Cask has an appcast" do
let(:cask_token) { "with-appcast" }
let(:message) { "`appcast` should be replaced with a `livecheck`." }
it { is_expected.to error_with(message) }
end
end
describe "denylist checks" do describe "denylist checks" do
let(:only) { ["denylist"] } let(:only) { ["denylist"] }

View File

@ -9,15 +9,15 @@ describe CompilerSelector do
let(:compilers) { [:clang, :gnu] } let(:compilers) { [:clang, :gnu] }
let(:software_spec) { SoftwareSpec.new } let(:software_spec) { SoftwareSpec.new }
let(:cc) { :clang } let(:cc) { :clang }
let(:versions) { class_double(DevelopmentTools, clang_build_version: Version.create("600")) } let(:versions) { class_double(DevelopmentTools, clang_build_version: Version.new("600")) }
before do before do
allow(versions).to receive(:gcc_version) do |name| allow(versions).to receive(:gcc_version) do |name|
case name case name
when "gcc-7" then Version.create("7.1") when "gcc-7" then Version.new("7.1")
when "gcc-6" then Version.create("6.1") when "gcc-6" then Version.new("6.1")
when "gcc-5" then Version.create("5.1") when "gcc-5" then Version.new("5.1")
when "gcc-4.9" then Version.create("4.9.1") when "gcc-4.9" then Version.new("4.9.1")
else Version::NULL else Version::NULL
end end
end end

View File

@ -51,7 +51,7 @@ describe GitDownloadStrategy do
describe "#fetch_last_commit" do describe "#fetch_last_commit" do
let(:url) { "file://#{remote_repo}" } let(:url) { "file://#{remote_repo}" }
let(:version) { Version.create("HEAD") } let(:version) { Version.new("HEAD") }
let(:remote_repo) { HOMEBREW_PREFIX/"remote_repo" } let(:remote_repo) { HOMEBREW_PREFIX/"remote_repo" }
before { remote_repo.mkpath } before { remote_repo.mkpath }

View File

@ -521,10 +521,10 @@ describe Formula do
end end
expect(f.homepage).to eq("https://brew.sh") expect(f.homepage).to eq("https://brew.sh")
expect(f.version).to eq(Version.create("0.1")) expect(f.version).to eq(Version.new("0.1"))
expect(f).to be_stable expect(f).to be_stable
expect(f.stable.version).to eq(Version.create("0.1")) expect(f.stable.version).to eq(Version.new("0.1"))
expect(f.head.version).to eq(Version.create("HEAD")) expect(f.head.version).to eq(Version.new("HEAD"))
end end
specify "#active_spec=" do specify "#active_spec=" do
@ -624,7 +624,7 @@ describe Formula do
f.update_head_version f.update_head_version
expect(f.head.version).to eq(Version.create("HEAD-5658946")) expect(f.head.version).to eq(Version.new("HEAD-5658946"))
end end
specify "#desc" do specify "#desc" do

View File

@ -27,10 +27,10 @@ describe MacOSVersion do
end end
specify "comparison with Version" do specify "comparison with Version" do
expect(version).to be > Version.create("10.3") expect(version).to be > Version.new("10.3")
expect(version).to be == Version.create("10.14") expect(version).to be == Version.new("10.14")
expect(version).to be === Version.create("10.14") # rubocop:disable Style/CaseEquality expect(version).to be === Version.new("10.14") # rubocop:disable Style/CaseEquality
expect(version).to be < Version.create("10.15") expect(version).to be < Version.new("10.15")
end end
describe "after Big Sur" do describe "after Big Sur" do

View File

@ -5,12 +5,12 @@ require "pkg_version"
describe PkgVersion do describe PkgVersion do
describe "::parse" do describe "::parse" do
it "parses versions from a string" do it "parses versions from a string" do
expect(described_class.parse("1.0_1")).to eq(described_class.new(Version.create("1.0"), 1)) expect(described_class.parse("1.0_1")).to eq(described_class.new(Version.new("1.0"), 1))
expect(described_class.parse("1.0_1")).to eq(described_class.new(Version.create("1.0"), 1)) expect(described_class.parse("1.0_1")).to eq(described_class.new(Version.new("1.0"), 1))
expect(described_class.parse("1.0")).to eq(described_class.new(Version.create("1.0"), 0)) expect(described_class.parse("1.0")).to eq(described_class.new(Version.new("1.0"), 0))
expect(described_class.parse("1.0_0")).to eq(described_class.new(Version.create("1.0"), 0)) expect(described_class.parse("1.0_0")).to eq(described_class.new(Version.new("1.0"), 0))
expect(described_class.parse("2.1.4_0")).to eq(described_class.new(Version.create("2.1.4"), 0)) expect(described_class.parse("2.1.4_0")).to eq(described_class.new(Version.new("2.1.4"), 0))
expect(described_class.parse("1.0.1e_1")).to eq(described_class.new(Version.create("1.0.1e"), 1)) expect(described_class.parse("1.0.1e_1")).to eq(described_class.new(Version.new("1.0.1e"), 1))
end end
end end
@ -32,13 +32,13 @@ describe PkgVersion do
it "raises an error if the other side isn't of the same class" do it "raises an error if the other side isn't of the same class" do
expect do expect do
described_class.new(Version.create("1.0"), 0) > Object.new described_class.new(Version.new("1.0"), 0) > Object.new
end.to raise_error(ArgumentError) end.to raise_error(ArgumentError)
end end
it "is not compatible with Version" do it "is not compatible with Version" do
expect do expect do
described_class.new(Version.create("1.0"), 0) > Version.create("1.0") described_class.new(Version.new("1.0"), 0) > Version.new("1.0")
end.to raise_error(ArgumentError) end.to raise_error(ArgumentError)
end end
end end
@ -55,33 +55,33 @@ describe PkgVersion do
describe "#<=>" do describe "#<=>" do
it "returns nil if the comparison fails" do it "returns nil if the comparison fails" do
expect(described_class.new(Version.create("1.0"), 0) <=> Object.new).to be_nil expect(described_class.new(Version.new("1.0"), 0) <=> Object.new).to be_nil
expect(Object.new <=> described_class.new(Version.create("1.0"), 0)).to be_nil expect(Object.new <=> described_class.new(Version.new("1.0"), 0)).to be_nil
expect(Object.new <=> described_class.new(Version.create("1.0"), 0)).to be_nil expect(Object.new <=> described_class.new(Version.new("1.0"), 0)).to be_nil
expect(described_class.new(Version.create("1.0"), 0) <=> nil).to be_nil expect(described_class.new(Version.new("1.0"), 0) <=> nil).to be_nil
# This one used to fail due to dereferencing a null `self` # This one used to fail due to dereferencing a null `self`
expect(described_class.new(nil, 0) <=> described_class.new(Version.create("1.0"), 0)).to be_nil expect(described_class.new(nil, 0) <=> described_class.new(Version.new("1.0"), 0)).to be_nil
end end
end end
describe "#to_s" do describe "#to_s" do
it "returns a string of the form 'version_revision'" do it "returns a string of the form 'version_revision'" do
expect(described_class.new(Version.create("1.0"), 0).to_s).to eq("1.0") expect(described_class.new(Version.new("1.0"), 0).to_s).to eq("1.0")
expect(described_class.new(Version.create("1.0"), 1).to_s).to eq("1.0_1") expect(described_class.new(Version.new("1.0"), 1).to_s).to eq("1.0_1")
expect(described_class.new(Version.create("1.0"), 0).to_s).to eq("1.0") expect(described_class.new(Version.new("1.0"), 0).to_s).to eq("1.0")
expect(described_class.new(Version.create("1.0"), 0).to_s).to eq("1.0") expect(described_class.new(Version.new("1.0"), 0).to_s).to eq("1.0")
expect(described_class.new(Version.create("HEAD"), 1).to_s).to eq("HEAD_1") expect(described_class.new(Version.new("HEAD"), 1).to_s).to eq("HEAD_1")
expect(described_class.new(Version.create("HEAD-ffffff"), 1).to_s).to eq("HEAD-ffffff_1") expect(described_class.new(Version.new("HEAD-ffffff"), 1).to_s).to eq("HEAD-ffffff_1")
end end
end end
describe "#hash" do describe "#hash" do
let(:version_one_revision_one) { described_class.new(Version.create("1.0"), 1) } let(:version_one_revision_one) { described_class.new(Version.new("1.0"), 1) }
let(:version_one_dot_one_revision_one) { described_class.new(Version.create("1.1"), 1) } let(:version_one_dot_one_revision_one) { described_class.new(Version.new("1.1"), 1) }
let(:version_one_revision_zero) { described_class.new(Version.create("1.0"), 0) } let(:version_one_revision_zero) { described_class.new(Version.new("1.0"), 0) }
it "returns a hash based on the version and revision" do it "returns a hash based on the version and revision" do
expect(version_one_revision_one.hash).to eq(described_class.new(Version.create("1.0"), 1).hash) expect(version_one_revision_one.hash).to eq(described_class.new(Version.new("1.0"), 1).hash)
expect(version_one_revision_one.hash).not_to eq(version_one_dot_one_revision_one.hash) expect(version_one_revision_one.hash).not_to eq(version_one_dot_one_revision_one.hash)
expect(version_one_revision_one.hash).not_to eq(version_one_revision_zero.hash) expect(version_one_revision_one.hash).not_to eq(version_one_revision_zero.hash)
end end
@ -89,7 +89,7 @@ describe PkgVersion do
describe "#version" do describe "#version" do
it "returns package version" do it "returns package version" do
expect(described_class.parse("1.2.3_4").version).to be == Version.create("1.2.3") expect(described_class.parse("1.2.3_4").version).to be == Version.new("1.2.3")
end end
end end
@ -119,13 +119,13 @@ describe PkgVersion do
describe "#major_minor" do describe "#major_minor" do
it "returns major.minor version" do it "returns major.minor version" do
expect(described_class.parse("1.2.3_4").major_minor).to be == Version.create("1.2") expect(described_class.parse("1.2.3_4").major_minor).to be == Version.new("1.2")
end end
end end
describe "#major_minor_patch" do describe "#major_minor_patch" do
it "returns major.minor.patch version" do it "returns major.minor.patch version" do
expect(described_class.parse("1.2.3_4").major_minor_patch).to be == Version.create("1.2.3") expect(described_class.parse("1.2.3_4").major_minor_patch).to be == Version.new("1.2.3")
end end
end end
end end

View File

@ -6,7 +6,7 @@ describe HeadSoftwareSpec do
subject(:head_spec) { described_class.new } subject(:head_spec) { described_class.new }
specify "#version" do specify "#version" do
expect(head_spec.version).to eq(Version.create("HEAD")) expect(head_spec.version).to eq(Version.new("HEAD"))
end end
specify "#verify_download_integrity" do specify "#verify_download_integrity" do

View File

@ -146,7 +146,7 @@ module Utils
def self.supports_partial_clone_sparse_checkout? def self.supports_partial_clone_sparse_checkout?
# There is some support for partial clones prior to 2.20, but we avoid using it # There is some support for partial clones prior to 2.20, but we avoid using it
# due to performance issues # due to performance issues
Version.create(version) >= Version.create("2.20.0") Version.new(version) >= Version.new("2.20.0")
end end
end end
end end

View File

@ -159,10 +159,8 @@ module GitHub
github_password github_password
end end
# odeprecated: Not really deprecated; change the order to prefer `github_cli_token` over
# `keychain_username_password` during the next major/minor release.
def self.credentials def self.credentials
@credentials ||= Homebrew::EnvConfig.github_api_token || keychain_username_password || github_cli_token @credentials ||= Homebrew::EnvConfig.github_api_token || github_cli_token || keychain_username_password
end end
sig { returns(Symbol) } sig { returns(Symbol) }

View File

@ -40,7 +40,7 @@ module Utils
def invalid_cert_flags def invalid_cert_flags
opoo "Ignoring Subversion certificate errors!" opoo "Ignoring Subversion certificate errors!"
args = ["--non-interactive", "--trust-server-cert"] args = ["--non-interactive", "--trust-server-cert"]
if Version.create(version || "-1") >= Version.create("1.9") if Version.new(version || "-1") >= Version.new("1.9")
args << "--trust-server-cert-failures=expired,not-yet-valid" args << "--trust-server-cert-failures=expired,not-yet-valid"
end end
args args

View File

@ -343,7 +343,7 @@ class Version
sig { params(val: String).returns(Version) } sig { params(val: String).returns(Version) }
def self.create(val) def self.create(val)
# odeprecate "Version.create", "Version.new" odeprecated "Version.create", "Version.new"
new(val) new(val)
end end

View File

@ -126,7 +126,6 @@ _brew___cache() {
__brewcomp " __brewcomp "
--HEAD --HEAD
--arch --arch
--bottle-tag
--build-from-source --build-from-source
--cask --cask
--debug --debug

View File

@ -193,7 +193,6 @@ end
__fish_brew_complete_cmd '--cache' 'Display Homebrew\'s download cache' __fish_brew_complete_cmd '--cache' 'Display Homebrew\'s download cache'
__fish_brew_complete_arg '--cache' -l HEAD -d 'Show the cache file used when building from HEAD' __fish_brew_complete_arg '--cache' -l HEAD -d 'Show the cache file used when building from HEAD'
__fish_brew_complete_arg '--cache' -l arch -d 'Show cache file for the given CPU architecture.(Pass `all` to show cache files for all architectures.)' __fish_brew_complete_arg '--cache' -l arch -d 'Show cache file for the given CPU architecture.(Pass `all` to show cache files for all architectures.)'
__fish_brew_complete_arg '--cache' -l bottle-tag -d 'Show the cache file used when pouring a bottle for the given tag'
__fish_brew_complete_arg '--cache' -l build-from-source -d 'Show the cache file used when building from source' __fish_brew_complete_arg '--cache' -l build-from-source -d 'Show the cache file used when building from source'
__fish_brew_complete_arg '--cache' -l cask -d 'Only show cache files for casks' __fish_brew_complete_arg '--cache' -l cask -d 'Only show cache files for casks'
__fish_brew_complete_arg '--cache' -l debug -d 'Display any debugging information' __fish_brew_complete_arg '--cache' -l debug -d 'Display any debugging information'

View File

@ -264,7 +264,6 @@ _brew___cache() {
_arguments \ _arguments \
'(--build-from-source --force-bottle --bottle-tag --cask)--HEAD[Show the cache file used when building from HEAD]' \ '(--build-from-source --force-bottle --bottle-tag --cask)--HEAD[Show the cache file used when building from HEAD]' \
'(--bottle-tag)--arch[Show cache file for the given CPU architecture.(Pass `all` to show cache files for all architectures.)]' \ '(--bottle-tag)--arch[Show cache file for the given CPU architecture.(Pass `all` to show cache files for all architectures.)]' \
'(--build-from-source --force-bottle --HEAD --cask --os --arch)--bottle-tag[Show the cache file used when pouring a bottle for the given tag]' \
'(--force-bottle --bottle-tag --HEAD --cask)--build-from-source[Show the cache file used when building from source]' \ '(--force-bottle --bottle-tag --HEAD --cask)--build-from-source[Show the cache file used when building from source]' \
'--debug[Display any debugging information]' \ '--debug[Display any debugging information]' \
'(--build-from-source --bottle-tag --HEAD --cask)--force-bottle[Show the cache file used when pouring a bottle]' \ '(--build-from-source --bottle-tag --HEAD --cask)--force-bottle[Show the cache file used when pouring a bottle]' \

View File

@ -856,8 +856,6 @@ If *`formula`* is provided, display the file or directory used to cache *`formul
Show the cache file used when building from source. Show the cache file used when building from source.
* `--force-bottle`: * `--force-bottle`:
Show the cache file used when pouring a bottle. Show the cache file used when pouring a bottle.
* `--bottle-tag`:
Show the cache file used when pouring a bottle for the given tag.
* `--HEAD`: * `--HEAD`:
Show the cache file used when building from HEAD. Show the cache file used when building from HEAD.
* `--formula`: * `--formula`:

View File

@ -1211,10 +1211,6 @@ Show the cache file used when building from source\.
Show the cache file used when pouring a bottle\. Show the cache file used when pouring a bottle\.
. .
.TP .TP
\fB\-\-bottle\-tag\fR
Show the cache file used when pouring a bottle for the given tag\.
.
.TP
\fB\-\-HEAD\fR \fB\-\-HEAD\fR
Show the cache file used when building from HEAD\. Show the cache file used when building from HEAD\.
. .