Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate, disable, delete code for Homebrew 3.2.0 #11548

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion Library/Homebrew/.rubocop_todo.yml
Expand Up @@ -12,7 +12,6 @@ Style/Documentation:
- "global.rb"
- "keg_relocate.rb"
- "os/linux/global.rb"
- "os/mac/architecture_list.rb"
- "os/mac/global.rb"
- "os/mac/keg.rb"
- "reinstall.rb"
Expand Down
9 changes: 5 additions & 4 deletions Library/Homebrew/cli/named_args.rb
Expand Up @@ -100,10 +100,11 @@ def load_formula_or_cask(name, only: nil, method: nil)
resolve_formula(name)
when :latest_kegs
resolve_latest_keg(name)
when :keg, :default_kegs
# TODO: (3.2) Uncomment the following
# odeprecated "`load_formula_or_cask` with `method: :keg`",
# "`load_formula_or_cask` with `method: :default_kegs`"
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)
when :kegs
_, kegs = resolve_kegs(name)
Expand Down
12 changes: 0 additions & 12 deletions Library/Homebrew/cli/parser.rb
Expand Up @@ -406,18 +406,6 @@ def named_args(type = nil, number: nil, min: nil, max: nil)
end
end

def max_named(_count)
odisabled "`max_named`", "`named_args max:`"
end

def min_named(_count_or_type)
odisabled "`min_named`", "`named_args min:`"
end

def named(_count_or_type)
odisabled "`named`", "`named_args`"
end

sig { void }
def hide_from_man_page!
@hide_from_man_page = true
Expand Down
9 changes: 1 addition & 8 deletions Library/Homebrew/cmd/search.rb
Expand Up @@ -60,8 +60,7 @@ def search_args
conflicts "--open", "--closed"
conflicts(*package_manager_switches)

# TODO: (3.2) Add `min: 1` the `named_args` once `brew search --cask` is removed
named_args :text_or_regex
named_args :text_or_regex, min: 1
end
end

Expand All @@ -74,12 +73,6 @@ def search
return
end

if args.no_named?
odisabled "`brew search --cask` with no arguments to output casks", "`brew casks`" if args.cask?

raise UsageError, "This command requires at least 1 text or regex argument."
end

query = args.named.join(" ")
string_or_regex = query_regexp(query)

Expand Down
12 changes: 2 additions & 10 deletions Library/Homebrew/cmd/tap.rb
Expand Up @@ -56,17 +56,9 @@ def tap
elsif args.no_named?
puts Tap.names
else
if args.full?
opoo "`brew tap --full` is now a no-op!"
# TODO: (3.2) Uncomment the following line and remove the `opoo` above
# odeprecated "`brew tap --full`"
end
odeprecated "`brew tap --full`" if args.full?

if args.shallow?
opoo "`brew tap --shallow` is now a no-op!"
# TODO: (3.2) Uncomment the following line and remove the `opoo` above
# odeprecated "`brew tap --shallow`"
end
odeprecated "`brew tap --shallow`" if args.shallow?

tap = Tap.fetch(args.named.first)
begin
Expand Down
2 changes: 0 additions & 2 deletions Library/Homebrew/compat/early.rb
@@ -1,4 +1,2 @@
# typed: strict
# frozen_string_literal: true

require_relative "early/download_strategy"
46 changes: 0 additions & 46 deletions Library/Homebrew/compat/early/download_strategy.rb

This file was deleted.

9 changes: 1 addition & 8 deletions Library/Homebrew/dev-cmd/man.rb
Expand Up @@ -24,13 +24,6 @@ def man_args
end

def man
odeprecated "`brew man`", "`brew generate-man-completions`"

args = man_args.parse
cmd = ["generate-man-completions"]
cmd << "--fail-if-not-changed" if args.fail_if_not_changed?

brew_rb = (HOMEBREW_LIBRARY_PATH/"brew.rb").resolved_path
system ENV["HOMEBREW_RUBY_PATH"], brew_rb, *cmd
odisabled "`brew man`", "`brew generate-man-completions`"
end
end
24 changes: 0 additions & 24 deletions Library/Homebrew/dev-cmd/mirror.rb

This file was deleted.

37 changes: 0 additions & 37 deletions Library/Homebrew/dev-cmd/release-notes.rb

This file was deleted.

18 changes: 0 additions & 18 deletions Library/Homebrew/extend/ENV/shared.rb
Expand Up @@ -238,19 +238,6 @@ def determine_cc
end
end

# Snow Leopard defines an NCURSES value the opposite of most distros.
# @see https://bugs.python.org/issue6848
sig { void }
def ncurses_define
odisabled "ENV.ncurses_define"
end

# @private
sig { void }
def userpaths!
odisabled "ENV.userpaths!"
end

sig { void }
def fortran
# Ignore repeated calls to this function as it will misleadingly warn about
Expand Down Expand Up @@ -328,11 +315,6 @@ def warn_about_non_apple_gcc(name)
sig { void }
def permit_arch_flags; end

sig { void }
def permit_weak_imports
odisabled "ENV.permit_weak_imports"
end

# @private
sig { params(cc: T.any(Symbol, String)).returns(T::Boolean) }
def compiler_any_clang?(cc = compiler)
Expand Down
12 changes: 1 addition & 11 deletions Library/Homebrew/extend/os/mac/hardware/cpu.rb
Expand Up @@ -6,7 +6,7 @@
module Hardware
class CPU
class << self
undef type, family, universal_archs, features, sse4?
undef type, family, features, sse4?

