diff --git a/Library/Homebrew/cmd/tap.rb b/Library/Homebrew/cmd/tap.rb index 94362f7fe4..6aaf39776b 100644 --- a/Library/Homebrew/cmd/tap.rb +++ b/Library/Homebrew/cmd/tap.rb @@ -39,7 +39,7 @@ module Homebrew if ARGV.include? "--repair" Tap.each(&:link_completions_and_manpages) elsif ARGV.include? "--list-official" - odeprecated("brew tap --list-official") + odisabled("brew tap --list-official") elsif ARGV.include? "--list-pinned" puts Tap.select(&:pinned?).map(&:name) elsif ARGV.named.empty? diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb index c6e79ea9f4..c0c989c9fe 100644 --- a/Library/Homebrew/cmd/upgrade.rb +++ b/Library/Homebrew/cmd/upgrade.rb @@ -31,8 +31,6 @@ module Homebrew Install.perform_preinstall_checks - odisabled "'brew upgrade --all'", "'brew upgrade'" if ARGV.include?("--all") - if ARGV.named.empty? outdated = Formula.installed.select do |f| f.outdated?(fetch_head: ARGV.fetch_head?) diff --git a/Library/Homebrew/compat.rb b/Library/Homebrew/compat.rb index 28630befb9..fbb74cb546 100644 --- a/Library/Homebrew/compat.rb +++ b/Library/Homebrew/compat.rb @@ -1,12 +1,7 @@ -require "compat/hbc" -require "compat/formula" -require "compat/formula_support" -require "compat/requirements" -require "compat/download_strategy" -require "compat/dependency_collector" -require "compat/ENV/shared" -require "compat/extend/string" -require "compat/gpg" -require "compat/dependable" require "compat/os/mac" +require "compat/dependable" +require "compat/dependency_collector" +require "compat/fileutils" +require "compat/formula_support" +require "compat/hbc" require "compat/tap" diff --git a/Library/Homebrew/compat/ENV/shared.rb b/Library/Homebrew/compat/ENV/shared.rb deleted file mode 100644 index 4e8cd32918..0000000000 --- a/Library/Homebrew/compat/ENV/shared.rb +++ /dev/null @@ -1,13 +0,0 @@ -module SharedEnvExtension - module Compat - def j1 - odisabled "ENV.j1", "ENV.deparallelize" - end - - def java_cache - odisabled "ENV.java_cache" - end - end - - prepend Compat -end diff --git a/Library/Homebrew/compat/dependable.rb b/Library/Homebrew/compat/dependable.rb index 583bf51dab..63195686a5 100644 --- a/Library/Homebrew/compat/dependable.rb +++ b/Library/Homebrew/compat/dependable.rb @@ -1,7 +1,7 @@ module Dependable module Compat def run? - odeprecated "Dependable#run?" + odisabled "Dependable#run?" tags.include? :run end end diff --git a/Library/Homebrew/compat/dependency_collector.rb b/Library/Homebrew/compat/dependency_collector.rb index 685bbaf0ea..5acfc8f5f5 100644 --- a/Library/Homebrew/compat/dependency_collector.rb +++ b/Library/Homebrew/compat/dependency_collector.rb @@ -2,60 +2,10 @@ require "dependency_collector" class DependencyCollector module Compat - # Define the languages that we can handle as external dependencies. - LANGUAGE_MODULES = Set[ - :lua, :lua51, :perl, :python, :python3, :ruby - ].freeze - def parse_string_spec(spec, tags) - if (tag = tags.first) && LANGUAGE_MODULES.include?(tag) - odisabled "'depends_on ... => #{tag.inspect}'" - end - - if tags.include?(:run) - odeprecated "'depends_on ... => :run'" - end - + odisabled "'depends_on ... => :run'" if tags.include?(:run) super end - - def parse_symbol_spec(spec, tags) - case spec - when :clt - odisabled "'depends_on :clt'" - when :tex - odisabled "'depends_on :tex'" - when :libltdl - output_disabled(spec, "libtool") - when :apr - output_disabled(spec, "apr-util") - when :fortran - output_disabled(spec, "gcc") - when :gpg - output_disabled(spec, "gnupg") - when :hg - output_disabled(spec, "mercurial") - when :mpi - output_disabled(spec, "open-mpi") - when :python, :python2 - output_disabled(spec, "python@2") - when :python3 - output_disabled(spec, "python") - when :ant, :autoconf, :automake, :bsdmake, :cairo, :emacs, :expat, - :fontconfig, :freetype, :libtool, :libpng, :mysql, :perl, :pixman, - :postgresql, :rbenv, :ruby - output_disabled(spec) - else - super - end - end - - private - - def output_disabled(dependency, new_dependency = dependency) - odisabled "'depends_on :#{dependency}'", - "'depends_on \"#{new_dependency}\"'" - end end prepend Compat diff --git a/Library/Homebrew/compat/download_strategy.rb b/Library/Homebrew/compat/download_strategy.rb deleted file mode 100644 index ebc84786b0..0000000000 --- a/Library/Homebrew/compat/download_strategy.rb +++ /dev/null @@ -1,6 +0,0 @@ -require "download_strategy" - -CurlSSL3DownloadStrategy = CurlDownloadStrategy -CurlUnsafeDownloadStrategy = CurlDownloadStrategy -StrictSubversionDownloadStrategy = SubversionDownloadStrategy -UnsafeSubversionDownloadStrategy = SubversionDownloadStrategy diff --git a/Library/Homebrew/compat/extend/string.rb b/Library/Homebrew/compat/extend/string.rb deleted file mode 100644 index 3155168149..0000000000 --- a/Library/Homebrew/compat/extend/string.rb +++ /dev/null @@ -1,23 +0,0 @@ -class String - module Compat - def undent - odisabled "<<-EOS.undent", "<<~EOS" - self - end - alias unindent undent - - # eg: - # if foo then <<-EOS.undent_________________________________________________________72 - # Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do - # eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad - # minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip - # ex ea commodo consequat. Duis aute irure dolor in reprehenderit in - # voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur - # sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt - # mollit anim id est laborum. - # EOS - alias undent_________________________________________________________72 undent - end - - prepend Compat -end diff --git a/Library/Homebrew/compat/fileutils.rb b/Library/Homebrew/compat/fileutils.rb index ed7d106f99..0304956aef 100644 --- a/Library/Homebrew/compat/fileutils.rb +++ b/Library/Homebrew/compat/fileutils.rb @@ -2,8 +2,13 @@ require "fileutils" module FileUtils module Compat + def ruby(*args) + odeprecated "ruby", 'system "ruby"' + system RUBY_PATH, *args + end + def mktemp(prefix = name, opts = {}) - # odeprecated("FileUtils.mktemp", "mktemp") + odeprecated("FileUtils.mktemp", "mktemp") Mktemp.new(prefix, opts).run do |staging| yield staging end diff --git a/Library/Homebrew/compat/formula.rb b/Library/Homebrew/compat/formula.rb deleted file mode 100644 index 7432865f12..0000000000 --- a/Library/Homebrew/compat/formula.rb +++ /dev/null @@ -1,9 +0,0 @@ -class Formula - module Compat - def rake(*) - odisabled "FileUtils#rake", "system \"rake\"" - end - end - - prepend Compat -end diff --git a/Library/Homebrew/compat/formula_support.rb b/Library/Homebrew/compat/formula_support.rb index 81c37f313d..7cce3a80b2 100644 --- a/Library/Homebrew/compat/formula_support.rb +++ b/Library/Homebrew/compat/formula_support.rb @@ -4,27 +4,23 @@ class KegOnlyReason module Compat def valid? case @reason - when :provided_by_osx - odisabled "keg_only :provided_by_osx", "keg_only :provided_by_macos" - when :shadowed_by_osx - odisabled "keg_only :shadowed_by_osx", "keg_only :shadowed_by_macos" when :provided_pre_mountain_lion - odeprecated "keg_only :provided_pre_mountain_lion" + odisabled "keg_only :provided_pre_mountain_lion" MacOS.version < :mountain_lion when :provided_pre_mavericks - odeprecated "keg_only :provided_pre_mavericks" + odisabled "keg_only :provided_pre_mavericks" MacOS.version < :mavericks when :provided_pre_el_capitan - odeprecated "keg_only :provided_pre_el_capitan" + odisabled "keg_only :provided_pre_el_capitan" MacOS.version < :el_capitan when :provided_pre_high_sierra - odeprecated "keg_only :provided_pre_high_sierra" + odisabled "keg_only :provided_pre_high_sierra" MacOS.version < :high_sierra when :provided_until_xcode43 - odeprecated "keg_only :provided_until_xcode43" + odisabled "keg_only :provided_until_xcode43" MacOS::Xcode.version < "4.3" when :provided_until_xcode5 - odeprecated "keg_only :provided_until_xcode5" + odisabled "keg_only :provided_until_xcode5" MacOS::Xcode.version < "5.0" else super @@ -33,42 +29,38 @@ class KegOnlyReason def to_s case @reason - when :provided_by_osx - odisabled "keg_only :provided_by_osx", "keg_only :provided_by_macos" - when :shadowed_by_osx - odisabled "keg_only :shadowed_by_osx", "keg_only :shadowed_by_macos" when :provided_pre_mountain_lion - odeprecated "keg_only :provided_pre_mountain_lion" + odisabled "keg_only :provided_pre_mountain_lion" <<~EOS macOS already provides this software in versions before Mountain Lion EOS when :provided_pre_mavericks - odeprecated "keg_only :provided_pre_mavericks" + odisabled "keg_only :provided_pre_mavericks" <<~EOS macOS already provides this software in versions before Mavericks EOS when :provided_pre_el_capitan - odeprecated "keg_only :provided_pre_el_capitan" + odisabled "keg_only :provided_pre_el_capitan" <<~EOS macOS already provides this software in versions before El Capitan EOS when :provided_pre_high_sierra - odeprecated "keg_only :provided_pre_high_sierra" + odisabled "keg_only :provided_pre_high_sierra" <<~EOS macOS already provides this software in versions before High Sierra EOS when :provided_until_xcode43 - odeprecated "keg_only :provided_until_xcode43" + odisabled "keg_only :provided_until_xcode43" <<~EOS Xcode provides this software prior to version 4.3 EOS when :provided_until_xcode5 - odeprecated "keg_only :provided_until_xcode5" + odisabled "keg_only :provided_until_xcode5" <<~EOS Xcode provides this software prior to version 5 diff --git a/Library/Homebrew/compat/gpg.rb b/Library/Homebrew/compat/gpg.rb deleted file mode 100644 index ef2bec4028..0000000000 --- a/Library/Homebrew/compat/gpg.rb +++ /dev/null @@ -1,27 +0,0 @@ -module Gpg - class << self - module Compat - def executable - odisabled "Gpg.executable", 'which "gpg"' - end - - def available? - odisabled "Gpg.available?", 'which "gpg"' - end - - def create_test_key(*) - odisabled "Gpg.create_test_key" - end - - def cleanup_test_processes! - odisabled "Gpg.cleanup_test_processes!" - end - - def test(*) - odisabled "Gpg.test" - end - end - - prepend Compat - end -end diff --git a/Library/Homebrew/compat/hbc.rb b/Library/Homebrew/compat/hbc.rb index e41f39f856..0ebb67e15a 100644 --- a/Library/Homebrew/compat/hbc.rb +++ b/Library/Homebrew/compat/hbc.rb @@ -1,9 +1,7 @@ require "compat/hbc/cask_loader" require "compat/hbc/cli/search" -require "compat/hbc/cli/update" require "compat/hbc/cache" require "compat/hbc/caskroom" -require "compat/hbc/cli" require "compat/hbc/dsl" module Hbc diff --git a/Library/Homebrew/compat/hbc/cask_loader.rb b/Library/Homebrew/compat/hbc/cask_loader.rb index c62c001a2f..c3e456bf27 100644 --- a/Library/Homebrew/compat/hbc/cask_loader.rb +++ b/Library/Homebrew/compat/hbc/cask_loader.rb @@ -8,7 +8,7 @@ module Hbc def cask(header_token, **options, &block) if header_token.is_a?(Hash) && header_token.key?(:v1) - odeprecated %q("cask :v1 => 'token'"), %q("cask 'token'") + odisabled %q("cask :v1 => 'token'"), %q("cask 'token'") header_token = header_token[:v1] end diff --git a/Library/Homebrew/compat/hbc/cli.rb b/Library/Homebrew/compat/hbc/cli.rb deleted file mode 100644 index b80fd409d0..0000000000 --- a/Library/Homebrew/compat/hbc/cli.rb +++ /dev/null @@ -1,18 +0,0 @@ -require "hbc/cli/options" - -module Hbc - class CLI - include Options - - option "--binarydir=PATH", (lambda do |*| - opoo <<~EOS - Option --binarydir is obsolete! - Homebrew-Cask now uses the same location as your Homebrew installation for executable links. - EOS - end) - - option "--caskroom=PATH", (lambda do |*| - odisabled "`brew cask` with the `--caskroom` flag" - end) - end -end diff --git a/Library/Homebrew/compat/hbc/cli/update.rb b/Library/Homebrew/compat/hbc/cli/update.rb deleted file mode 100644 index 5f0f255d86..0000000000 --- a/Library/Homebrew/compat/hbc/cli/update.rb +++ /dev/null @@ -1,19 +0,0 @@ -require "hbc/cli/abstract_command" - -module Hbc - class CLI - module Compat - class Update < AbstractCommand - def run - odisabled "`brew cask update`", "`brew update`" - end - - def self.visible - false - end - end - end - - prepend Compat - end -end diff --git a/Library/Homebrew/compat/hbc/dsl.rb b/Library/Homebrew/compat/hbc/dsl.rb index 483ca4a7e6..14cc2b5335 100644 --- a/Library/Homebrew/compat/hbc/dsl.rb +++ b/Library/Homebrew/compat/hbc/dsl.rb @@ -2,7 +2,7 @@ module Hbc class DSL module Compat def license(*) - odeprecated "Hbc::DSL#license" + odisabled "Hbc::DSL#license" end end diff --git a/Library/Homebrew/compat/os/mac.rb b/Library/Homebrew/compat/os/mac.rb index a839399c2e..a9389acaff 100644 --- a/Library/Homebrew/compat/os/mac.rb +++ b/Library/Homebrew/compat/os/mac.rb @@ -3,7 +3,7 @@ module OS class << self module Compat def release - odeprecated "MacOS.release", "MacOS.version" + odisabled "MacOS.release", "MacOS.version" version end end diff --git a/Library/Homebrew/compat/requirements.rb b/Library/Homebrew/compat/requirements.rb deleted file mode 100644 index af0a9a25d0..0000000000 --- a/Library/Homebrew/compat/requirements.rb +++ /dev/null @@ -1,117 +0,0 @@ -require "requirements" - -class CVSRequirement < Requirement - fatal true - satisfy do - odisabled("CVSRequirement", "'depends_on \"cvs\"'") - end -end - -class EmacsRequirement < Requirement - fatal true - satisfy do - odisabled("EmacsRequirement", "'depends_on \"emacs\"'") - end -end - -class FortranRequirement < Requirement - fatal true - satisfy do - odisabled("FortranRequirement", "'depends_on \"gcc\"'") - end -end - -class GitRequirement < Requirement - fatal true - satisfy do - odisabled("GitRequirement", "'depends_on \"git\"'") - end -end - -class GPG2Requirement < Requirement - fatal true - satisfy do - odisabled("GPG2Requirement", "'depends_on \"gnupg\"'") - end -end - -class MercurialRequirement < Requirement - fatal true - satisfy do - odisabled("MercurialRequirement", "'depends_on \"mercurial\"'") - end -end - -class MPIRequirement < Requirement - fatal true - satisfy do - odisabled("MPIRequirement", "'depends_on \"open-mpi\"'") - end -end - -class MysqlRequirement < Requirement - fatal true - satisfy do - odisabled("MysqlRequirement", "'depends_on \"mysql\"'") - end -end - -class PerlRequirement < Requirement - fatal true - satisfy do - odisabled("PerlRequirement", "'depends_on \"perl\"'") - end -end - -class PostgresqlRequirement < Requirement - fatal true - satisfy do - odisabled("PostgresqlRequirement", "'depends_on \"postgresql\"'") - end -end - -class PythonRequirement < Requirement - fatal true - satisfy do - odisabled("PythonRequirement", "'depends_on \"python@2\"'") - end -end - -class Python3Requirement < Requirement - fatal true - satisfy do - odisabled("Python3Requirement", "'depends_on \"python\"'") - end -end - -class RbenvRequirement < Requirement - fatal true - satisfy do - odisabled("RbenvRequirement", "'depends_on \"rbenv\"'") - end -end - -class RubyRequirement < Requirement - fatal true - satisfy do - odisabled("RubyRequirement", "'depends_on \"ruby\"'") - end -end - -class SubversionRequirement < Requirement - fatal true - satisfy do - odisabled("SubversionRequirement", "'depends_on \"subversion\"'") - end -end - -class TeXRequirement < Requirement - fatal true - cask "mactex" - download "https://www.tug.org/mactex/" - satisfy do - odisabled("TeXRequirement") - end -end - -MinimumMacOSRequirement = MacOSRequirement diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index fc7bf35270..bad484be7a 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -392,7 +392,7 @@ module Homebrew if @new_formula && dep_f.keg_only_reason && !["openssl", "apr", "apr-util"].include?(dep.name) && - [:provided_by_macos, :provided_by_osx].include?(dep_f.keg_only_reason.reason) + dep_f.keg_only_reason.reason == :provided_by_macos new_formula_problem "Dependency '#{dep.name}' may be unnecessary as it is provided by macOS; try to build this formula without it." end diff --git a/Library/Homebrew/extend/fileutils.rb b/Library/Homebrew/extend/fileutils.rb index da65fe4f62..2aa83d50c7 100644 --- a/Library/Homebrew/extend/fileutils.rb +++ b/Library/Homebrew/extend/fileutils.rb @@ -43,16 +43,6 @@ module FileUtils end end - if method_defined?(:ruby) - # @private - alias old_ruby ruby - end - - # Run the `ruby` Homebrew is using rather than whatever is in the `PATH`. - def ruby(*args) - system RUBY_PATH, *args - end - # Run `xcodebuild` without Homebrew's compiler environment variables set. def xcodebuild(*args) removed = ENV.remove_cc_etc diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb index 3f26cc1833..0abea4b874 100644 --- a/Library/Homebrew/extend/pathname.rb +++ b/Library/Homebrew/extend/pathname.rb @@ -134,10 +134,8 @@ class Pathname end private :install_symlink_p - if method_defined?(:write) - # @private - alias old_write write - end + # @private + alias old_write write # we assume this pathname object is a file obviously def write(content, *open_args) @@ -152,18 +150,6 @@ class Pathname open("a", *open_args) { |f| f.puts(content) } end - unless method_defined?(:binwrite) - def binwrite(contents, *open_args) - open("wb", *open_args) { |f| f.write(contents) } - end - end - - unless method_defined?(:binread) - def binread(*open_args) - open("rb", *open_args, &:read) - end - end - # NOTE always overwrites def atomic_write(content) require "tempfile" @@ -279,7 +265,7 @@ class Pathname raise ChecksumMismatchError.new(self, expected, actual) unless expected == actual end - alias to_str to_s unless method_defined?(:to_str) + alias to_str to_s def cd Dir.chdir(self) { yield self } @@ -310,15 +296,6 @@ class Pathname File.symlink(src.relative_path_from(dirname), self) end - unless method_defined?(:/) - def /(other) - if !other.respond_to?(:to_str) && !other.respond_to?(:to_path) - odisabled "Pathname#/ with #{other.class}", "a String or a Pathname" - end - join(other.to_s) - end - end - # @private def ensure_writable saved_perms = nil diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb index 886f739d69..d5a0baeba6 100644 --- a/Library/Homebrew/formulary.rb +++ b/Library/Homebrew/formulary.rb @@ -47,14 +47,8 @@ module Formulary cache[path] = klass end - if IO.method_defined?(:set_encoding) - def self.ensure_utf8_encoding(io) - io.set_encoding(Encoding::UTF_8) - end - else - def self.ensure_utf8_encoding(io) - io - end + def self.ensure_utf8_encoding(io) + io.set_encoding(Encoding::UTF_8) end def self.class_s(name) diff --git a/Library/Homebrew/test/cask/dsl_spec.rb b/Library/Homebrew/test/cask/dsl_spec.rb index 6ce40502a6..21684bf2c9 100644 --- a/Library/Homebrew/test/cask/dsl_spec.rb +++ b/Library/Homebrew/test/cask/dsl_spec.rb @@ -70,20 +70,6 @@ describe Hbc::DSL, :cask do expect(cask.version.to_s).to eq("1.2.3") end end - - context "when it contains a deprecated DSL version", :needs_compat do - let(:token) { "compat/with-dsl-version" } - - it "may use deprecated DSL version hash syntax" do - allow(ENV).to receive(:[]).with("HOMEBREW_DEVELOPER").and_return(nil) - allow(ENV).to receive(:[]).with("HOMEBREW_NO_COLOR").and_return(nil) - - expect(cask.token).to eq("with-dsl-version") - expect(cask.url.to_s).to eq("http://example.com/TestCask.dmg") - expect(cask.homepage).to eq("http://example.com/") - expect(cask.version.to_s).to eq("1.2.3") - end - end end describe "name stanza" do diff --git a/Library/Homebrew/test/dependency_collector_spec.rb b/Library/Homebrew/test/dependency_collector_spec.rb index 7c37ba706a..c152997c88 100644 --- a/Library/Homebrew/test/dependency_collector_spec.rb +++ b/Library/Homebrew/test/dependency_collector_spec.rb @@ -128,15 +128,5 @@ describe DependencyCollector do resource.download_strategy = Class.new expect { subject.add(resource) }.to raise_error(TypeError) end - - it "is deprecated when called with a language module", :needs_compat do - expect(subject).to receive(:odeprecated) - subject.add("lpeg" => :lua) - end - - it "is deprecated when called with deprecated requirements", :needs_compat do - expect(subject).to receive(:odeprecated) - subject.add(:python) - end end end diff --git a/Library/Homebrew/test/formula_support_spec.rb b/Library/Homebrew/test/formula_support_spec.rb index f73d97cece..31fc879d89 100644 --- a/Library/Homebrew/test/formula_support_spec.rb +++ b/Library/Homebrew/test/formula_support_spec.rb @@ -11,12 +11,6 @@ describe KegOnlyReason do r = described_class.new :provided_by_macos, "" expect(r.to_s).to match(/^macOS already provides/) end - - it "is deprecated when reason mentions 'osx'", :needs_compat do - r = described_class.new :provided_by_osx, "test" - expect(r).to receive(:odeprecated) - r.to_s - end end end diff --git a/Library/Homebrew/test/mpi_requirement_spec.rb b/Library/Homebrew/test/mpi_requirement_spec.rb deleted file mode 100644 index d88156e520..0000000000 --- a/Library/Homebrew/test/mpi_requirement_spec.rb +++ /dev/null @@ -1,14 +0,0 @@ -require "compat/requirements" - -describe MPIRequirement, :needs_compat do - describe "::new" do - subject { described_class.new(wrappers + tags) } - - let(:wrappers) { [:cc, :cxx, :f77] } - let(:tags) { [:optional, "some-other-tag"] } - - it "stores wrappers as tags" do - expect(subject.tags).to eq(wrappers + tags) - end - end -end