diff --git a/Library/Homebrew/build_options.rb b/Library/Homebrew/build_options.rb index af06250a32..36ae1d613e 100644 --- a/Library/Homebrew/build_options.rb +++ b/Library/Homebrew/build_options.rb @@ -13,9 +13,8 @@ class BuildOptions # TODO: rename private_include? when include? is removed. # @deprecated - def include?(name) - odeprecated "BuildOptions#include?" - private_include?("--#{name}") + def include?(_) + odisabled "BuildOptions#include?" end # True if a {Formula} is being built with a specific option. @@ -65,11 +64,6 @@ class BuildOptions private_include? "HEAD" end - # @private - def devel? - odisabled "BuildOptions#devel?" - end - # True if a {Formula} is being built with {Formula.stable} instead of {Formula.head}. # This is the default. #
args << "--some-beta" if build.head?
@@ -81,14 +75,12 @@ class BuildOptions # e.g. on newer Intel Macs this means a combined x86_64/x86 binary/library. #
args << "--universal-binary" if build.universal?
def universal? - odeprecated "BuildOptions#universal?" - private_include?("universal") && option_defined?("universal") + odisabled "BuildOptions#universal?" end # True if a {Formula} is being built in C++11 mode. def cxx11? - odeprecated "BuildOptions#cxx11?" - private_include?("c++11") && option_defined?("c++11") + odisabled "BuildOptions#cxx11?" end # True if the build has any arguments or options specified. diff --git a/Library/Homebrew/cli/args.rb b/Library/Homebrew/cli/args.rb index c9bdd72ccf..2e878ceed8 100644 --- a/Library/Homebrew/cli/args.rb +++ b/Library/Homebrew/cli/args.rb @@ -63,48 +63,39 @@ module Homebrew end def formulae - odeprecated "args.formulae", "args.named.to_formulae" - named.to_formulae + odisabled "args.formulae", "args.named.to_formulae" end def formulae_and_casks - odeprecated "args.formulae_and_casks", "args.named.to_formulae_and_casks" - named.to_formulae_and_casks + odisabled "args.formulae_and_casks", "args.named.to_formulae_and_casks" end def resolved_formulae - odeprecated "args.resolved_formulae", "args.named.to_resolved_formulae" - named.to_resolved_formulae + odisabled "args.resolved_formulae", "args.named.to_resolved_formulae" end def resolved_formulae_casks - odeprecated "args.resolved_formulae_casks", "args.named.to_resolved_formulae_to_casks" - named.to_resolved_formulae_to_casks + odisabled "args.resolved_formulae_casks", "args.named.to_resolved_formulae_to_casks" end def formulae_paths - odeprecated "args.formulae_paths", "args.named.to_formulae_paths" - named.to_formulae_paths + odisabled "args.formulae_paths", "args.named.to_formulae_paths" end def casks - odeprecated "args.casks", "args.named.homebrew_tap_cask_names" - named.homebrew_tap_cask_names + odisabled "args.casks", "args.named.homebrew_tap_cask_names" end def loaded_casks - odeprecated "args.loaded_casks", "args.named.to_cask" - named.to_casks + odisabled "args.loaded_casks", "args.named.to_cask" end def kegs - odeprecated "args.kegs", "args.named.to_kegs" - named.to_kegs + odisabled "args.kegs", "args.named.to_kegs" end def kegs_casks - odeprecated "args.kegs", "args.named.to_kegs_to_casks" - named.to_kegs_to_casks + odisabled "args.kegs", "args.named.to_kegs_to_casks" end def build_stable? diff --git a/Library/Homebrew/cmd/gist-logs.rb b/Library/Homebrew/cmd/gist-logs.rb index d590fb3526..a42d2457f9 100644 --- a/Library/Homebrew/cmd/gist-logs.rb +++ b/Library/Homebrew/cmd/gist-logs.rb @@ -57,16 +57,7 @@ module Homebrew files["00.tap.out"] = { content: tap } end - if GitHub.api_credentials_type == :none - puts <<~EOS - You can create a new personal access token: - #{GitHub::ALL_SCOPES_URL} - #{Utils::Shell.set_variable_in_profile("HOMEBREW_GITHUB_API_TOKEN", "your_token_here")} - - EOS - odeprecated "`brew gist-logs` with a password", "HOMEBREW_GITHUB_API_TOKEN" - login! - end + odisabled "`brew gist-logs` with a password", "HOMEBREW_GITHUB_API_TOKEN" if GitHub.api_credentials_type == :none # Description formatted to work well as page title when viewing gist descr = if f.core_formula? diff --git a/Library/Homebrew/cmd/list.rb b/Library/Homebrew/cmd/list.rb index e7e5a97536..c67ed6e223 100644 --- a/Library/Homebrew/cmd/list.rb +++ b/Library/Homebrew/cmd/list.rb @@ -103,8 +103,7 @@ module Homebrew ls_args << "-t" if args.t? if !$stdout.tty? && !args.formula? - odeprecated "`brew list` to only list formulae", "`brew list --formula`" - safe_system "ls", *ls_args, HOMEBREW_CELLAR + odisabled "`brew list` to only list formulae", "`brew list --formula`" else safe_system "ls", *ls_args, HOMEBREW_CELLAR list_casks(args: args) unless args.formula? diff --git a/Library/Homebrew/cmd/outdated.rb b/Library/Homebrew/cmd/outdated.rb index 6cb52621cb..ea40aad78f 100644 --- a/Library/Homebrew/cmd/outdated.rb +++ b/Library/Homebrew/cmd/outdated.rb @@ -50,16 +50,7 @@ module Homebrew case (j = json_version(args.json)) when :v1, :default - odeprecated "brew outdated --json#{j == :v1 ? "=v1" : ""}", "brew outdated --json=v2" - - outdated = if args.formula? || !args.cask? - outdated_formulae args: args - else - outdated_casks args: args - end - - puts JSON.generate(json_info(outdated, args: args)) - + odisabled "brew outdated --json#{j == :v1 ? "=v1" : ""}", "brew outdated --json=v2" when :v2 formulae, casks = if args.formula? [outdated_formulae(args: args), []] diff --git a/Library/Homebrew/cmd/switch.rb b/Library/Homebrew/cmd/switch.rb index a78ef0a907..3f3e4baaf3 100644 --- a/Library/Homebrew/cmd/switch.rb +++ b/Library/Homebrew/cmd/switch.rb @@ -32,7 +32,7 @@ module Homebrew odie "#{name} not found in the Cellar." unless rack.directory? - # odeprecated "`brew switch`", "`brew link` @-versioned formulae" + odeprecated "`brew switch`", "`brew link` @-versioned formulae" versions = rack.subdirs .map { |d| Keg.new(d).version } diff --git a/Library/Homebrew/compat.rb b/Library/Homebrew/compat.rb index c9ad444268..583726728f 100644 --- a/Library/Homebrew/compat.rb +++ b/Library/Homebrew/compat.rb @@ -1,12 +1,6 @@ # typed: strict # frozen_string_literal: true -require "compat/dependencies_helpers" require "compat/cli/parser" -require "compat/extend/nil" -require "compat/extend/string" require "compat/formula" require "compat/global" -require "compat/language/java" -require "compat/language/python" -require "compat/os/mac" if OS.mac? diff --git a/Library/Homebrew/compat/dependencies_helpers.rb b/Library/Homebrew/compat/dependencies_helpers.rb deleted file mode 100644 index 21122e4c35..0000000000 --- a/Library/Homebrew/compat/dependencies_helpers.rb +++ /dev/null @@ -1,18 +0,0 @@ -# typed: true -# frozen_string_literal: true - -require "cli/args" - -module DependenciesHelpers - module Compat - def argv_includes_ignores(argv = nil) - unless @printed_includes_ignores_warning - odisabled "Homebrew.argv_includes_ignores", "Homebrew.args_includes_ignores" - @printed_includes_ignores_warning = true - end - args_includes_ignores(argv ? Homebrew::CLI::Args.new : Homebrew.args) - end - end - - prepend Compat -end diff --git a/Library/Homebrew/compat/dependencies_helpers.rbi b/Library/Homebrew/compat/dependencies_helpers.rbi deleted file mode 100644 index 3ea83b62b9..0000000000 --- a/Library/Homebrew/compat/dependencies_helpers.rbi +++ /dev/null @@ -1,9 +0,0 @@ -# typed: strict - -module DependenciesHelpers - module Compat - include Kernel - - def args_includes_ignores(args); end - end -end diff --git a/Library/Homebrew/compat/extend/nil.rb b/Library/Homebrew/compat/extend/nil.rb deleted file mode 100644 index 5e521a4367..0000000000 --- a/Library/Homebrew/compat/extend/nil.rb +++ /dev/null @@ -1,12 +0,0 @@ -# typed: true -# frozen_string_literal: true - -class NilClass - module Compat - def chuzzle - odisabled ".chuzzle", "&.chomp.presence" - end - end - - prepend Compat -end diff --git a/Library/Homebrew/compat/extend/nil.rbi b/Library/Homebrew/compat/extend/nil.rbi deleted file mode 100644 index 0a0adb9756..0000000000 --- a/Library/Homebrew/compat/extend/nil.rbi +++ /dev/null @@ -1,7 +0,0 @@ -# typed: strict - -class NilClass - module Compat - include Kernel - end -end diff --git a/Library/Homebrew/compat/extend/string.rb b/Library/Homebrew/compat/extend/string.rb deleted file mode 100644 index bdbed56112..0000000000 --- a/Library/Homebrew/compat/extend/string.rb +++ /dev/null @@ -1,12 +0,0 @@ -# typed: true -# frozen_string_literal: true - -class String - module Compat - def chuzzle - odisabled ".chuzzle", "&.chomp.presence" - end - end - - prepend Compat -end diff --git a/Library/Homebrew/compat/extend/string.rbi b/Library/Homebrew/compat/extend/string.rbi deleted file mode 100644 index 4851c5b127..0000000000 --- a/Library/Homebrew/compat/extend/string.rbi +++ /dev/null @@ -1,7 +0,0 @@ -# typed: strict - -class String - module Compat - include Kernel - end -end diff --git a/Library/Homebrew/compat/formula.rb b/Library/Homebrew/compat/formula.rb index 0f08e86d9f..fd5f98f979 100644 --- a/Library/Homebrew/compat/formula.rb +++ b/Library/Homebrew/compat/formula.rb @@ -3,33 +3,20 @@ class Formula module Compat - def installed? - odisabled "Formula#installed?", - "Formula#latest_version_installed? (or Formula#any_version_installed? )" - end - - def prepare_patches - odisabled "patches", "patch do" if respond_to?(:patches) - super - end - def installed_prefix - odeprecated "Formula#installed_prefix", - "Formula#latest_installed_prefix (or Formula#any_installed_prefix)" - latest_installed_prefix + odisabled "Formula#installed_prefix", + "Formula#latest_installed_prefix (or Formula#any_installed_prefix)" end # The currently installed version for this formula. Will raise an exception # if the formula is not installed. # @private def installed_version - odeprecated "Formula#installed_version" - Keg.new(latest_installed_prefix).version + odisabled "Formula#installed_version" end def opt_or_installed_prefix_keg - odeprecated "Formula#opt_or_installed_prefix_keg", "Formula#any_installed_keg" - any_installed_keg + odisabled "Formula#opt_or_installed_prefix_keg", "Formula#any_installed_keg" end end diff --git a/Library/Homebrew/compat/global.rb b/Library/Homebrew/compat/global.rb index 3ab5383e60..e229b7cc6e 100644 --- a/Library/Homebrew/compat/global.rb +++ b/Library/Homebrew/compat/global.rb @@ -7,8 +7,7 @@ module Homebrew def args unless @printed_args_warning - odeprecated "Homebrew.args", "`args = _args.parse` and pass `args` along the call chain" - @printed_args_warning = true + odisabled "Homebrew.args", "`args = _args.parse` and pass `args` along the call chain" end @args ||= CLI::Args.new diff --git a/Library/Homebrew/compat/language/haskell.rb b/Library/Homebrew/compat/language/haskell.rb index 3619e88c02..00f6466807 100644 --- a/Library/Homebrew/compat/language/haskell.rb +++ b/Library/Homebrew/compat/language/haskell.rb @@ -4,35 +4,9 @@ module Language module Haskell module Cabal - module Compat - def cabal_sandbox(_options = {}) - odisabled "Language::Haskell::Cabal.cabal_sandbox" - end - - def cabal_sandbox_add_source(*_args) - odisabled "Language::Haskell::Cabal.cabal_sandbox_add_source" - end - - def cabal_install(*_args) - odisabled "Language::Haskell::Cabal.cabal_install", - "cabal v2-install directly with std_cabal_v2_args" - end - - def cabal_configure(_flags) - odisabled "Language::Haskell::Cabal.cabal_configure" - end - - def cabal_install_tools(*_tools) - odisabled "Language::Haskell::Cabal.cabal_install_tools" - end - - def install_cabal_package(*_args, **_options) - odisabled "Language::Haskell::Cabal.install_cabal_package", - "cabal v2-update directly followed by v2-install with std_cabal_v2_args" - end + def self.included(_) + odisabled "include Language::Haskell::Cabal" end - - prepend Compat end end end diff --git a/Library/Homebrew/compat/language/java.rb b/Library/Homebrew/compat/language/java.rb deleted file mode 100644 index 4a23f7a6c2..0000000000 --- a/Library/Homebrew/compat/language/java.rb +++ /dev/null @@ -1,17 +0,0 @@ -# typed: false -# frozen_string_literal: true - -module Language - module Java - class << self - module Compat - def java_home_cmd(_version = nil) - odisabled "Language::Java.java_home_cmd", - "Language::Java.java_home or Language::Java.overridable_java_home_env" - end - end - - prepend Compat - end - end -end diff --git a/Library/Homebrew/compat/language/python.rb b/Library/Homebrew/compat/language/python.rb deleted file mode 100644 index abb4673f6b..0000000000 --- a/Library/Homebrew/compat/language/python.rb +++ /dev/null @@ -1,17 +0,0 @@ -# typed: false -# frozen_string_literal: true - -module Language - module Python - class << self - module Compat - def rewrite_python_shebang(_python_path) - odisabled "Language::Python.rewrite_python_shebang", - "Utils::Shebang.rewrite_shebang and Shebang.python_shebang_rewrite_info(python_path)" - end - end - - prepend Compat - end - end -end diff --git a/Library/Homebrew/compat/os/mac.rb b/Library/Homebrew/compat/os/mac.rb deleted file mode 100644 index ab64aeac96..0000000000 --- a/Library/Homebrew/compat/os/mac.rb +++ /dev/null @@ -1,24 +0,0 @@ -# typed: true -# frozen_string_literal: true - -module OS - module Mac - class << self - module Compat - def preferred_arch - odisabled "MacOS.preferred_arch", "Hardware::CPU.arch (or ideally let the compiler handle it)" - end - - def tcc_db - odisabled "MacOS.tcc_db" - end - - def pre_mavericks_accessibility_dotfile - odisabled "MacOS.pre_mavericks_accessibility_dotfile" - end - end - - prepend Compat - end - end -end diff --git a/Library/Homebrew/compat/os/mac.rbi b/Library/Homebrew/compat/os/mac.rbi deleted file mode 100644 index b6156fa2e8..0000000000 --- a/Library/Homebrew/compat/os/mac.rbi +++ /dev/null @@ -1,11 +0,0 @@ -# typed: strict - -module OS - module Mac - class << self - module Compat - include Kernel - end - end - end -end diff --git a/Library/Homebrew/dev-cmd/diy.rb b/Library/Homebrew/dev-cmd/diy.rb index 55696b2352..aba0a000ff 100644 --- a/Library/Homebrew/dev-cmd/diy.rb +++ b/Library/Homebrew/dev-cmd/diy.rb @@ -25,13 +25,14 @@ module Homebrew description: "Explicitly set the of the package being installed." max_named 0 + hide_from_man_page! end end def diy args = diy_args.parse - # odeprecated "`brew diy`" + odeprecated "`brew diy`" path = Pathname.getwd diff --git a/Library/Homebrew/dev-cmd/mirror.rb b/Library/Homebrew/dev-cmd/mirror.rb index a6c2b45b1a..29c238f6a9 100644 --- a/Library/Homebrew/dev-cmd/mirror.rb +++ b/Library/Homebrew/dev-cmd/mirror.rb @@ -25,7 +25,6 @@ module Homebrew description: "Upload to Bintray, but don't publish." min_named :formula - hide_from_man_page! end end diff --git a/Library/Homebrew/dev-cmd/pull.rb b/Library/Homebrew/dev-cmd/pull.rb deleted file mode 100644 index ce6f69c358..0000000000 --- a/Library/Homebrew/dev-cmd/pull.rb +++ /dev/null @@ -1,52 +0,0 @@ -# typed: false -# frozen_string_literal: true - -require "net/http" -require "net/https" -require "json" -require "cli/parser" -require "formula" -require "formulary" -require "version" -require "pkg_version" -require "formula_info" - -module Homebrew - extend T::Sig - - module_function - - sig { returns(CLI::Parser) } - def pull_args - Homebrew::CLI::Parser.new do - usage_banner <<~EOS - `pull` [] - - Get a patch from a GitHub commit or pull request and apply it to Homebrew. - - Each may be the number of a pull request in `homebrew/core` - or the URL of any pull request or commit on GitHub. - EOS - switch "--bump", - description: "For one-formula PRs, automatically reword commit message to our preferred format." - switch "--clean", - description: "Do not rewrite or otherwise modify the commits found in the pulled PR." - switch "--ignore-whitespace", - description: "Silently ignore whitespace discrepancies when applying diffs." - switch "--resolve", - description: "When a patch fails to apply, leave in progress and allow user to resolve, instead "\ - "of aborting." - switch "--branch-okay", - description: "Do not warn if pulling to a branch besides master (useful for testing)." - switch "--no-pbcopy", - description: "Do not copy anything to the system clipboard." - - min_named 1 - hide_from_man_page! - end - end - - def pull - odisabled "brew pull", "gh pr checkout" - end -end diff --git a/Library/Homebrew/extend/os/mac/requirements/java_requirement.rb b/Library/Homebrew/extend/os/mac/requirements/java_requirement.rb index 5619850d06..dfcb9ea655 100644 --- a/Library/Homebrew/extend/os/mac/requirements/java_requirement.rb +++ b/Library/Homebrew/extend/os/mac/requirements/java_requirement.rb @@ -26,14 +26,14 @@ class JavaRequirement < Requirement end def java_home_cmd - # TODO: enable for all macOS versions and Linux on next minor release + # TODO: disable for all macOS versions and Linux on next minor release # but --version with ranges is broken on Big Sur today. if MacOS.version >= :big_sur && @version&.end_with?("+") odisabled %Q(depends_on java: "#{@version}"), 'depends_on "openjdk@11", depends_on "openjdk@8" or depends_on "openjdk"' end - # odeprecated "depends_on :java", - # 'depends_on "openjdk@11", depends_on "openjdk@8" or depends_on "openjdk"' + odeprecated "depends_on :java", + 'depends_on "openjdk@11", depends_on "openjdk@8" or depends_on "openjdk"' return unless File.executable?("/usr/libexec/java_home") diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index eaed557009..b7db312947 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -113,11 +113,6 @@ class Formula # @private attr_reader :stable - # @private - def devel - odisabled "Formula#devel" - end - # The HEAD {SoftwareSpec} for this {Formula}. # Installed when using `brew install --HEAD`. # This is always installed with the version `HEAD` and taken from the latest @@ -328,11 +323,6 @@ class Formula active_spec == stable end - # @private - def devel? - odisabled "Formula#devel?" - end - # Is the currently active {SoftwareSpec} a {#head} build? # @private def head? @@ -2227,10 +2217,6 @@ class Formula raise "You cannot override Formula#brew in class #{name}" when :test define_method(:test_defined?) { true } - when :patches - odisabled "a Formula#patches definition", "'patch do' block calls" - when :options - odisabled "a Formula#options definition", "'option do' block calls" end end @@ -2274,10 +2260,7 @@ class Formula if args.nil? @licenses else - if args.is_a? Array - odeprecated "`license [...]`", "`license any_of: [...]`" - args = { any_of: args } - end + odisabled "`license [...]`", "`license any_of: [...]`" if args.is_a? Array @licenses = args end end @@ -2463,11 +2446,6 @@ class Formula @stable.instance_eval(&block) end - # @private - def devel - odisabled "'devel' blocks in formulae", "'head' blocks or @-versioned formulae" - end - # @!attribute [w] head # Adds a {.head} {SoftwareSpec}. # This can be installed by passing the `--HEAD` option to allow diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb index efe4ef24b4..23a20fbfbe 100644 --- a/Library/Homebrew/formulary.rb +++ b/Library/Homebrew/formulary.rb @@ -225,12 +225,12 @@ module Formulary def load_file(flags:) if %r{githubusercontent.com/[\w-]+/[\w-]+/[a-f0-9]{40}(?:/Formula)?/(?[\w+-.@]+).rb} =~ url # rubocop:disable Style/CaseLikeIf - odisabled "Installation of #{formula_name} from a GitHub commit URL", - "'brew extract #{formula_name}' to stable tap on GitHub" + raise UsageError, "Installation of #{formula_name} from a GitHub commit URL is unsupported! " \ + "'brew extract #{formula_name}' to stable tap on GitHub instead." elsif url.match?(%r{^(https?|ftp)://}) - odisabled "Non-checksummed download of #{name} formula file from an arbitrary URL", - "'brew extract' or 'brew create' and 'brew tap-new' to create a "\ - "formula file in a tap on GitHub" + raise UsageError, "Non-checksummed download of #{name} formula file from an arbitrary URL is unsupported! ", + "'brew extract' or 'brew create' and 'brew tap-new' to create a "\ + "formula file in a tap on GitHub instead." end HOMEBREW_CACHE_FORMULA.mkpath FileUtils.rm_f(path) diff --git a/Library/Homebrew/patch.rb b/Library/Homebrew/patch.rb index 1157c61005..ebdbe3a19d 100644 --- a/Library/Homebrew/patch.rb +++ b/Library/Homebrew/patch.rb @@ -41,14 +41,8 @@ module Patch else {} end.each_pair do |strip, urls| - Array(urls).each do |url| - patch = case url - when :DATA - DATAPatch.new(strip) - else - LegacyPatch.new(strip, url) - end - patches << patch + Array(urls).each do + patches << DATAPatch.new(strip) end end @@ -196,15 +190,3 @@ class ExternalPatch "#<#{self.class.name}: #{strip.inspect} #{url.inspect}>" end end - -# A legacy patch. -# -# Legacy patches have no checksum and are not cached. -# -# @api private -class LegacyPatch < ExternalPatch - def initialize(strip, _url) - odisabled "legacy patches", "'patch do' blocks" - super(strip) - end -end diff --git a/Library/Homebrew/requirements/java_requirement.rb b/Library/Homebrew/requirements/java_requirement.rb index fdee4f4e03..7d7444a553 100644 --- a/Library/Homebrew/requirements/java_requirement.rb +++ b/Library/Homebrew/requirements/java_requirement.rb @@ -34,6 +34,9 @@ class JavaRequirement < Requirement end def initialize(tags = []) + odeprecated "depends_on :java", + '"depends_on "openjdk@11", "depends_on "openjdk@8" or "depends_on "openjdk"' + @version = tags.shift if tags.first&.match?(/^\d/) super(tags) @cask = suggestion.token diff --git a/Library/Homebrew/requirements/macos_requirement.rb b/Library/Homebrew/requirements/macos_requirement.rb index 52b1e84b20..5284acb114 100644 --- a/Library/Homebrew/requirements/macos_requirement.rb +++ b/Library/Homebrew/requirements/macos_requirement.rb @@ -14,16 +14,10 @@ class MacOSRequirement < Requirement attr_reader :comparator, :version def initialize(tags = [], comparator: ">=") - begin - @version = if comparator == "==" && tags.first.respond_to?(:map) - tags.shift.map { |s| MacOS::Version.from_symbol(s) } - else - MacOS::Version.from_symbol(tags.shift) unless tags.empty? - end - rescue MacOSVersionError => e - raise if e.version != :mavericks - - odisabled "depends_on :macos => :mavericks" + @version = if comparator == "==" && tags.first.respond_to?(:map) + tags.shift.map { |s| MacOS::Version.from_symbol(s) } + else + MacOS::Version.from_symbol(tags.shift) unless tags.empty? end @comparator = comparator diff --git a/Library/Homebrew/rubocops/text.rb b/Library/Homebrew/rubocops/text.rb index 5ace971a75..443eab7a58 100644 --- a/Library/Homebrew/rubocops/text.rb +++ b/Library/Homebrew/rubocops/text.rb @@ -95,21 +95,6 @@ module RuboCop end end - find_strings(body_node).each do |n| - next unless regex_match_group(n, /JAVA_HOME/i) - - next if @formula_name.match?(/^openjdk(@|$)/) - - next if find_every_method_call_by_name(body_node, :depends_on).any? do |dependency| - dependency.each_descendant(:str).count.zero? || - regex_match_group(dependency.each_descendant(:str).first, /^openjdk(@|$)/) || - depends_on?(:java) - end - - offending_node(n) - problem "Use `depends_on :java` to set JAVA_HOME" - end - prefix_path(body_node) do |prefix_node, path| next unless match = path.match(%r{^(bin|include|libexec|lib|sbin|share|Frameworks)(?:/| |$)}) diff --git a/Library/Homebrew/tab.rb b/Library/Homebrew/tab.rb index 8b732cae14..5cdbc92261 100644 --- a/Library/Homebrew/tab.rb +++ b/Library/Homebrew/tab.rb @@ -233,23 +233,17 @@ class Tab < OpenStruct end def universal? - odeprecated "Tab#universal?" - include?("universal") + odisabled "Tab#universal?" end def cxx11? - odeprecated "Tab#cxx11?" - include?("c++11") + odisabled "Tab#cxx11?" end def head? spec == :head end - def devel? - odisabled "Tab#devel?" - end - def stable? spec == :stable end @@ -314,10 +308,6 @@ class Tab < OpenStruct Version.create(versions["stable"]) if versions["stable"] end - def devel_version - odisabled "Tab#devel_version" - end - def head_version Version.create(versions["head"]) if versions["head"] end diff --git a/Library/Homebrew/test/cmd/switch_spec.rb b/Library/Homebrew/test/cmd/switch_spec.rb index b568e53000..8ad0ceb4c7 100644 --- a/Library/Homebrew/test/cmd/switch_spec.rb +++ b/Library/Homebrew/test/cmd/switch_spec.rb @@ -6,17 +6,3 @@ require "cmd/shared_examples/args_parse" describe "Homebrew.switch_args" do it_behaves_like "parseable arguments" end - -describe "brew switch", :integration_test do - it "allows switching between Formula versions" do - install_test_formula "testball" - - testball_rack = HOMEBREW_CELLAR/"testball" - FileUtils.cp_r testball_rack/"0.1", testball_rack/"0.2" - - expect { brew "switch", "testball", "0.2" } - .to output(/links created/).to_stdout - .and not_to_output.to_stderr - .and be_a_success - end -end diff --git a/Library/Homebrew/test/formula_spec.rb b/Library/Homebrew/test/formula_spec.rb index c91b27d04f..e09790157b 100644 --- a/Library/Homebrew/test/formula_spec.rb +++ b/Library/Homebrew/test/formula_spec.rb @@ -794,21 +794,19 @@ describe Formula do f1 = formula "f1" do url "f1-1" - depends_on :java depends_on x11: :recommended depends_on xcode: ["1.0", :optional] end stub_formula_loader(f1) - java = JavaRequirement.new x11 = X11Requirement.new([:recommended]) xcode = XcodeRequirement.new(["1.0", :optional]) - expect(Set.new(f1.recursive_requirements)).to eq(Set[java, x11]) + expect(Set.new(f1.recursive_requirements)).to eq(Set[x11]) f1.build = BuildOptions.new(["--with-xcode", "--without-x11"], f1.options) - expect(Set.new(f1.recursive_requirements)).to eq(Set[java, xcode]) + expect(Set.new(f1.recursive_requirements)).to eq(Set[xcode]) f1.build = f1.stable.build f2 = formula "f2" do @@ -817,14 +815,14 @@ describe Formula do depends_on "f1" end - expect(Set.new(f2.recursive_requirements)).to eq(Set[java, x11]) - expect(Set.new(f2.recursive_requirements {})).to eq(Set[java, x11, xcode]) + expect(Set.new(f2.recursive_requirements)).to eq(Set[x11]) + expect(Set.new(f2.recursive_requirements {})).to eq(Set[x11, xcode]) requirements = f2.recursive_requirements do |_dependent, requirement| - Requirement.prune if requirement.is_a?(JavaRequirement) + Requirement.prune if requirement.is_a?(X11Requirement) end - expect(Set.new(requirements)).to eq(Set[x11, xcode]) + expect(Set.new(requirements)).to eq(Set[xcode]) end specify "#to_hash" do diff --git a/Library/Homebrew/test/language/java_spec.rb b/Library/Homebrew/test/language/java_spec.rb index 52613697e0..ccabd4a0f4 100644 --- a/Library/Homebrew/test/language/java_spec.rb +++ b/Library/Homebrew/test/language/java_spec.rb @@ -6,13 +6,13 @@ require "language/java" describe Language::Java do describe "::java_home" do if !OS.mac? || MacOS.version < :big_sur - it "returns valid JAVA_HOME if version is specified", :needs_java do + it "returns valid JAVA_HOME if version is specified", :needs_macos do java_home = described_class.java_home("1.6+") expect(java_home/"bin/java").to be_an_executable end end - it "returns valid JAVA_HOME if version is not specified", :needs_java do + it "returns valid JAVA_HOME if version is not specified", :needs_macos do java_home = described_class.java_home expect(java_home/"bin/java").to be_an_executable end @@ -24,7 +24,7 @@ describe Language::Java do expect(java_home[:JAVA_HOME]).to include("--version blah") end - it "returns java_home path without version if version is not specified", :needs_java do + it "returns java_home path without version if version is not specified", :needs_macos do java_home = described_class.java_home_env expect(java_home[:JAVA_HOME]).not_to include("--version") end @@ -36,7 +36,7 @@ describe Language::Java do expect(java_home[:JAVA_HOME]).to include("--version blah") end - it "returns java_home path without version if version is not specified", :needs_java do + it "returns java_home path without version if version is not specified", :needs_macos do java_home = described_class.overridable_java_home_env expect(java_home[:JAVA_HOME]).not_to include("--version") end diff --git a/Library/Homebrew/test/os/mac/java_requirement_spec.rb b/Library/Homebrew/test/os/mac/java_requirement_spec.rb deleted file mode 100644 index 20ea5687b6..0000000000 --- a/Library/Homebrew/test/os/mac/java_requirement_spec.rb +++ /dev/null @@ -1,38 +0,0 @@ -# typed: false -# frozen_string_literal: true - -require "requirements/java_requirement" -require "fileutils" - -describe JavaRequirement do - subject { described_class.new(%w[1.8]) } - - let(:java_home) { mktmpdir } - - before do - FileUtils.mkdir java_home/"bin" - FileUtils.touch java_home/"bin/java" - allow(subject).to receive(:preferred_java).and_return(java_home/"bin/java") - end - - specify "Apple Java environment" do - expect(subject).to be_satisfied - - expect(ENV).to receive(:prepend_path) - expect(ENV).to receive(:append_to_cflags) - - subject.modify_build_environment - expect(ENV["JAVA_HOME"]).to eq(java_home.to_s) - end - - specify "Oracle Java environment" do - expect(subject).to be_satisfied - - FileUtils.mkdir java_home/"include" - expect(ENV).to receive(:prepend_path) - expect(ENV).to receive(:append_to_cflags).twice - - subject.modify_build_environment - expect(ENV["JAVA_HOME"]).to eq(java_home.to_s) - end -end diff --git a/Library/Homebrew/test/requirements/java_requirement_spec.rb b/Library/Homebrew/test/requirements/java_requirement_spec.rb deleted file mode 100644 index a33c25928c..0000000000 --- a/Library/Homebrew/test/requirements/java_requirement_spec.rb +++ /dev/null @@ -1,159 +0,0 @@ -# typed: false -# frozen_string_literal: true - -require "requirements/java_requirement" - -describe JavaRequirement do - subject { described_class.new([]) } - - before do - ENV["JAVA_HOME"] = nil - end - - describe "#initialize" do - it "parses '1.8' tag correctly" do - req = described_class.new(["1.8"]) - expect(req.display_s).to eq("Java = 1.8") - end - - it "parses '9' tag correctly" do - req = described_class.new(["9"]) - expect(req.display_s).to eq("Java = 9") - end - - it "parses '9+' tag correctly" do - req = described_class.new(["9+"]) - expect(req.display_s).to eq("Java >= 9") - end - - it "parses '11' tag correctly" do - req = described_class.new(["11"]) - expect(req.display_s).to eq("Java = 11") - end - - it "parses bogus tag correctly" do - req = described_class.new(["bogus1.8"]) - expect(req.display_s).to eq("Java") - end - end - - describe "#message" do - its(:message) { is_expected.to match(/Java is required for this software./) } - end - - describe "#inspect" do - subject { described_class.new(%w[1.7+]) } - - its(:inspect) { is_expected.to eq('#') } - end - - describe "#display_s" do - context "without specific version" do - its(:display_s) { is_expected.to eq("Java") } - end - - context "with version 1.8" do - subject { described_class.new(%w[1.8]) } - - its(:display_s) { is_expected.to eq("Java = 1.8") } - end - - context "with version 1.8+" do - subject { described_class.new(%w[1.8+]) } - - its(:display_s) { is_expected.to eq("Java >= 1.8") } - end - end - - describe "#satisfied?" do - subject(:requirement) { described_class.new(%w[1.8]) } - - if !OS.mac? || MacOS.version < :big_sur - it "returns false if no `java` executable can be found" do - allow(File).to receive(:executable?).and_return(false) - expect(requirement).not_to be_satisfied - end - end - - it "returns true if #preferred_java returns a path" do - allow(requirement).to receive(:preferred_java).and_return(Pathname.new("/usr/bin/java")) - expect(requirement).to be_satisfied - end - - context "when #possible_javas contains paths" do - let(:path) { mktmpdir } - let(:java) { path/"java" } - - def setup_java_with_version(version) - IO.write java, <<~SH - #!/bin/sh - echo 'java version "#{version}"' 1>&2 - SH - FileUtils.chmod "+x", java - end - - before do - allow(requirement).to receive(:possible_javas).and_return([java]) - end - - context "and 1.7 is required" do - subject(:requirement) { described_class.new(%w[1.7]) } - - it "returns false if all are lower" do - setup_java_with_version "1.6.0_5" - expect(requirement).not_to be_satisfied - end - - it "returns true if one is equal" do - setup_java_with_version "1.7.0_5" - expect(requirement).to be_satisfied - end - - it "returns false if all are higher" do - setup_java_with_version "1.8.0_5" - expect(requirement).not_to be_satisfied - end - end - - context "and 1.7+ is required" do - subject(:requirement) { described_class.new(%w[1.7+]) } - - it "returns false if all are lower" do - setup_java_with_version "1.6.0_5" - expect(requirement).not_to be_satisfied - end - - it "returns true if one is equal" do - setup_java_with_version "1.7.0_5" - expect(requirement).to be_satisfied - end - - it "returns true if one is higher" do - setup_java_with_version "1.8.0_5" - expect(requirement).to be_satisfied - end - end - end - end - - describe "#suggestion" do - context "without specific version" do - its(:suggestion) { is_expected.to match(/brew cask install adoptopenjdk/) } - its(:cask) { is_expected.to eq("adoptopenjdk") } - end - - context "with version 1.8" do - subject { described_class.new(%w[1.8]) } - - its(:suggestion) { is_expected.to match(%r{brew cask install homebrew/cask-versions/adoptopenjdk8}) } - its(:cask) { is_expected.to eq("homebrew/cask-versions/adoptopenjdk8") } - end - - context "with version 1.8+" do - subject { described_class.new(%w[1.8+]) } - - its(:suggestion) { is_expected.to match(/brew cask install adoptopenjdk/) } - its(:cask) { is_expected.to eq("adoptopenjdk") } - end - end -end diff --git a/Library/Homebrew/test/rubocops/text_spec.rb b/Library/Homebrew/test/rubocops/text_spec.rb index c308451b19..63c49df4f8 100644 --- a/Library/Homebrew/test/rubocops/text_spec.rb +++ b/Library/Homebrew/test/rubocops/text_spec.rb @@ -250,61 +250,6 @@ describe RuboCop::Cop::FormulaAudit::Text do RUBY end - it "When using JAVA_HOME without a java dependency" do - expect_offense(<<~RUBY) - class Foo < Formula - def install - ohai "JAVA_HOME" - ^^^^^^^^^^^ Use `depends_on :java` to set JAVA_HOME - end - end - RUBY - end - - it "When using JAVA_HOME with an openjdk dependency" do - expect_no_offenses(<<~RUBY) - class Foo < Formula - depends_on "openjdk" - def install - ohai "JAVA_HOME" - end - end - RUBY - end - - it "When using JAVA_HOME with an openjdk build dependency" do - expect_no_offenses(<<~RUBY) - class Foo < Formula - depends_on "openjdk" => :build - def install - ohai "JAVA_HOME" - end - end - RUBY - end - - it "When using JAVA_HOME with a java dependency" do - expect_no_offenses(<<~RUBY) - class Foo < Formula - depends_on :java - def install - ohai "JAVA_HOME" - end - end - RUBY - end - - it "When using JAVA_HOME with a java build dependency" do - expect_no_offenses(<<~RUBY) - class Foo < Formula - depends_on :java => :build - def install - ohai "JAVA_HOME" - end - end - RUBY - end - it "When using `prefix + \"bin\"` instead of `bin`" do expect_offense(<<~RUBY) class Foo < Formula diff --git a/Library/Homebrew/utils/github.rb b/Library/Homebrew/utils/github.rb index 3c2ada9ba8..dfd585a567 100644 --- a/Library/Homebrew/utils/github.rb +++ b/Library/Homebrew/utils/github.rb @@ -96,9 +96,7 @@ module GitHub return unless Homebrew::EnvConfig.github_api_username return unless Homebrew::EnvConfig.github_api_password - odeprecated "the GitHub API with HOMEBREW_GITHUB_API_PASSWORD", "HOMEBREW_GITHUB_API_TOKEN" - - [Homebrew::EnvConfig.github_api_password, Homebrew::EnvConfig.github_api_username] + odisabled "the GitHub API with HOMEBREW_GITHUB_API_PASSWORD", "HOMEBREW_GITHUB_API_TOKEN" end def keychain_username_password diff --git a/completions/internal_commands_list.txt b/completions/internal_commands_list.txt index 9c91e9f1f3..13cf54e93a 100644 --- a/completions/internal_commands_list.txt +++ b/completions/internal_commands_list.txt @@ -68,7 +68,6 @@ pr-publish pr-pull pr-upload prof -pull readall reinstall release-notes diff --git a/docs/Manpage.md b/docs/Manpage.md index 291381b289..d176310d69 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -1004,17 +1004,6 @@ Build bottles for these formulae with GitHub Actions. * `--upload`: Upload built bottles to Bintray. -### `diy` [*`options`*] - -Automatically determine the installation prefix for non-Homebrew software. -Using the output from this command, you can install your own software into -the Cellar and then link it into Homebrew's prefix with `brew link`. - -* `--name`: - Explicitly set the *`name`* of the package being installed. -* `--version`: - Explicitly set the *`version`* of the package being installed. - ### `edit` [*`formula`*|*`cask`*] Open a *`formula`* or *`cask`* in the editor set by `EDITOR` or `HOMEBREW_EDITOR`, @@ -1098,6 +1087,17 @@ Generate Homebrew's manpages. * `--link`: This is now done automatically by `brew update`. +### `mirror` *`formula`* + +Reupload the stable URL of a formula to Bintray for use as a mirror. + +* `--bintray-org`: + Upload to the specified Bintray organisation (default: `homebrew`). +* `--bintray-repo`: + Upload to the specified Bintray repository (default: `mirror`). +* `--no-publish`: + Upload to Bintray, but don't publish. + ### `pr-automerge` [*`options`*] Find pull requests that can be automatically merged using `brew pr-publish`. diff --git a/manpages/brew.1 b/manpages/brew.1 index e700050a57..ef8bbec3f0 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -1413,17 +1413,6 @@ Dispatch specified workflow (default: \fBdispatch\-build\-bottle\.yml\fR)\. \fB\-\-upload\fR Upload built bottles to Bintray\. . -.SS "\fBdiy\fR [\fIoptions\fR]" -Automatically determine the installation prefix for non\-Homebrew software\. Using the output from this command, you can install your own software into the Cellar and then link it into Homebrew\'s prefix with \fBbrew link\fR\. -. -.TP -\fB\-\-name\fR -Explicitly set the \fIname\fR of the package being installed\. -. -.TP -\fB\-\-version\fR -Explicitly set the \fIversion\fR of the package being installed\. -. .SS "\fBedit\fR [\fIformula\fR|\fIcask\fR]" Open a \fIformula\fR or \fIcask\fR in the editor set by \fBEDITOR\fR or \fBHOMEBREW_EDITOR\fR, or open the Homebrew repository for editing if no formula is provided\. . @@ -1523,6 +1512,21 @@ Return a failing status code if changes are detected in the manpage outputs\. Th \fB\-\-link\fR This is now done automatically by \fBbrew update\fR\. . +.SS "\fBmirror\fR \fIformula\fR" +Reupload the stable URL of a formula to Bintray for use as a mirror\. +. +.TP +\fB\-\-bintray\-org\fR +Upload to the specified Bintray organisation (default: \fBhomebrew\fR)\. +. +.TP +\fB\-\-bintray\-repo\fR +Upload to the specified Bintray repository (default: \fBmirror\fR)\. +. +.TP +\fB\-\-no\-publish\fR +Upload to Bintray, but don\'t publish\. +. .SS "\fBpr\-automerge\fR [\fIoptions\fR]" Find pull requests that can be automatically merged using \fBbrew pr\-publish\fR\. .