# These methods use info spewed out by sysctl.
# Look in <mach/machine.h> for decoding info.
Expand All @@ -31,16 +31,6 @@ def family
end
end

# Returns an array that's been extended with {ArchitectureListExtension},
# which provides helpers like `#as_arch_flags`.
def universal_archs
# Amazingly, this order (64, then 32) matters. It shouldn't, but it
# does. GCC (some versions? some systems?) can blow up if the other
# order is used.
# https://superuser.com/questions/740563/gcc-4-8-on-macos-fails-depending-on-arch-order
[arch_64_bit, arch_32_bit].extend ArchitectureListExtension
end

# True when running under an Intel-based shell via Rosetta 2 on an
# Apple Silicon Mac. This can be detected via seeing if there's a
# conflict between what `uname` reports and the underlying `sysctl` flags,
Expand Down
29 changes: 11 additions & 18 deletions Library/Homebrew/formula.rb
Expand Up @@ -2973,22 +2973,18 @@ def pour_bottle?(only_if: nil, &block)
@pour_bottle_check.instance_eval(&block)
end

# Deprecates a {Formula} (on a given date, if provided) so a warning is
# Deprecates a {Formula} (on the given date) so a warning is
# shown on each installation. If the date has not yet passed the formula
# will not be deprecated.
# <pre>deprecate! date: "2020-08-27", because: :unmaintained</pre>
# <pre>deprecate! date: "2020-08-27", because: "has been replaced by foo"</pre>
# @see https://docs.brew.sh/Deprecating-Disabling-and-Removing-Formulae
# @see DeprecateDisable::DEPRECATE_DISABLE_REASONS
def deprecate!(date: nil, because: nil)
odisabled "`deprecate!` without a reason", "`deprecate! because: \"reason\"`" if because.blank?
odisabled "`deprecate!` without a date", "`deprecate! date: \"#{Date.today}\"`" if date.blank?
def deprecate!(date:, because:)
@deprecation_date = Date.parse(date)
return if @deprecation_date > Date.today

@deprecation_date = Date.parse(date) if date.present?

return if date.present? && Date.parse(date) > Date.today

@deprecation_reason = because if because.present?
@deprecation_reason = because
@deprecated = true
end

Expand All @@ -3012,26 +3008,23 @@ def deprecated?
# @see .deprecate!
attr_reader :deprecation_reason

# Disables a {Formula} (on a given date, if provided) so it cannot be
# Disables a {Formula} (on the given date) so it cannot be
# installed. If the date has not yet passed the formula
# will be deprecated instead of disabled.
# <pre>disable! date: "2020-08-27", because: :does_not_build</pre>
# <pre>disable! date: "2020-08-27", because: "has been replaced by foo"</pre>
# @see https://docs.brew.sh/Deprecating-Disabling-and-Removing-Formulae
# @see DeprecateDisable::DEPRECATE_DISABLE_REASONS
def disable!(date: nil, because: nil)
odisabled "`disable!` without a reason", "`disable! because: \"reason\"`" if because.blank?
odisabled "`disable!` without a date", "`disable! date: \"#{Date.today}\"`" if date.blank?

@disable_date = Date.parse(date) if date.present?
def disable!(date:, because:)
@disable_date = Date.parse(date)

if @disable_date && @disable_date > Date.today
@deprecation_reason = because if because.present?
if @disable_date > Date.today
@deprecation_reason = because
@deprecated = true
return
end

@disable_reason = because if because.present?
@disable_reason = because
@disabled = true
end

Expand Down
6 changes: 3 additions & 3 deletions Library/Homebrew/formula_assertions.rb
Expand Up @@ -42,18 +42,18 @@ def assertions
assert_not_same: :refute_same,
}.each do |old_method, new_method|
define_method(old_method) do |*args|
odeprecated old_method, new_method
odisabled old_method, new_method
send(new_method, *args)
end
end

def assert_true(act, msg = nil)
odeprecated "assert_true", "assert(...) or assert_equal(true, ...)"
odisabled "assert_true", "assert(...) or assert_equal(true, ...)"
assert_equal(true, act, msg)
end

def assert_false(act, msg = nil)
odeprecated "assert_false", "assert(!...) or assert_equal(false, ...)"
odisabled "assert_false", "assert(!...) or assert_equal(false, ...)"
assert_equal(false, act, msg)
end

Expand Down
4 changes: 0 additions & 4 deletions Library/Homebrew/hardware.rb
Expand Up @@ -81,10 +81,6 @@ def arch
end
end

def universal_archs
odisabled "Hardware::CPU.universal_archs"
end

sig { returns(Symbol) }
def type
case RUBY_PLATFORM
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/livecheck/livecheck.rb
Expand Up @@ -533,7 +533,7 @@ def latest_version(formula_or_cask, json: false, full_name: false, verbose: fals
rescue ArgumentError => e
raise unless e.message.include?("unknown keyword: cask")

odeprecated "`def self.find_versions` in `#{strategy}` without a `cask` parameter"
odisabled "`def self.find_versions` in `#{strategy}` without a `cask` parameter"
end
match_version_map = strategy_data[:matches]
regex = strategy_data[:regex]
Expand Down