From 7da934f7e203a90608273910760a8569a413fee6 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Thu, 6 Jul 2023 16:47:09 +0100 Subject: [PATCH] Deprecate/disable/delete code. The next release after this is merged will be 4.1.0. Co-authored-by: Markus Reiter --- Library/Homebrew/cask/audit.rb | 7 --- Library/Homebrew/cask/cask.rb | 2 +- Library/Homebrew/cask/download.rb | 2 +- Library/Homebrew/cask/dsl.rb | 3 +- Library/Homebrew/cask/dsl/postflight.rb | 4 +- Library/Homebrew/cli/args.rb | 2 +- Library/Homebrew/cli/parser.rb | 2 + Library/Homebrew/cmd/--cache.rb | 5 +- Library/Homebrew/cmd/deps.rb | 9 ---- Library/Homebrew/cmd/desc.rb | 2 +- Library/Homebrew/cmd/info.rb | 7 --- Library/Homebrew/cmd/install.rb | 1 + Library/Homebrew/cmd/options.rb | 6 --- Library/Homebrew/cmd/readall.rb | 7 ++- Library/Homebrew/cmd/search.rb | 3 +- Library/Homebrew/cmd/update-report.rb | 2 +- Library/Homebrew/cmd/uses.rb | 12 +---- Library/Homebrew/dev-cmd/audit.rb | 12 ++--- Library/Homebrew/dev-cmd/bump-formula-pr.rb | 2 +- Library/Homebrew/dev-cmd/create.rb | 2 +- .../dev-cmd/generate-man-completions.rb | 8 --- Library/Homebrew/dev-cmd/livecheck.rb | 6 --- Library/Homebrew/dev-cmd/pr-publish.rb | 2 +- Library/Homebrew/dev-cmd/typecheck.rb | 6 --- Library/Homebrew/dev-cmd/unbottled.rb | 6 ++- .../Homebrew/dev-cmd/update-license-data.rb | 8 +-- Library/Homebrew/diagnostic.rb | 2 +- Library/Homebrew/download_strategy.rb | 2 +- Library/Homebrew/extend/kernel.rb | 7 +-- .../extend/os/linux/linkage_checker.rb | 36 ------------- Library/Homebrew/formula.rb | 10 ++-- Library/Homebrew/formula_auditor.rb | 6 +-- Library/Homebrew/formula_creator.rb | 2 +- Library/Homebrew/formula_info.rb | 2 +- Library/Homebrew/linkage_checker.rb | 6 --- Library/Homebrew/macos_version.rb | 27 +++++----- Library/Homebrew/macos_version.rbi | 5 ++ Library/Homebrew/pkg_version.rb | 2 +- .../requirements/macos_requirement.rb | 10 ++-- Library/Homebrew/software_spec.rb | 10 ++-- Library/Homebrew/tap.rb | 14 +---- Library/Homebrew/test/cask/audit_spec.rb | 9 ---- .../Homebrew/test/compiler_selector_spec.rb | 10 ++-- .../test/download_strategies/git_spec.rb | 2 +- Library/Homebrew/test/formula_spec.rb | 8 +-- Library/Homebrew/test/macos_version_spec.rb | 8 +-- Library/Homebrew/test/pkg_version_spec.rb | 52 +++++++++---------- .../Homebrew/test/software_spec/head_spec.rb | 2 +- Library/Homebrew/utils/git.rb | 2 +- Library/Homebrew/utils/github/api.rb | 4 +- Library/Homebrew/utils/svn.rb | 2 +- Library/Homebrew/version.rb | 2 +- completions/bash/brew | 1 - completions/fish/brew.fish | 1 - completions/zsh/_brew | 1 - docs/Manpage.md | 2 - manpages/brew.1 | 4 -- 57 files changed, 125 insertions(+), 254 deletions(-) create mode 100644 Library/Homebrew/macos_version.rbi diff --git a/Library/Homebrew/cask/audit.rb b/Library/Homebrew/cask/audit.rb index 322deebe4f..56f7f1e3de 100644 --- a/Library/Homebrew/cask/audit.rb +++ b/Library/Homebrew/cask/audit.rb @@ -265,13 +265,6 @@ module Cask add_error "cannot use the sha256 for an empty string: #{empty_sha256}" end - sig { void } - def audit_appcast - return unless cask.appcast - - add_error "`appcast` should be replaced with a `livecheck`." - end - sig { void } def audit_latest_with_livecheck return unless cask.version.latest? diff --git a/Library/Homebrew/cask/cask.rb b/Library/Homebrew/cask/cask.rb index c1f8711ff1..6d71d30ddf 100644 --- a/Library/Homebrew/cask/cask.rb +++ b/Library/Homebrew/cask/cask.rb @@ -26,7 +26,7 @@ module Cask def self.all # TODO: ideally avoid using ARGV by moving to e.g. CLI::Parser if ARGV.exclude?("--eval-all") && !Homebrew::EnvConfig.eval_all? - odeprecated "Cask::Cask#all without --all or HOMEBREW_EVAL_ALL" + odisabled "Cask::Cask#all without --eval-all or HOMEBREW_EVAL_ALL" end Tap.flat_map(&:cask_files).map do |f| diff --git a/Library/Homebrew/cask/download.rb b/Library/Homebrew/cask/download.rb index 74b0d61373..976e440dee 100644 --- a/Library/Homebrew/cask/download.rb +++ b/Library/Homebrew/cask/download.rb @@ -34,7 +34,7 @@ module Cask sig { override.returns(T.nilable(Version)) } def version - @version ||= Version.create(cask.version) + @version ||= Version.new(cask.version) end sig { diff --git a/Library/Homebrew/cask/dsl.rb b/Library/Homebrew/cask/dsl.rb index dbcf6e8ba2..2aeb6b8ae3 100644 --- a/Library/Homebrew/cask/dsl.rb +++ b/Library/Homebrew/cask/dsl.rb @@ -211,8 +211,7 @@ module Cask # @api public def appcast(*args, **kwargs) 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 end end diff --git a/Library/Homebrew/cask/dsl/postflight.rb b/Library/Homebrew/cask/dsl/postflight.rb index 209533ba77..c7fa797d9e 100644 --- a/Library/Homebrew/cask/dsl/postflight.rb +++ b/Library/Homebrew/cask/dsl/postflight.rb @@ -11,8 +11,8 @@ module Cask class Postflight < Base include Staged - def suppress_move_to_applications(options = {}) - # TODO: Remove from all casks because it is no longer needed + def suppress_move_to_applications(_options = {}) + odeprecated "Cask::DSL#suppress_move_to_applications" end end end diff --git a/Library/Homebrew/cli/args.rb b/Library/Homebrew/cli/args.rb index b2226f1329..560fec4285 100644 --- a/Library/Homebrew/cli/args.rb +++ b/Library/Homebrew/cli/args.rb @@ -112,7 +112,7 @@ module Homebrew skip_invalid_combinations = true [ - *MacOSVersions::SYMBOLS.keys, + *MacOSVersion::SYMBOLS.keys, :linux, ] else diff --git a/Library/Homebrew/cli/parser.rb b/Library/Homebrew/cli/parser.rb index 682dca701d..9f845dbb37 100644 --- a/Library/Homebrew/cli/parser.rb +++ b/Library/Homebrew/cli/parser.rb @@ -166,6 +166,7 @@ module Homebrew description += " (disabled#{"; replaced by #{replacement}" if replacement.present?})" end @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 value = true if names.none? { |name| name.start_with?("--[no-]") } @@ -224,6 +225,7 @@ module Homebrew description += " (disabled#{"; replaced by #{replacement}" if replacement.present?})" end @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? names.each do |name| @args[option_to_name(name)] = option_value diff --git a/Library/Homebrew/cmd/--cache.rb b/Library/Homebrew/cmd/--cache.rb index aa6736657c..76594f381f 100644 --- a/Library/Homebrew/cmd/--cache.rb +++ b/Library/Homebrew/cmd/--cache.rb @@ -27,7 +27,8 @@ module Homebrew switch "--force-bottle", description: "Show the cache file used when pouring a bottle." 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", description: "Show the cache file used when building from HEAD." switch "--formula", "--formulae", @@ -96,7 +97,7 @@ module Homebrew arch: args.arch&.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) else Utils::Bottles::Tag.new(system: os, arch: arch) diff --git a/Library/Homebrew/cmd/deps.rb b/Library/Homebrew/cmd/deps.rb index ab840001b5..bfa63005c6 100644 --- a/Library/Homebrew/cmd/deps.rb +++ b/Library/Homebrew/cmd/deps.rb @@ -54,8 +54,6 @@ module Homebrew switch "--eval-all", description: "Evaluate all available formulae and casks, whether installed or not, to list " \ "their dependencies." - switch "--all", - hidden: true switch "--for-each", description: "Switch into the mode used by the `--all` option, but only list dependencies " \ "for each provided , one formula per line. This is used for " \ @@ -80,13 +78,6 @@ module Homebrew args = deps_args.parse 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! diff --git a/Library/Homebrew/cmd/desc.rb b/Library/Homebrew/cmd/desc.rb index c415d7526e..681d8b86df 100644 --- a/Library/Homebrew/cmd/desc.rb +++ b/Library/Homebrew/cmd/desc.rb @@ -43,7 +43,7 @@ module Homebrew args = desc_args.parse 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 search_type = if args.search? diff --git a/Library/Homebrew/cmd/info.rb b/Library/Homebrew/cmd/info.rb index 1091a73e93..87c56cf994 100644 --- a/Library/Homebrew/cmd/info.rb +++ b/Library/Homebrew/cmd/info.rb @@ -59,9 +59,6 @@ module Homebrew depends_on: "--json", description: "Evaluate all available formulae and casks, whether installed or not, to print their " \ "JSON. Implied if `HOMEBREW_EVAL_ALL` is set." - switch "--all", - hidden: true, - depends_on: "--json" switch "--variations", depends_on: "--json", description: "Include the variations hash in each formula's JSON output." @@ -103,10 +100,6 @@ module Homebrew print_analytics(args: args) elsif args.json all = args.eval_all? - if !all && args.all? && !Homebrew::EnvConfig.eval_all? - odisabled "brew info --all", "brew info --eval-all or HOMEBREW_EVAL_ALL" - all = true - end print_json(all, args: args) elsif args.github? diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index 3741bd6b2a..33d911d75d 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -170,6 +170,7 @@ module Homebrew # Can't use `replacement: false` because `install_args` are used by # `build.rb`. Instead, `hide_from_man_page` and don't do anything with # this argument here. + # This odisabled should stick around indefinitely. odisabled "brew install --env", "`env :std` in specific formula files" end diff --git a/Library/Homebrew/cmd/options.rb b/Library/Homebrew/cmd/options.rb index 6d3af41063..b88c158118 100644 --- a/Library/Homebrew/cmd/options.rb +++ b/Library/Homebrew/cmd/options.rb @@ -20,8 +20,6 @@ module Homebrew switch "--eval-all", description: "Evaluate all available formulae and casks, whether installed or not, to show their " \ "options." - switch "--all", - hidden: true flag "--command=", description: "Show options for the specified ." @@ -35,10 +33,6 @@ module Homebrew args = options_args.parse 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 puts_options Formula.all.sort, args: args diff --git a/Library/Homebrew/cmd/readall.rb b/Library/Homebrew/cmd/readall.rb index 1c192df074..44cfccdaca 100644 --- a/Library/Homebrew/cmd/readall.rb +++ b/Library/Homebrew/cmd/readall.rb @@ -38,9 +38,7 @@ module Homebrew def readall args = readall_args.parse - if args.no_simulate? - # odeprecated "--no-simulate", "nothing (i.e. not passing `--os` or `--arch`)" - end + odeprecated "--no-simulate", "nothing (i.e. not passing `--os` or `--arch`)" if args.no_simulate? if args.syntax? && args.no_named? 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 taps = if args.no_named? 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 + Tap else args.named.to_installed_taps diff --git a/Library/Homebrew/cmd/search.rb b/Library/Homebrew/cmd/search.rb index 43733bb427..ae7908f9d3 100644 --- a/Library/Homebrew/cmd/search.rb +++ b/Library/Homebrew/cmd/search.rb @@ -75,8 +75,9 @@ module Homebrew if args.desc? 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 + Search.search_descriptions(string_or_regex, args) elsif args.pull_request? search_pull_requests(query, args) diff --git a/Library/Homebrew/cmd/update-report.rb b/Library/Homebrew/cmd/update-report.rb index 80796a9911..a1088b3c5a 100644 --- a/Library/Homebrew/cmd/update-report.rb +++ b/Library/Homebrew/cmd/update-report.rb @@ -743,7 +743,7 @@ class ReporterHub def dump(auto_update: false) report_all = ENV["HOMEBREW_UPDATE_REPORT_ALL_FORMULAE"].present? 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." report_all = false end diff --git a/Library/Homebrew/cmd/uses.rb b/Library/Homebrew/cmd/uses.rb index 9e835fb28a..d10a45614b 100644 --- a/Library/Homebrew/cmd/uses.rb +++ b/Library/Homebrew/cmd/uses.rb @@ -32,8 +32,6 @@ module Homebrew switch "--eval-all", description: "Evaluate all available formulae and casks, whether installed or not, to show " \ "their dependents." - switch "--all", - hidden: true switch "--include-build", description: "Include all formulae that specify as `:build` type dependency." switch "--include-test", @@ -110,17 +108,11 @@ module Homebrew deps else 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?) - 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 + if show_formulae_and_casks || args.formula? deps += args.installed? ? Formula.installed : Formula.all end diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 2cffa29e77..070ac0b477 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -44,15 +44,10 @@ module Homebrew switch "--eval-all", description: "Evaluate all available formulae and casks, whether installed or not, to audit them. " \ "Implied if `HOMEBREW_EVAL_ALL` is set." - switch "--all", - hidden: true switch "--new", "--new-formula", "--new-cask", 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 " \ "`--strict` and `--online`." - switch "--[no-]appcast", - description: "Audit the appcast.", - replacement: false switch "--[no-]signing", description: "Audit for signed apps, which are required on ARM" switch "--token-conflicts", @@ -136,6 +131,7 @@ module Homebrew [Formula.installed, Cask::Caskroom.casks] elsif args.no_named? if !args.eval_all? && !Homebrew::EnvConfig.eval_all? + # This odisabled should probably stick around indefinitely. odisabled "brew audit", "brew audit --eval-all or HOMEBREW_EVAL_ALL" end @@ -143,8 +139,8 @@ module Homebrew [Formula.all, Cask::Cask.all] else if args.named.any? { |named_arg| named_arg.end_with?(".rb") } - odeprecated "brew audit [path ...]", - "brew audit [name ...]" + odisabled "brew audit [path ...]", + "brew audit [name ...]" end args.named.to_formulae_and_casks @@ -235,7 +231,7 @@ module Homebrew require "cask/auditor" if args.display_failures_only? - odeprecated "`brew audit --display-failures-only`", "`brew audit ` without the argument" + odisabled "`brew audit --display-failures-only`", "`brew audit ` without the argument" end end diff --git a/Library/Homebrew/dev-cmd/bump-formula-pr.rb b/Library/Homebrew/dev-cmd/bump-formula-pr.rb index c72e1d7cc9..e89125b786 100644 --- a/Library/Homebrew/dev-cmd/bump-formula-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-formula-pr.rb @@ -474,7 +474,7 @@ module Homebrew name, old_alias_version = versioned_alias.split("@") new_alias_regex = (old_alias_version.split(".").length == 1) ? /^\d+/ : /^\d+\.\d+/ 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}"] end diff --git a/Library/Homebrew/dev-cmd/create.rb b/Library/Homebrew/dev-cmd/create.rb index 8755d80693..e0e3c5d5e1 100644 --- a/Library/Homebrew/dev-cmd/create.rb +++ b/Library/Homebrew/dev-cmd/create.rb @@ -101,7 +101,7 @@ module Homebrew raise Cask::CaskAlreadyCreatedError, token if cask_path.exist? version = if args.set_version - Version.create(args.set_version) + Version.new(args.set_version) else Version.detect(url.gsub(token, "").gsub(/x86(_64)?/, "")) end diff --git a/Library/Homebrew/dev-cmd/generate-man-completions.rb b/Library/Homebrew/dev-cmd/generate-man-completions.rb index 25dd019278..d449e7f77e 100644 --- a/Library/Homebrew/dev-cmd/generate-man-completions.rb +++ b/Library/Homebrew/dev-cmd/generate-man-completions.rb @@ -14,12 +14,6 @@ module Homebrew description <<~EOS Generate Homebrew's manpages and shell completions. 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 end end @@ -27,8 +21,6 @@ module Homebrew def generate_man_completions args = generate_man_completions_args.parse - odisabled "brew generate-man-completions --fail-if-not-changed" if args.fail_if_not_changed? - Commands.rebuild_internal_commands_completion_list Manpages.regenerate_man_pages(quiet: args.quiet?) Completions.update_shell_completions! diff --git a/Library/Homebrew/dev-cmd/livecheck.rb b/Library/Homebrew/dev-cmd/livecheck.rb index 87e815fda4..0fe8660221 100644 --- a/Library/Homebrew/dev-cmd/livecheck.rb +++ b/Library/Homebrew/dev-cmd/livecheck.rb @@ -27,8 +27,6 @@ module Homebrew description: "Check formulae and casks within the given tap, specified as `/`." switch "--eval-all", description: "Evaluate all available formulae and casks, whether installed or not, to check them." - switch "--all", - hidden: true switch "--installed", description: "Check formulae and casks that are currently installed." switch "--newer-only", @@ -56,10 +54,6 @@ module Homebrew args = livecheck_args.parse 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? puts args diff --git a/Library/Homebrew/dev-cmd/pr-publish.rb b/Library/Homebrew/dev-cmd/pr-publish.rb index c1220ee941..e20ea84386 100644 --- a/Library/Homebrew/dev-cmd/pr-publish.rb +++ b/Library/Homebrew/dev-cmd/pr-publish.rb @@ -39,7 +39,7 @@ module Homebrew def pr_publish 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) workflow = args.workflow || "publish-commit-bottles.yml" diff --git a/Library/Homebrew/dev-cmd/typecheck.rb b/Library/Homebrew/dev-cmd/typecheck.rb index beb5878cba..87fad0c1d3 100644 --- a/Library/Homebrew/dev-cmd/typecheck.rb +++ b/Library/Homebrew/dev-cmd/typecheck.rb @@ -21,10 +21,6 @@ module Homebrew switch "--suggest-typed", depends_on: "--update", 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=", description: "Typecheck all files in a specific directory." flag "--file=", @@ -49,8 +45,6 @@ module Homebrew HOMEBREW_LIBRARY_PATH.cd do if update - 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 "webrobots", # RBI file is bugged diff --git a/Library/Homebrew/dev-cmd/unbottled.rb b/Library/Homebrew/dev-cmd/unbottled.rb index 0a935ed915..0a27bbdb7f 100644 --- a/Library/Homebrew/dev-cmd/unbottled.rb +++ b/Library/Homebrew/dev-cmd/unbottled.rb @@ -56,8 +56,9 @@ module Homebrew all = args.eval_all? if args.total? if !all && !Homebrew::EnvConfig.eval_all? - odisabled "brew unbottled --total", "brew unbottled --total --eval-all or HOMEBREW_EVAL_ALL" + raise UsageError, "`brew unbottled --total` needs `--eval-all` passed or `HOMEBREW_EVAL_ALL` set!" end + all = true end @@ -99,8 +100,9 @@ module Homebrew formulae = all_formulae = args.named.to_formulae elsif args.dependents? if !args.eval_all? && !Homebrew::EnvConfig.eval_all? - odisabled "brew unbottled --dependents", "brew unbottled --all --dependents or HOMEBREW_EVAL_ALL" + raise UsageError, "`brew unbottled --dependents` needs `--eval-all` passed or `HOMEBREW_EVAL_ALL` set!" end + formulae = all_formulae = Formula.all @sort = " (sorted by number of dependents)" diff --git a/Library/Homebrew/dev-cmd/update-license-data.rb b/Library/Homebrew/dev-cmd/update-license-data.rb index 1eb9344d00..9fdd06fa96 100644 --- a/Library/Homebrew/dev-cmd/update-license-data.rb +++ b/Library/Homebrew/dev-cmd/update-license-data.rb @@ -16,18 +16,12 @@ module Homebrew description <<~EOS Update SPDX license data in the Homebrew repository. 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 end end def update_license_data - args = update_license_data_args.parse - odisabled "brew update-license-data --fail-if-not-changed" if args.fail_if_not_changed? + update_license_data_args.parse SPDX.download_latest_license_data! diff = system_command "git", args: [ diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index f24f32e57c..4d888797b7 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -473,7 +473,7 @@ module Homebrew def check_git_version minimum_version = ENV.fetch("HOMEBREW_MINIMUM_GIT_VERSION") 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_upgrade_cmd = git.any_version_installed? ? "upgrade" : "install" diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index 78632ca56a..85807993b8 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -737,7 +737,7 @@ class SubversionDownloadStrategy < VCSDownloadStrategy # @api public sig { returns(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 else diff --git a/Library/Homebrew/extend/kernel.rb b/Library/Homebrew/extend/kernel.rb index d575d3f888..0e23897035 100644 --- a/Library/Homebrew/extend/kernel.rb +++ b/Library/Homebrew/extend/kernel.rb @@ -157,6 +157,7 @@ module Kernel def odisabled(method, replacement = nil, options = {}) options = { disable: true, caller: caller }.merge(options) + # This odeprecated should stick around indefinitely. odeprecated(method, replacement, options) end @@ -318,7 +319,7 @@ module Kernel # GZips the given paths, and returns the gzipped paths. def gzip(*paths) - odeprecated "Utils.gzip", "Utils::Gzip.compress" + odisabled "Utils.gzip", "Utils::Gzip.compress" Utils::Gzip.compress(*paths) end @@ -503,13 +504,13 @@ module Kernel sig { returns(String) } def preferred_shell - odeprecated "preferred_shell" + odisabled "preferred_shell" Utils::Shell.preferred_path(default: "/bin/sh") end sig { returns(String) } def shell_profile - odeprecated "shell_profile" + odisabled "shell_profile" Utils::Shell.profile end diff --git a/Library/Homebrew/extend/os/linux/linkage_checker.rb b/Library/Homebrew/extend/os/linux/linkage_checker.rb index 76ce0cff85..01250a02a1 100644 --- a/Library/Homebrew/extend/os/linux/linkage_checker.rb +++ b/Library/Homebrew/extend/os/linux/linkage_checker.rb @@ -26,47 +26,11 @@ class LinkageChecker libquadmath.so.0 ].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 def check_dylibs(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. # No other linkage to system libraries is expected or desired. @unwanted_system_dylibs = @system_dylibs.reject do |s| diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index d1346f009c..9f4bb2668d 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -500,7 +500,7 @@ class Formula # An old name for the formula. # @deprecated Use #{#oldnames} instead. def oldname - # odeprecated "Formula#oldname", "Formula#oldnames" + odeprecated "Formula#oldname", "Formula#oldnames" @oldname ||= oldnames.first end @@ -1036,7 +1036,7 @@ class Formula # The generated launchd {.plist} file path. sig { returns(Pathname) } def plist_path - odeprecated "formula.plist_path", "formula.launchd_service_path" + odisabled "formula.plist_path", "formula.launchd_service_path" launchd_service_path end @@ -1859,7 +1859,7 @@ class Formula def self.all # TODO: ideally avoid using ARGV by moving to e.g. CLI::Parser if ARGV.exclude?("--eval-all") && !Homebrew::EnvConfig.eval_all? - odeprecated "Formula#all without --all or HOMEBREW_EVAL_ALL" + odisabled "Formula#all without --eval-all or HOMEBREW_EVAL_ALL" end (core_names + tap_files).map do |name_or_file| @@ -3265,7 +3265,7 @@ class Formula # # @deprecated Please use {Homebrew::Service.require_root} instead. def plist_options(options) - odeprecated "plist_options", "service.require_root" + odisabled "plist_options", "service.require_root" @plist_startup = options[:startup] @plist_manual = options[:manual] end @@ -3550,7 +3550,7 @@ class Formula # Permit links to certain libraries that don't exist. Available on Linux only. def ignore_missing_libraries(*libs) - odeprecated "ignore_missing_libraries" + odisabled "ignore_missing_libraries" unless Homebrew::SimulateSystem.simulating_or_running_on_linux? raise FormulaSpecificationError, "#{__method__} is available on Linux only" end diff --git a/Library/Homebrew/formula_auditor.rb b/Library/Homebrew/formula_auditor.rb index 9a3fc6a17e..b348a0d4d0 100644 --- a/Library/Homebrew/formula_auditor.rb +++ b/Library/Homebrew/formula_auditor.rb @@ -271,7 +271,7 @@ module Homebrew next 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}'." end @@ -699,10 +699,10 @@ module Homebrew when %r{download\.gnome\.org/sources}, %r{ftp\.gnome\.org/pub/GNOME/sources}i version_prefix = stable.version.major_minor 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) # 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? problem "#{stable.version} is a development release" diff --git a/Library/Homebrew/formula_creator.rb b/Library/Homebrew/formula_creator.rb index 800f4a548f..ad93b8185d 100644 --- a/Library/Homebrew/formula_creator.rb +++ b/Library/Homebrew/formula_creator.rb @@ -36,7 +36,7 @@ module Homebrew end update_path @version = if @version - Version.create(@version) + Version.new(@version) else Version.detect(url) end diff --git a/Library/Homebrew/formula_info.rb b/Library/Homebrew/formula_info.rb index 1059fb5c2a..0856c3d490 100644 --- a/Library/Homebrew/formula_info.rb +++ b/Library/Homebrew/formula_info.rb @@ -57,7 +57,7 @@ class FormulaInfo def version(spec_type) version_str = info["versions"][spec_type.to_s] - version_str && Version.create(version_str) + version_str && Version.new(version_str) end def pkg_version(spec_type = :stable) diff --git a/Library/Homebrew/linkage_checker.rb b/Library/Homebrew/linkage_checker.rb index 17c4542b3c..1465f08bcd 100644 --- a/Library/Homebrew/linkage_checker.rb +++ b/Library/Homebrew/linkage_checker.rb @@ -47,8 +47,6 @@ class LinkageChecker display_items "Unwanted system libraries", @unwanted_system_dylibs display_items "Files with missing rpath", @files_missing_rpaths end - alias generic_display_normal_output display_normal_output - private :generic_display_normal_output def display_reverse_output 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 "Files with missing rpath", @files_missing_rpaths, puts_output: puts_output 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) } def broken_library_linkage?(test: false, strict: false) @@ -89,8 +85,6 @@ class LinkageChecker end issues.any?(&:present?) end - alias generic_broken_library_linkage? broken_library_linkage? - private :generic_broken_library_linkage? def unexpected_broken_dylibs return @unexpected_broken_dylibs if @unexpected_broken_dylibs diff --git a/Library/Homebrew/macos_version.rb b/Library/Homebrew/macos_version.rb index 4dfc17c4bc..f728b610ca 100644 --- a/Library/Homebrew/macos_version.rb +++ b/Library/Homebrew/macos_version.rb @@ -140,28 +140,27 @@ end 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. class Object 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 end end module MacOSVersions SYMBOLS = LazyObject.new do # rubocop:disable Style/MutableConstant - # odeprecated "MacOSVersions::SYMBOLS", "MacOSVersion::SYMBOLS" + odeprecated "MacOSVersions::SYMBOLS", "MacOSVersion::SYMBOLS" MacOSVersion::SYMBOLS end end @@ -170,7 +169,7 @@ module OS module Mac # TODO: Replace `::Version` with `Version` when this is removed. Version = LazyObject.new do # rubocop:disable Style/MutableConstant - # odeprecated "OS::Mac::Version", "MacOSVersion" + odeprecated "OS::Mac::Version", "MacOSVersion" MacOSVersion end end diff --git a/Library/Homebrew/macos_version.rbi b/Library/Homebrew/macos_version.rbi new file mode 100644 index 0000000000..d4fec019cb --- /dev/null +++ b/Library/Homebrew/macos_version.rbi @@ -0,0 +1,5 @@ +# typed: strict + +module MacOSVersionErrorCompat + include Kernel +end diff --git a/Library/Homebrew/pkg_version.rb b/Library/Homebrew/pkg_version.rb index fdb4aa75a7..07425903c6 100644 --- a/Library/Homebrew/pkg_version.rb +++ b/Library/Homebrew/pkg_version.rb @@ -19,7 +19,7 @@ class PkgVersion def self.parse(path) _, version, revision = *path.match(REGEX) - version = Version.create(version) + version = Version.new(version) new(version, revision.to_i) end diff --git a/Library/Homebrew/requirements/macos_requirement.rb b/Library/Homebrew/requirements/macos_requirement.rb index adad00255e..b58a3ce50d 100644 --- a/Library/Homebrew/requirements/macos_requirement.rb +++ b/Library/Homebrew/requirements/macos_requirement.rb @@ -13,10 +13,10 @@ class MacOSRequirement < Requirement # TODO: when Yosemite is removed here, keep these around as empty arrays so we # can keep the deprecation/disabling code the same. - DISABLED_MACOS_VERSIONS = [].freeze - DEPRECATED_MACOS_VERSIONS = [ + DISABLED_MACOS_VERSIONS = [ :yosemite, ].freeze + DEPRECATED_MACOS_VERSIONS = [].freeze def initialize(tags = [], comparator: ">=") @version = begin @@ -27,9 +27,11 @@ class MacOSRequirement < Requirement end rescue MacOSVersion::Error => e 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) - odeprecated "depends_on :macos => :#{e.version}" + # This odeprecated should stick around indefinitely. + odeprecated "`depends_on macos: :#{e.version}`" else raise end diff --git a/Library/Homebrew/software_spec.rb b/Library/Homebrew/software_spec.rb index 6182838ea4..33f073708c 100644 --- a/Library/Homebrew/software_spec.rb +++ b/Library/Homebrew/software_spec.rb @@ -92,7 +92,7 @@ class SoftwareSpec 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 patches.each { |p| p.owner = self } end @@ -203,17 +203,15 @@ class SoftwareSpec end # @deprecated - # rubocop:disable Style/TrivialAccessors def uses_from_macos_elements # 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 end - # rubocop:enable Style/TrivialAccessors # @deprecated 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 } end @@ -282,7 +280,7 @@ end class HeadSoftwareSpec < SoftwareSpec def initialize(flags: []) super - @resource.version(Version.create("HEAD")) + @resource.version(Version.new("HEAD")) end def verify_download_integrity(_filename) diff --git a/Library/Homebrew/tap.rb b/Library/Homebrew/tap.rb index 52bd9d6bc6..9b5a14d7e7 100644 --- a/Library/Homebrew/tap.rb +++ b/Library/Homebrew/tap.rb @@ -508,12 +508,7 @@ class Tap sig { returns(T::Array[Pathname]) } def formula_files @formula_files ||= if formula_dir.directory? - # TODO: odeprecate the non-official/old logic with a new minor release somehow? - if official? - formula_dir.find - else - formula_dir.children - end.select(&method(:formula_file?)) + formula_dir.find.select(&method(:formula_file?)) else [] end @@ -542,12 +537,7 @@ class Tap sig { returns(T::Array[Pathname]) } def cask_files @cask_files ||= if cask_dir.directory? - # TODO: odeprecate the non-official/old logic with a new minor release somehow? - if official? - cask_dir.find - else - cask_dir.children - end.select(&method(:ruby_file?)) + cask_dir.find.select(&method(:ruby_file?)) else [] end diff --git a/Library/Homebrew/test/cask/audit_spec.rb b/Library/Homebrew/test/cask/audit_spec.rb index 768ff4c122..5285b2517c 100644 --- a/Library/Homebrew/test/cask/audit_spec.rb +++ b/Library/Homebrew/test/cask/audit_spec.rb @@ -832,15 +832,6 @@ describe Cask::Audit, :cask do 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 let(:only) { ["denylist"] } diff --git a/Library/Homebrew/test/compiler_selector_spec.rb b/Library/Homebrew/test/compiler_selector_spec.rb index 25a768947b..43f4fb5f04 100644 --- a/Library/Homebrew/test/compiler_selector_spec.rb +++ b/Library/Homebrew/test/compiler_selector_spec.rb @@ -9,15 +9,15 @@ describe CompilerSelector do let(:compilers) { [:clang, :gnu] } let(:software_spec) { SoftwareSpec.new } 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 allow(versions).to receive(:gcc_version) do |name| case name - when "gcc-7" then Version.create("7.1") - when "gcc-6" then Version.create("6.1") - when "gcc-5" then Version.create("5.1") - when "gcc-4.9" then Version.create("4.9.1") + when "gcc-7" then Version.new("7.1") + when "gcc-6" then Version.new("6.1") + when "gcc-5" then Version.new("5.1") + when "gcc-4.9" then Version.new("4.9.1") else Version::NULL end end diff --git a/Library/Homebrew/test/download_strategies/git_spec.rb b/Library/Homebrew/test/download_strategies/git_spec.rb index ad68fbcd7d..6a8eb82b65 100644 --- a/Library/Homebrew/test/download_strategies/git_spec.rb +++ b/Library/Homebrew/test/download_strategies/git_spec.rb @@ -51,7 +51,7 @@ describe GitDownloadStrategy do describe "#fetch_last_commit" do let(:url) { "file://#{remote_repo}" } - let(:version) { Version.create("HEAD") } + let(:version) { Version.new("HEAD") } let(:remote_repo) { HOMEBREW_PREFIX/"remote_repo" } before { remote_repo.mkpath } diff --git a/Library/Homebrew/test/formula_spec.rb b/Library/Homebrew/test/formula_spec.rb index f408952c4b..c8e3fb4c78 100644 --- a/Library/Homebrew/test/formula_spec.rb +++ b/Library/Homebrew/test/formula_spec.rb @@ -521,10 +521,10 @@ describe Formula do end 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.stable.version).to eq(Version.create("0.1")) - expect(f.head.version).to eq(Version.create("HEAD")) + expect(f.stable.version).to eq(Version.new("0.1")) + expect(f.head.version).to eq(Version.new("HEAD")) end specify "#active_spec=" do @@ -624,7 +624,7 @@ describe Formula do 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 specify "#desc" do diff --git a/Library/Homebrew/test/macos_version_spec.rb b/Library/Homebrew/test/macos_version_spec.rb index 34a010833d..98e904b771 100644 --- a/Library/Homebrew/test/macos_version_spec.rb +++ b/Library/Homebrew/test/macos_version_spec.rb @@ -27,10 +27,10 @@ describe MacOSVersion do end specify "comparison with Version" do - expect(version).to be > Version.create("10.3") - expect(version).to be == Version.create("10.14") - expect(version).to be === Version.create("10.14") # rubocop:disable Style/CaseEquality - expect(version).to be < Version.create("10.15") + expect(version).to be > Version.new("10.3") + expect(version).to be == Version.new("10.14") + expect(version).to be === Version.new("10.14") # rubocop:disable Style/CaseEquality + expect(version).to be < Version.new("10.15") end describe "after Big Sur" do diff --git a/Library/Homebrew/test/pkg_version_spec.rb b/Library/Homebrew/test/pkg_version_spec.rb index e4bedd09e0..302c6d8202 100644 --- a/Library/Homebrew/test/pkg_version_spec.rb +++ b/Library/Homebrew/test/pkg_version_spec.rb @@ -5,12 +5,12 @@ require "pkg_version" describe PkgVersion do describe "::parse" 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.create("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_0")).to eq(described_class.new(Version.create("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("1.0.1e_1")).to eq(described_class.new(Version.create("1.0.1e"), 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.new("1.0"), 1)) + 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.new("1.0"), 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.new("1.0.1e"), 1)) end end @@ -32,13 +32,13 @@ describe PkgVersion do it "raises an error if the other side isn't of the same class" 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 it "is not compatible with Version" 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 end @@ -55,33 +55,33 @@ describe PkgVersion do describe "#<=>" do it "returns nil if the comparison fails" do - expect(described_class.new(Version.create("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.create("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) <=> Object.new).to be_nil + expect(Object.new <=> described_class.new(Version.new("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.new("1.0"), 0) <=> nil).to be_nil # 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 describe "#to_s" 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.create("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.create("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.create("HEAD-ffffff"), 1).to_s).to eq("HEAD-ffffff_1") + expect(described_class.new(Version.new("1.0"), 0).to_s).to eq("1.0") + expect(described_class.new(Version.new("1.0"), 1).to_s).to eq("1.0_1") + expect(described_class.new(Version.new("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.new("HEAD"), 1).to_s).to eq("HEAD_1") + expect(described_class.new(Version.new("HEAD-ffffff"), 1).to_s).to eq("HEAD-ffffff_1") end end describe "#hash" do - let(:version_one_revision_one) { described_class.new(Version.create("1.0"), 1) } - let(:version_one_dot_one_revision_one) { described_class.new(Version.create("1.1"), 1) } - let(:version_one_revision_zero) { described_class.new(Version.create("1.0"), 0) } + let(:version_one_revision_one) { described_class.new(Version.new("1.0"), 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.new("1.0"), 0) } 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_revision_zero.hash) end @@ -89,7 +89,7 @@ describe PkgVersion do describe "#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 @@ -119,13 +119,13 @@ describe PkgVersion do describe "#major_minor" 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 describe "#major_minor_patch" 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 diff --git a/Library/Homebrew/test/software_spec/head_spec.rb b/Library/Homebrew/test/software_spec/head_spec.rb index aa53279223..3037fb9f92 100644 --- a/Library/Homebrew/test/software_spec/head_spec.rb +++ b/Library/Homebrew/test/software_spec/head_spec.rb @@ -6,7 +6,7 @@ describe HeadSoftwareSpec do subject(:head_spec) { described_class.new } specify "#version" do - expect(head_spec.version).to eq(Version.create("HEAD")) + expect(head_spec.version).to eq(Version.new("HEAD")) end specify "#verify_download_integrity" do diff --git a/Library/Homebrew/utils/git.rb b/Library/Homebrew/utils/git.rb index 16044b6d24..2e42b7024d 100644 --- a/Library/Homebrew/utils/git.rb +++ b/Library/Homebrew/utils/git.rb @@ -146,7 +146,7 @@ module Utils def self.supports_partial_clone_sparse_checkout? # There is some support for partial clones prior to 2.20, but we avoid using it # due to performance issues - Version.create(version) >= Version.create("2.20.0") + Version.new(version) >= Version.new("2.20.0") end end end diff --git a/Library/Homebrew/utils/github/api.rb b/Library/Homebrew/utils/github/api.rb index 4759a83560..ab5caebed2 100644 --- a/Library/Homebrew/utils/github/api.rb +++ b/Library/Homebrew/utils/github/api.rb @@ -159,10 +159,8 @@ module GitHub github_password 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 - @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 sig { returns(Symbol) } diff --git a/Library/Homebrew/utils/svn.rb b/Library/Homebrew/utils/svn.rb index 71a1d9ddf2..4a9f79ba48 100644 --- a/Library/Homebrew/utils/svn.rb +++ b/Library/Homebrew/utils/svn.rb @@ -40,7 +40,7 @@ module Utils def invalid_cert_flags opoo "Ignoring Subversion certificate errors!" 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" end args diff --git a/Library/Homebrew/version.rb b/Library/Homebrew/version.rb index 825e95c180..3157d40b75 100644 --- a/Library/Homebrew/version.rb +++ b/Library/Homebrew/version.rb @@ -343,7 +343,7 @@ class Version sig { params(val: String).returns(Version) } def self.create(val) - # odeprecate "Version.create", "Version.new" + odeprecated "Version.create", "Version.new" new(val) end diff --git a/completions/bash/brew b/completions/bash/brew index 2f064c72c0..2678e3d9d8 100644 --- a/completions/bash/brew +++ b/completions/bash/brew @@ -126,7 +126,6 @@ _brew___cache() { __brewcomp " --HEAD --arch - --bottle-tag --build-from-source --cask --debug diff --git a/completions/fish/brew.fish b/completions/fish/brew.fish index b9963a96e1..f5328efdc2 100644 --- a/completions/fish/brew.fish +++ b/completions/fish/brew.fish @@ -193,7 +193,6 @@ end __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 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 cask -d 'Only show cache files for casks' __fish_brew_complete_arg '--cache' -l debug -d 'Display any debugging information' diff --git a/completions/zsh/_brew b/completions/zsh/_brew index 62654ac1ef..1abb5c34aa 100644 --- a/completions/zsh/_brew +++ b/completions/zsh/_brew @@ -264,7 +264,6 @@ _brew___cache() { _arguments \ '(--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.)]' \ - '(--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]' \ '--debug[Display any debugging information]' \ '(--build-from-source --bottle-tag --HEAD --cask)--force-bottle[Show the cache file used when pouring a bottle]' \ diff --git a/docs/Manpage.md b/docs/Manpage.md index ff1a38211d..d0de949190 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -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. * `--force-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`: Show the cache file used when building from HEAD. * `--formula`: diff --git a/manpages/brew.1 b/manpages/brew.1 index 10540bed32..4eb6009fda 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -1211,10 +1211,6 @@ Show the cache file used when building from source\. Show the cache file used when pouring a bottle\. . .TP -\fB\-\-bottle\-tag\fR -Show the cache file used when pouring a bottle for the given tag\. -. -.TP \fB\-\-HEAD\fR Show the cache file used when building from HEAD\. .