From f65d525693a45c8e4c2ebc1452080f08c363ee15 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 19 Oct 2021 16:36:42 +0100 Subject: [PATCH] Deprecations/disables for 3.3.0/4.0.0. Deprecate, disable and remove code for Homebrew 3.3.0 or 4.0.0 (whichever the next release ends up being). --- Library/Homebrew/cli/named_args.rb | 5 +-- Library/Homebrew/cmd/tap.rb | 4 +- Library/Homebrew/dev-cmd/bump-formula-pr.rb | 3 +- Library/Homebrew/dev-cmd/man.rb | 29 -------------- Library/Homebrew/dev-cmd/pr-automerge.rb | 2 +- Library/Homebrew/dev-cmd/pr-publish.rb | 2 +- Library/Homebrew/formula_assertions.rb | 39 ------------------- Library/Homebrew/formula_support.rb | 4 +- Library/Homebrew/software_spec.rb | 24 +----------- .../bottle_disable_reason_spec.rb | 18 --------- completions/fish/brew.fish | 2 +- completions/zsh/_brew | 2 +- docs/Manpage.md | 2 +- manpages/brew.1 | 2 +- 14 files changed, 13 insertions(+), 125 deletions(-) delete mode 100644 Library/Homebrew/dev-cmd/man.rb delete mode 100644 Library/Homebrew/test/formula_support/bottle_disable_reason_spec.rb diff --git a/Library/Homebrew/cli/named_args.rb b/Library/Homebrew/cli/named_args.rb index 505b0c91de..74df168f2f 100644 --- a/Library/Homebrew/cli/named_args.rb +++ b/Library/Homebrew/cli/named_args.rb @@ -110,9 +110,8 @@ module Homebrew when :default_kegs resolve_default_keg(name) when :keg - odeprecated "`load_formula_or_cask` with `method: :keg`", - "`load_formula_or_cask` with `method: :default_kegs`" - resolve_default_keg(name) + odisabled "`load_formula_or_cask` with `method: :keg`", + "`load_formula_or_cask` with `method: :default_kegs`" when :kegs _, kegs = resolve_kegs(name) kegs diff --git a/Library/Homebrew/cmd/tap.rb b/Library/Homebrew/cmd/tap.rb index c81b369aa2..97c8686b43 100644 --- a/Library/Homebrew/cmd/tap.rb +++ b/Library/Homebrew/cmd/tap.rb @@ -58,9 +58,9 @@ module Homebrew elsif args.no_named? puts Tap.names else - odeprecated "`brew tap --full`" if args.full? + odisabled "`brew tap --full`" if args.full? - odeprecated "`brew tap --shallow`" if args.shallow? + odisabled "`brew tap --shallow`" if args.shallow? tap = Tap.fetch(args.named.first) begin diff --git a/Library/Homebrew/dev-cmd/bump-formula-pr.rb b/Library/Homebrew/dev-cmd/bump-formula-pr.rb index c0e8d4aa79..745b221db5 100644 --- a/Library/Homebrew/dev-cmd/bump-formula-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-formula-pr.rb @@ -126,8 +126,7 @@ module Homebrew def bump_formula_pr args = bump_formula_pr_args.parse - # TODO: deprecate in Homebrew 3.3.0 - # odeprecated "`brew bump-formula-pr --write`", "`brew bump-formula-pr --write-only`" if args.write? + odeprecated "`brew bump-formula-pr --write`", "`brew bump-formula-pr --write-only`" if args.write? if args.revision.present? && args.tag.nil? && args.version.nil? raise UsageError, "`--revision` must be passed with either `--tag` or `--version`!" diff --git a/Library/Homebrew/dev-cmd/man.rb b/Library/Homebrew/dev-cmd/man.rb deleted file mode 100644 index cfd57f019e..0000000000 --- a/Library/Homebrew/dev-cmd/man.rb +++ /dev/null @@ -1,29 +0,0 @@ -# typed: true -# frozen_string_literal: true - -module Homebrew - extend T::Sig - - module_function - - sig { returns(CLI::Parser) } - def man_args - Homebrew::CLI::Parser.new do - description <<~EOS - Generate Homebrew's manpages. - EOS - switch "--fail-if-not-changed", - 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 - - hide_from_man_page! - end - end - - def man - odisabled "`brew man`", "`brew generate-man-completions`" - end -end diff --git a/Library/Homebrew/dev-cmd/pr-automerge.rb b/Library/Homebrew/dev-cmd/pr-automerge.rb index 7dca387342..10d732bf1a 100644 --- a/Library/Homebrew/dev-cmd/pr-automerge.rb +++ b/Library/Homebrew/dev-cmd/pr-automerge.rb @@ -43,7 +43,7 @@ module Homebrew def pr_automerge args = pr_automerge_args.parse - odeprecated "`brew pr-automerge --autosquash`", "`brew pr-automerge`" if args.autosquash? + odisabled "`brew pr-automerge --autosquash`", "`brew pr-automerge`" if args.autosquash? without_labels = args.without_labels || [ "do not merge", diff --git a/Library/Homebrew/dev-cmd/pr-publish.rb b/Library/Homebrew/dev-cmd/pr-publish.rb index 40d91c1332..548f2545fb 100644 --- a/Library/Homebrew/dev-cmd/pr-publish.rb +++ b/Library/Homebrew/dev-cmd/pr-publish.rb @@ -43,7 +43,7 @@ module Homebrew workflow = args.workflow || "publish-commit-bottles.yml" ref = args.branch || "master" - odeprecated "`brew pr-publish --autosquash`", "`brew pr-publish`" if args.autosquash? + odisabled "`brew pr-publish --autosquash`", "`brew pr-publish`" if args.autosquash? extra_args = [] extra_args << "--autosquash" unless args.no_autosquash? diff --git a/Library/Homebrew/formula_assertions.rb b/Library/Homebrew/formula_assertions.rb index 7e601ed55e..382bb085ca 100644 --- a/Library/Homebrew/formula_assertions.rb +++ b/Library/Homebrew/formula_assertions.rb @@ -18,45 +18,6 @@ module Homebrew @assertions ||= 0 end - # Test::Unit backwards compatibility methods - { - assert_include: :assert_includes, - assert_path_exist: :assert_path_exists, - assert_raise: :assert_raises, - assert_throw: :assert_throws, - assert_not_empty: :refute_empty, - assert_not_equal: :refute_equal, - assert_not_in_delta: :refute_in_delta, - assert_not_in_epsilon: :refute_in_epsilon, - assert_not_include: :refute_includes, - assert_not_includes: :refute_includes, - assert_not_instance_of: :refute_instance_of, - assert_not_kind_of: :refute_kind_of, - assert_not_match: :refute_match, - assert_no_match: :refute_match, - assert_not_nil: :refute_nil, - assert_not_operator: :refute_operator, - assert_path_not_exist: :refute_path_exists, - assert_not_predicate: :refute_predicate, - assert_not_respond_to: :refute_respond_to, - assert_not_same: :refute_same, - }.each do |old_method, new_method| - define_method(old_method) do |*args| - odisabled old_method, new_method - send(new_method, *args) - end - end - - def assert_true(act, msg = nil) - odisabled "assert_true", "assert(...) or assert_equal(true, ...)" - assert_equal(true, act, msg) - end - - def assert_false(act, msg = nil) - odisabled "assert_false", "assert(!...) or assert_equal(false, ...)" - assert_equal(false, act, msg) - end - # Returns the output of running cmd, and asserts the exit status. # @api public def shell_output(cmd, result = 0) diff --git a/Library/Homebrew/formula_support.rb b/Library/Homebrew/formula_support.rb index 1f8e69a00a..b9c0b49426 100644 --- a/Library/Homebrew/formula_support.rb +++ b/Library/Homebrew/formula_support.rb @@ -69,9 +69,7 @@ class BottleDisableReason def initialize(type, reason) @type = type @reason = reason - # TODO: 3.3.0: deprecate this behaviour as it was only needed for - # Homebrew/core (where we don't want unneeded or disabled bottles any more) - # odeprecated "bottle :#{@type}" if valid? + odeprecated "bottle :#{@type}" if valid? end def unneeded? diff --git a/Library/Homebrew/software_spec.rb b/Library/Homebrew/software_spec.rb index 3ef50b929f..43c812e9d3 100644 --- a/Library/Homebrew/software_spec.rb +++ b/Library/Homebrew/software_spec.rb @@ -495,13 +495,6 @@ class BottleSpecification end end - def cellar(_val = nil) - odisabled( - "`cellar` in a bottle block", - "`brew style --fix` on the formula to update the style or use `sha256` with a `cellar:` argument", - ) - end - sig { params(tag: Utils::Bottles::Tag).returns(T::Boolean) } def compatible_locations?(tag: Utils::Bottles.tag) spec = collector.specification_for(tag) @@ -548,22 +541,7 @@ class BottleSpecification key.is_a?(Symbol) && value.is_a?(String) && value.match?(sha256_regex) end - if digest && tag - # the cellar hash key only exists on the new format - cellar = hash[:cellar] - else - # otherwise, find old `sha256 "69489ae397e4645..." => :big_sur` format - digest, tag = hash.find do |key, value| - key.is_a?(String) && value.is_a?(Symbol) && key.match?(sha256_regex) - end - - if digest && tag - odisabled( - '`sha256 "digest" => :tag` in a bottle block', - '`brew style --fix` on the formula to update the style or use `sha256 tag: "digest"`', - ) - end - end + cellar = hash[:cellar] if digest && tag tag = Utils::Bottles::Tag.from_symbol(tag) diff --git a/Library/Homebrew/test/formula_support/bottle_disable_reason_spec.rb b/Library/Homebrew/test/formula_support/bottle_disable_reason_spec.rb deleted file mode 100644 index fb9c0f0c8e..0000000000 --- a/Library/Homebrew/test/formula_support/bottle_disable_reason_spec.rb +++ /dev/null @@ -1,18 +0,0 @@ -# typed: false -# frozen_string_literal: true - -require "formula_support" - -describe BottleDisableReason do - specify ":unneeded" do - bottle_disable_reason = described_class.new :unneeded, nil - expect(bottle_disable_reason).to be_unneeded - expect(bottle_disable_reason.to_s).to eq("This formula doesn't require compiling.") - end - - specify ":disabled" do - bottle_disable_reason = described_class.new :disable, "reason" - expect(bottle_disable_reason).not_to be_unneeded - expect(bottle_disable_reason.to_s).to eq("reason") - end -end diff --git a/completions/fish/brew.fish b/completions/fish/brew.fish index 08d4036da0..6666127d95 100644 --- a/completions/fish/brew.fish +++ b/completions/fish/brew.fish @@ -992,7 +992,7 @@ __fish_brew_complete_arg 'ls; and not __fish_seen_argument -l cask -l casks' -a __fish_brew_complete_arg 'ls; and not __fish_seen_argument -l formula -l formulae' -a '(__fish_brew_suggest_casks_installed)' -__fish_brew_complete_cmd 'man' 'Generate Homebrew\'s manpages' +__fish_brew_complete_cmd 'man' 'Generate Homebrew\'s manpages and shell completions' __fish_brew_complete_arg 'man' -l debug -d 'Display any debugging information' __fish_brew_complete_arg 'man' -l fail-if-not-changed -d '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)' __fish_brew_complete_arg 'man' -l help -d 'Show this message' diff --git a/completions/zsh/_brew b/completions/zsh/_brew index bebf294997..8dcdc964c9 100644 --- a/completions/zsh/_brew +++ b/completions/zsh/_brew @@ -30,6 +30,7 @@ __brew_list_aliases() { '-v' '--version' lc livecheck tc typecheck + man generate-man-completions ) echo "${aliases}" } @@ -176,7 +177,6 @@ __brew_internal_commands() { 'list:List all installed formulae and casks' 'livecheck:Check for newer versions of formulae and/or casks from upstream' 'log:Show the `git log` for formula or cask, or show the log for the Homebrew repository if no formula or cask is provided' - 'man:Generate Homebrew'\''s manpages' 'migrate:Migrate renamed packages to new names, where formula are old names of packages' 'missing:Check the given formula kegs for missing dependencies' 'options:Show install options specific to formula' diff --git a/docs/Manpage.md b/docs/Manpage.md index 67067fb184..ed3c89f47b 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -1133,7 +1133,7 @@ a formula from a tap that is not `homebrew/core` use its fully-qualified form of Display the path where *`formula`* is located. -### `generate-man-completions` [*`--fail-if-not-changed`*] +### `generate-man-completions`, `man` [*`--fail-if-not-changed`*] Generate Homebrew's manpages and shell completions. diff --git a/manpages/brew.1 b/manpages/brew.1 index e6cc9e5c9a..7351b9bd86 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -1607,7 +1607,7 @@ Overwrite the destination formula if it already exists\. .SS "\fBformula\fR \fIformula\fR [\.\.\.]" Display the path where \fIformula\fR is located\. . -.SS "\fBgenerate\-man\-completions\fR [\fI\-\-fail\-if\-not\-changed\fR]" +.SS "\fBgenerate\-man\-completions\fR, \fBman\fR [\fI\-\-fail\-if\-not\-changed\fR]" Generate Homebrew\'s manpages and shell completions\. . .TP