Merge pull request #4392 from MikeMcQuaid/more-deprecation-disabled
Disable more deprecations.
This commit is contained in:
commit
bd5131d710
@ -39,7 +39,7 @@ module Homebrew
|
|||||||
if ARGV.include? "--repair"
|
if ARGV.include? "--repair"
|
||||||
Tap.each(&:link_completions_and_manpages)
|
Tap.each(&:link_completions_and_manpages)
|
||||||
elsif ARGV.include? "--list-official"
|
elsif ARGV.include? "--list-official"
|
||||||
odeprecated("brew tap --list-official")
|
odisabled("brew tap --list-official")
|
||||||
elsif ARGV.include? "--list-pinned"
|
elsif ARGV.include? "--list-pinned"
|
||||||
puts Tap.select(&:pinned?).map(&:name)
|
puts Tap.select(&:pinned?).map(&:name)
|
||||||
elsif ARGV.named.empty?
|
elsif ARGV.named.empty?
|
||||||
|
|||||||
@ -34,8 +34,6 @@ module Homebrew
|
|||||||
|
|
||||||
Install.perform_preinstall_checks
|
Install.perform_preinstall_checks
|
||||||
|
|
||||||
odisabled "'brew upgrade --all'", "'brew upgrade'" if ARGV.include?("--all")
|
|
||||||
|
|
||||||
if ARGV.named.empty?
|
if ARGV.named.empty?
|
||||||
outdated = Formula.installed.select do |f|
|
outdated = Formula.installed.select do |f|
|
||||||
f.outdated?(fetch_head: ARGV.fetch_head?)
|
f.outdated?(fetch_head: ARGV.fetch_head?)
|
||||||
|
|||||||
@ -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/os/mac"
|
||||||
|
require "compat/dependable"
|
||||||
|
require "compat/dependency_collector"
|
||||||
|
require "compat/fileutils"
|
||||||
|
require "compat/formula_support"
|
||||||
|
require "compat/hbc"
|
||||||
require "compat/tap"
|
require "compat/tap"
|
||||||
|
|||||||
@ -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
|
|
||||||
@ -1,7 +1,7 @@
|
|||||||
module Dependable
|
module Dependable
|
||||||
module Compat
|
module Compat
|
||||||
def run?
|
def run?
|
||||||
odeprecated "Dependable#run?"
|
odisabled "Dependable#run?"
|
||||||
tags.include? :run
|
tags.include? :run
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -2,60 +2,10 @@ require "dependency_collector"
|
|||||||
|
|
||||||
class DependencyCollector
|
class DependencyCollector
|
||||||
module Compat
|
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)
|
def parse_string_spec(spec, tags)
|
||||||
if (tag = tags.first) && LANGUAGE_MODULES.include?(tag)
|
odisabled "'depends_on ... => :run'" if tags.include?(:run)
|
||||||
odisabled "'depends_on ... => #{tag.inspect}'"
|
|
||||||
end
|
|
||||||
|
|
||||||
if tags.include?(:run)
|
|
||||||
odeprecated "'depends_on ... => :run'"
|
|
||||||
end
|
|
||||||
|
|
||||||
super
|
super
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
prepend Compat
|
prepend Compat
|
||||||
|
|||||||
@ -1,6 +0,0 @@
|
|||||||
require "download_strategy"
|
|
||||||
|
|
||||||
CurlSSL3DownloadStrategy = CurlDownloadStrategy
|
|
||||||
CurlUnsafeDownloadStrategy = CurlDownloadStrategy
|
|
||||||
StrictSubversionDownloadStrategy = SubversionDownloadStrategy
|
|
||||||
UnsafeSubversionDownloadStrategy = SubversionDownloadStrategy
|
|
||||||
@ -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
|
|
||||||
@ -2,8 +2,13 @@ require "fileutils"
|
|||||||
|
|
||||||
module FileUtils
|
module FileUtils
|
||||||
module Compat
|
module Compat
|
||||||
|
def ruby(*args)
|
||||||
|
odeprecated "ruby", 'system "ruby"'
|
||||||
|
system RUBY_PATH, *args
|
||||||
|
end
|
||||||
|
|
||||||
def mktemp(prefix = name, opts = {})
|
def mktemp(prefix = name, opts = {})
|
||||||
# odeprecated("FileUtils.mktemp", "mktemp")
|
odeprecated("FileUtils.mktemp", "mktemp")
|
||||||
Mktemp.new(prefix, opts).run do |staging|
|
Mktemp.new(prefix, opts).run do |staging|
|
||||||
yield staging
|
yield staging
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,9 +0,0 @@
|
|||||||
class Formula
|
|
||||||
module Compat
|
|
||||||
def rake(*)
|
|
||||||
odisabled "FileUtils#rake", "system \"rake\""
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
prepend Compat
|
|
||||||
end
|
|
||||||
@ -4,27 +4,23 @@ class KegOnlyReason
|
|||||||
module Compat
|
module Compat
|
||||||
def valid?
|
def valid?
|
||||||
case @reason
|
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
|
when :provided_pre_mountain_lion
|
||||||
odeprecated "keg_only :provided_pre_mountain_lion"
|
odisabled "keg_only :provided_pre_mountain_lion"
|
||||||
MacOS.version < :mountain_lion
|
MacOS.version < :mountain_lion
|
||||||
when :provided_pre_mavericks
|
when :provided_pre_mavericks
|
||||||
odeprecated "keg_only :provided_pre_mavericks"
|
odisabled "keg_only :provided_pre_mavericks"
|
||||||
MacOS.version < :mavericks
|
MacOS.version < :mavericks
|
||||||
when :provided_pre_el_capitan
|
when :provided_pre_el_capitan
|
||||||
odeprecated "keg_only :provided_pre_el_capitan"
|
odisabled "keg_only :provided_pre_el_capitan"
|
||||||
MacOS.version < :el_capitan
|
MacOS.version < :el_capitan
|
||||||
when :provided_pre_high_sierra
|
when :provided_pre_high_sierra
|
||||||
odeprecated "keg_only :provided_pre_high_sierra"
|
odisabled "keg_only :provided_pre_high_sierra"
|
||||||
MacOS.version < :high_sierra
|
MacOS.version < :high_sierra
|
||||||
when :provided_until_xcode43
|
when :provided_until_xcode43
|
||||||
odeprecated "keg_only :provided_until_xcode43"
|
odisabled "keg_only :provided_until_xcode43"
|
||||||
MacOS::Xcode.version < "4.3"
|
MacOS::Xcode.version < "4.3"
|
||||||
when :provided_until_xcode5
|
when :provided_until_xcode5
|
||||||
odeprecated "keg_only :provided_until_xcode5"
|
odisabled "keg_only :provided_until_xcode5"
|
||||||
MacOS::Xcode.version < "5.0"
|
MacOS::Xcode.version < "5.0"
|
||||||
else
|
else
|
||||||
super
|
super
|
||||||
@ -33,42 +29,38 @@ class KegOnlyReason
|
|||||||
|
|
||||||
def to_s
|
def to_s
|
||||||
case @reason
|
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
|
when :provided_pre_mountain_lion
|
||||||
odeprecated "keg_only :provided_pre_mountain_lion"
|
odisabled "keg_only :provided_pre_mountain_lion"
|
||||||
|
|
||||||
<<~EOS
|
<<~EOS
|
||||||
macOS already provides this software in versions before Mountain Lion
|
macOS already provides this software in versions before Mountain Lion
|
||||||
EOS
|
EOS
|
||||||
when :provided_pre_mavericks
|
when :provided_pre_mavericks
|
||||||
odeprecated "keg_only :provided_pre_mavericks"
|
odisabled "keg_only :provided_pre_mavericks"
|
||||||
|
|
||||||
<<~EOS
|
<<~EOS
|
||||||
macOS already provides this software in versions before Mavericks
|
macOS already provides this software in versions before Mavericks
|
||||||
EOS
|
EOS
|
||||||
when :provided_pre_el_capitan
|
when :provided_pre_el_capitan
|
||||||
odeprecated "keg_only :provided_pre_el_capitan"
|
odisabled "keg_only :provided_pre_el_capitan"
|
||||||
|
|
||||||
<<~EOS
|
<<~EOS
|
||||||
macOS already provides this software in versions before El Capitan
|
macOS already provides this software in versions before El Capitan
|
||||||
EOS
|
EOS
|
||||||
when :provided_pre_high_sierra
|
when :provided_pre_high_sierra
|
||||||
odeprecated "keg_only :provided_pre_high_sierra"
|
odisabled "keg_only :provided_pre_high_sierra"
|
||||||
|
|
||||||
<<~EOS
|
<<~EOS
|
||||||
macOS already provides this software in versions before High Sierra
|
macOS already provides this software in versions before High Sierra
|
||||||
EOS
|
EOS
|
||||||
when :provided_until_xcode43
|
when :provided_until_xcode43
|
||||||
odeprecated "keg_only :provided_until_xcode43"
|
odisabled "keg_only :provided_until_xcode43"
|
||||||
|
|
||||||
<<~EOS
|
<<~EOS
|
||||||
Xcode provides this software prior to version 4.3
|
Xcode provides this software prior to version 4.3
|
||||||
EOS
|
EOS
|
||||||
when :provided_until_xcode5
|
when :provided_until_xcode5
|
||||||
odeprecated "keg_only :provided_until_xcode5"
|
odisabled "keg_only :provided_until_xcode5"
|
||||||
|
|
||||||
<<~EOS
|
<<~EOS
|
||||||
Xcode provides this software prior to version 5
|
Xcode provides this software prior to version 5
|
||||||
|
|||||||
@ -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
|
|
||||||
@ -1,9 +1,7 @@
|
|||||||
require "compat/hbc/cask_loader"
|
require "compat/hbc/cask_loader"
|
||||||
require "compat/hbc/cli/search"
|
require "compat/hbc/cli/search"
|
||||||
require "compat/hbc/cli/update"
|
|
||||||
require "compat/hbc/cache"
|
require "compat/hbc/cache"
|
||||||
require "compat/hbc/caskroom"
|
require "compat/hbc/caskroom"
|
||||||
require "compat/hbc/cli"
|
|
||||||
require "compat/hbc/dsl"
|
require "compat/hbc/dsl"
|
||||||
|
|
||||||
module Hbc
|
module Hbc
|
||||||
|
|||||||
@ -8,7 +8,7 @@ module Hbc
|
|||||||
|
|
||||||
def cask(header_token, **options, &block)
|
def cask(header_token, **options, &block)
|
||||||
if header_token.is_a?(Hash) && header_token.key?(:v1)
|
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]
|
header_token = header_token[:v1]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -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
|
|
||||||
@ -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
|
|
||||||
@ -2,7 +2,7 @@ module Hbc
|
|||||||
class DSL
|
class DSL
|
||||||
module Compat
|
module Compat
|
||||||
def license(*)
|
def license(*)
|
||||||
odeprecated "Hbc::DSL#license"
|
odisabled "Hbc::DSL#license"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@ module OS
|
|||||||
class << self
|
class << self
|
||||||
module Compat
|
module Compat
|
||||||
def release
|
def release
|
||||||
odeprecated "MacOS.release", "MacOS.version"
|
odisabled "MacOS.release", "MacOS.version"
|
||||||
version
|
version
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -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
|
|
||||||
@ -392,7 +392,7 @@ module Homebrew
|
|||||||
|
|
||||||
if @new_formula && dep_f.keg_only_reason &&
|
if @new_formula && dep_f.keg_only_reason &&
|
||||||
!["openssl", "apr", "apr-util"].include?(dep.name) &&
|
!["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."
|
new_formula_problem "Dependency '#{dep.name}' may be unnecessary as it is provided by macOS; try to build this formula without it."
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -1,63 +0,0 @@
|
|||||||
require "fileutils"
|
|
||||||
require "etc"
|
|
||||||
|
|
||||||
# Homebrew extends Ruby's `FileUtils` to make our code more readable.
|
|
||||||
# @see https://ruby-doc.org/stdlib-2.0.0/libdoc/fileutils/rdoc/FileUtils.html Ruby's FileUtils API
|
|
||||||
module FileUtils
|
|
||||||
# @private
|
|
||||||
alias old_mkdir mkdir
|
|
||||||
|
|
||||||
# A version of mkdir that also changes to that folder in a block.
|
|
||||||
def mkdir(name, mode: nil, noop: nil, verbose: nil, &_block)
|
|
||||||
result = mkdir_p(name, mode: mode, noop: noop, verbose: verbose)
|
|
||||||
return result unless block_given?
|
|
||||||
chdir name do
|
|
||||||
yield
|
|
||||||
end
|
|
||||||
end
|
|
||||||
module_function :mkdir
|
|
||||||
|
|
||||||
# Run `scons` using a Homebrew-installed version rather than whatever is in the `PATH`.
|
|
||||||
def scons(*args)
|
|
||||||
system Formulary.factory("scons").opt_bin/"scons", *args
|
|
||||||
end
|
|
||||||
|
|
||||||
# Run `make` 3.81 or newer.
|
|
||||||
# Uses the system make on Leopard and newer, and the
|
|
||||||
# path to the actually-installed make on Tiger or older.
|
|
||||||
def make(*args)
|
|
||||||
if Utils.popen_read("/usr/bin/make", "--version").match(/Make (\d\.\d+)/)[1] > "3.80"
|
|
||||||
make_path = "/usr/bin/make"
|
|
||||||
else
|
|
||||||
make = Formula["make"].opt_bin/"make"
|
|
||||||
make_path = make.exist? ? make.to_s : (Formula["make"].opt_bin/"gmake").to_s
|
|
||||||
end
|
|
||||||
|
|
||||||
if superenv?
|
|
||||||
make_name = File.basename(make_path)
|
|
||||||
with_env(HOMEBREW_MAKE: make_name) do
|
|
||||||
system "make", *args
|
|
||||||
end
|
|
||||||
else
|
|
||||||
system make_path, *args
|
|
||||||
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
|
|
||||||
system "xcodebuild", *args
|
|
||||||
ensure
|
|
||||||
ENV.update(removed)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@ -134,10 +134,8 @@ class Pathname
|
|||||||
end
|
end
|
||||||
private :install_symlink_p
|
private :install_symlink_p
|
||||||
|
|
||||||
if method_defined?(:write)
|
|
||||||
# @private
|
# @private
|
||||||
alias old_write write
|
alias old_write write
|
||||||
end
|
|
||||||
|
|
||||||
# we assume this pathname object is a file obviously
|
# we assume this pathname object is a file obviously
|
||||||
def write(content, *open_args)
|
def write(content, *open_args)
|
||||||
@ -152,18 +150,6 @@ class Pathname
|
|||||||
open("a", *open_args) { |f| f.puts(content) }
|
open("a", *open_args) { |f| f.puts(content) }
|
||||||
end
|
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
|
# NOTE always overwrites
|
||||||
def atomic_write(content)
|
def atomic_write(content)
|
||||||
require "tempfile"
|
require "tempfile"
|
||||||
@ -279,7 +265,7 @@ class Pathname
|
|||||||
raise ChecksumMismatchError.new(self, expected, actual) unless expected == actual
|
raise ChecksumMismatchError.new(self, expected, actual) unless expected == actual
|
||||||
end
|
end
|
||||||
|
|
||||||
alias to_str to_s unless method_defined?(:to_str)
|
alias to_str to_s
|
||||||
|
|
||||||
def cd
|
def cd
|
||||||
Dir.chdir(self) { yield self }
|
Dir.chdir(self) { yield self }
|
||||||
@ -310,15 +296,6 @@ class Pathname
|
|||||||
File.symlink(src.relative_path_from(dirname), self)
|
File.symlink(src.relative_path_from(dirname), self)
|
||||||
end
|
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
|
# @private
|
||||||
def ensure_writable
|
def ensure_writable
|
||||||
saved_perms = nil
|
saved_perms = nil
|
||||||
|
|||||||
@ -1907,6 +1907,56 @@ class Formula
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# A version of `FileUtils.mkdir` that also changes to that folder in
|
||||||
|
# a block.
|
||||||
|
def mkdir(name)
|
||||||
|
result = FileUtils.mkdir_p(name)
|
||||||
|
return result unless block_given?
|
||||||
|
FileUtils.chdir name do
|
||||||
|
yield
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Run `scons` using a Homebrew-installed version rather than whatever is
|
||||||
|
# in the `PATH`.
|
||||||
|
def scons(*args)
|
||||||
|
system Formulary.factory("scons").opt_bin/"scons", *args
|
||||||
|
end
|
||||||
|
|
||||||
|
# Run `make` 3.81 or newer.
|
||||||
|
# Uses the system make on Leopard and newer, and the
|
||||||
|
# path to the actually-installed make on Tiger or older.
|
||||||
|
def make(*args)
|
||||||
|
if Utils.popen_read("/usr/bin/make", "--version")
|
||||||
|
.match(/Make (\d\.\d+)/)[1] > "3.80"
|
||||||
|
make_path = "/usr/bin/make"
|
||||||
|
else
|
||||||
|
make = Formula["make"].opt_bin/"make"
|
||||||
|
make_path = if make.exist?
|
||||||
|
make.to_s
|
||||||
|
else
|
||||||
|
(Formula["make"].opt_bin/"gmake").to_s
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if superenv?
|
||||||
|
make_name = File.basename(make_path)
|
||||||
|
with_env(HOMEBREW_MAKE: make_name) do
|
||||||
|
system "make", *args
|
||||||
|
end
|
||||||
|
else
|
||||||
|
system make_path, *args
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Run `xcodebuild` without Homebrew's compiler environment variables set.
|
||||||
|
def xcodebuild(*args)
|
||||||
|
removed = ENV.remove_cc_etc
|
||||||
|
system "xcodebuild", *args
|
||||||
|
ensure
|
||||||
|
ENV.update(removed)
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
# Returns the prefix for a given formula version number.
|
# Returns the prefix for a given formula version number.
|
||||||
|
|||||||
@ -47,15 +47,9 @@ module Formulary
|
|||||||
cache[path] = klass
|
cache[path] = klass
|
||||||
end
|
end
|
||||||
|
|
||||||
if IO.method_defined?(:set_encoding)
|
|
||||||
def self.ensure_utf8_encoding(io)
|
def self.ensure_utf8_encoding(io)
|
||||||
io.set_encoding(Encoding::UTF_8)
|
io.set_encoding(Encoding::UTF_8)
|
||||||
end
|
end
|
||||||
else
|
|
||||||
def self.ensure_utf8_encoding(io)
|
|
||||||
io
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.class_s(name)
|
def self.class_s(name)
|
||||||
class_name = name.capitalize
|
class_name = name.capitalize
|
||||||
|
|||||||
@ -33,7 +33,7 @@ HOMEBREW_BOTTLE_DEFAULT_DOMAIN = ENV["HOMEBREW_BOTTLE_DEFAULT_DOMAIN"] ||
|
|||||||
HOMEBREW_BOTTLE_DOMAIN = ENV["HOMEBREW_BOTTLE_DOMAIN"] ||
|
HOMEBREW_BOTTLE_DOMAIN = ENV["HOMEBREW_BOTTLE_DOMAIN"] ||
|
||||||
HOMEBREW_BOTTLE_DEFAULT_DOMAIN
|
HOMEBREW_BOTTLE_DEFAULT_DOMAIN
|
||||||
|
|
||||||
require "extend/fileutils"
|
require "fileutils"
|
||||||
|
|
||||||
module Homebrew
|
module Homebrew
|
||||||
extend FileUtils
|
extend FileUtils
|
||||||
|
|||||||
@ -182,6 +182,14 @@ class Resource
|
|||||||
patches << p
|
patches << p
|
||||||
end
|
end
|
||||||
|
|
||||||
|
protected
|
||||||
|
|
||||||
|
def mktemp(prefix)
|
||||||
|
Mktemp.new(prefix).run do |staging|
|
||||||
|
yield staging
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def detect_version(val)
|
def detect_version(val)
|
||||||
@ -196,12 +204,6 @@ class Resource
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def mktemp(prefix)
|
|
||||||
Mktemp.new(prefix).run do |staging|
|
|
||||||
yield staging
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
class Go < Resource
|
class Go < Resource
|
||||||
def stage(target)
|
def stage(target)
|
||||||
super(target/name)
|
super(target/name)
|
||||||
|
|||||||
@ -70,20 +70,6 @@ describe Hbc::DSL, :cask do
|
|||||||
expect(cask.version.to_s).to eq("1.2.3")
|
expect(cask.version.to_s).to eq("1.2.3")
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|
||||||
describe "name stanza" do
|
describe "name stanza" do
|
||||||
|
|||||||
@ -128,15 +128,5 @@ describe DependencyCollector do
|
|||||||
resource.download_strategy = Class.new
|
resource.download_strategy = Class.new
|
||||||
expect { subject.add(resource) }.to raise_error(TypeError)
|
expect { subject.add(resource) }.to raise_error(TypeError)
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1303,6 +1303,17 @@ describe Formula do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "#mkdir" do
|
||||||
|
let(:dst) { mktmpdir }
|
||||||
|
|
||||||
|
it "creates intermediate directories" do
|
||||||
|
f.mkdir dst/"foo/bar/baz" do
|
||||||
|
expect(dst/"foo/bar/baz").to exist, "foo/bar/baz was not created"
|
||||||
|
expect(dst/"foo/bar/baz").to be_a_directory, "foo/bar/baz was not a directory structure"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe "with changed version scheme" do
|
describe "with changed version scheme" do
|
||||||
let(:f) do
|
let(:f) do
|
||||||
formula "testball" do
|
formula "testball" do
|
||||||
|
|||||||
@ -11,12 +11,6 @@ describe KegOnlyReason do
|
|||||||
r = described_class.new :provided_by_macos, ""
|
r = described_class.new :provided_by_macos, ""
|
||||||
expect(r.to_s).to match(/^macOS already provides/)
|
expect(r.to_s).to match(/^macOS already provides/)
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -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
|
|
||||||
@ -289,16 +289,3 @@ describe Pathname do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe FileUtils do
|
|
||||||
let(:dst) { mktmpdir }
|
|
||||||
|
|
||||||
describe "#mkdir" do
|
|
||||||
it "creates intermediate directories" do
|
|
||||||
described_class.mkdir dst/"foo/bar/baz" do
|
|
||||||
expect(dst/"foo/bar/baz").to exist, "foo/bar/baz was not created"
|
|
||||||
expect(dst/"foo/bar/baz").to be_a_directory, "foo/bar/baz was not a directory structure"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user