mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Deprecate/disable code for Homebrew 2.5.0.
Do the usual "disable deprecations" and "uncomment pending deprecations" dance and delete/deprecate/disable relevant/related code.
This commit is contained in:
parent
2b3d1e7a52
commit
2e5272d04c
@ -10,11 +10,11 @@ class BuildOptions
|
||||
@options = options
|
||||
end
|
||||
|
||||
# True if a {Formula} is being built with a specific option
|
||||
# (which isn't named `with-*` or `without-*`).
|
||||
# TODO: rename private_include? when include? is removed.
|
||||
# @deprecated
|
||||
def include?(name)
|
||||
@args.include?("--#{name}")
|
||||
odeprecated "BuildOptions#include?"
|
||||
private_include?("--#{name}")
|
||||
end
|
||||
|
||||
# True if a {Formula} is being built with a specific option.
|
||||
@ -33,9 +33,9 @@ class BuildOptions
|
||||
|
||||
option_names.any? do |name|
|
||||
if option_defined? "with-#{name}"
|
||||
include? "with-#{name}"
|
||||
private_include? "with-#{name}"
|
||||
elsif option_defined? "without-#{name}"
|
||||
!include? "without-#{name}"
|
||||
!private_include? "without-#{name}"
|
||||
else
|
||||
false
|
||||
end
|
||||
@ -50,7 +50,7 @@ class BuildOptions
|
||||
|
||||
# True if a {Formula} is being built as a bottle (i.e. binary package).
|
||||
def bottle?
|
||||
include? "build-bottle"
|
||||
private_include? "build-bottle"
|
||||
end
|
||||
|
||||
# True if a {Formula} is being built with {Formula.head} instead of {Formula.stable}.
|
||||
@ -61,32 +61,33 @@ class BuildOptions
|
||||
# args << "--and-a-cold-beer" if build.with? "cold-beer"
|
||||
# end</pre>
|
||||
def head?
|
||||
include? "HEAD"
|
||||
private_include? "HEAD"
|
||||
end
|
||||
|
||||
# True if a {Formula} is being built with {Formula.devel} instead of {Formula.stable}.
|
||||
# <pre>args << "--some-beta" if build.devel?</pre>
|
||||
# @private
|
||||
def devel?
|
||||
include? "devel"
|
||||
odisabled "BuildOptions#devel?"
|
||||
end
|
||||
|
||||
# True if a {Formula} is being built with {Formula.stable} instead of {Formula.devel}
|
||||
# or {Formula.head}. This is the default.
|
||||
# <pre>args << "--some-beta" if build.devel?</pre>
|
||||
# True if a {Formula} is being built with {Formula.stable} instead of {Formula.head}.
|
||||
# This is the default.
|
||||
# <pre>args << "--some-beta" if build.head?</pre>
|
||||
def stable?
|
||||
!(head? || devel?)
|
||||
!head?
|
||||
end
|
||||
|
||||
# True if a {Formula} is being built universally.
|
||||
# e.g. on newer Intel Macs this means a combined x86_64/x86 binary/library.
|
||||
# <pre>args << "--universal-binary" if build.universal?</pre>
|
||||
def universal?
|
||||
include?("universal") && option_defined?("universal")
|
||||
odeprecated "BuildOptions#universal?"
|
||||
private_include?("universal") && option_defined?("universal")
|
||||
end
|
||||
|
||||
# True if a {Formula} is being built in C++11 mode.
|
||||
def cxx11?
|
||||
include?("c++11") && option_defined?("c++11")
|
||||
odeprecated "BuildOptions#cxx11?"
|
||||
private_include?("c++11") && option_defined?("c++11")
|
||||
end
|
||||
|
||||
# True if the build has any arguments or options specified.
|
||||
@ -106,6 +107,11 @@ class BuildOptions
|
||||
|
||||
private
|
||||
|
||||
# TODO: rename to include? when include? is removed.
|
||||
def private_include?(name)
|
||||
@args.include?("--#{name}")
|
||||
end
|
||||
|
||||
def option_defined?(name)
|
||||
@options.include? name
|
||||
end
|
||||
|
@ -227,10 +227,9 @@ module Cask
|
||||
detect_external_command(*argv) ||
|
||||
[args.remaining.empty? ? NullCommand : UnknownSubcommand.new(args.remaining.first), argv]
|
||||
|
||||
# TODO: enable for next major/minor release
|
||||
# if (replacement = DEPRECATED_COMMANDS[command])
|
||||
# odeprecated "brew cask #{command.command_name}", replacement
|
||||
# end
|
||||
if (replacement = DEPRECATED_COMMANDS[command])
|
||||
odeprecated "brew cask #{command.command_name}", replacement
|
||||
end
|
||||
|
||||
if args.help?
|
||||
puts command.help
|
||||
|
@ -57,66 +57,57 @@ module Homebrew
|
||||
end
|
||||
|
||||
def formulae
|
||||
# TODO: enable for next major/minor release
|
||||
# odeprecated "args.formulae", "args.named.to_formulae"
|
||||
odeprecated "args.formulae", "args.named.to_formulae"
|
||||
named.to_formulae
|
||||
end
|
||||
|
||||
def formulae_and_casks
|
||||
# TODO: enable for next major/minor release
|
||||
# odeprecated "args.formulae_and_casks", "args.named.to_formulae_and_casks"
|
||||
odeprecated "args.formulae_and_casks", "args.named.to_formulae_and_casks"
|
||||
named.to_formulae_and_casks
|
||||
end
|
||||
|
||||
def resolved_formulae
|
||||
# TODO: enable for next major/minor release
|
||||
# odeprecated "args.resolved_formulae", "args.named.to_resolved_formulae"
|
||||
odeprecated "args.resolved_formulae", "args.named.to_resolved_formulae"
|
||||
named.to_resolved_formulae
|
||||
end
|
||||
|
||||
def resolved_formulae_casks
|
||||
# TODO: enable for next major/minor release
|
||||
# odeprecated "args.resolved_formulae_casks", "args.named.to_resolved_formulae_to_casks"
|
||||
odeprecated "args.resolved_formulae_casks", "args.named.to_resolved_formulae_to_casks"
|
||||
named.to_resolved_formulae_to_casks
|
||||
end
|
||||
|
||||
def formulae_paths
|
||||
# TODO: enable for next major/minor release
|
||||
# odeprecated "args.formulae_paths", "args.named.to_formulae_paths"
|
||||
odeprecated "args.formulae_paths", "args.named.to_formulae_paths"
|
||||
named.to_formulae_paths
|
||||
end
|
||||
|
||||
def casks
|
||||
# TODO: enable for next major/minor release
|
||||
# odeprecated "args.casks", "args.named.homebrew_tap_cask_names"
|
||||
odeprecated "args.casks", "args.named.homebrew_tap_cask_names"
|
||||
named.homebrew_tap_cask_names
|
||||
end
|
||||
|
||||
def loaded_casks
|
||||
# TODO: enable for next major/minor release
|
||||
# odeprecated "args.loaded_casks", "args.named.to_cask"
|
||||
odeprecated "args.loaded_casks", "args.named.to_cask"
|
||||
named.to_casks
|
||||
end
|
||||
|
||||
def kegs
|
||||
# TODO: enable for next major/minor release
|
||||
# odeprecated "args.kegs", "args.named.to_kegs"
|
||||
odeprecated "args.kegs", "args.named.to_kegs"
|
||||
named.to_kegs
|
||||
end
|
||||
|
||||
def kegs_casks
|
||||
# TODO: enable for next major/minor release
|
||||
# odeprecated "args.kegs", "args.named.to_kegs_to_casks"
|
||||
odeprecated "args.kegs", "args.named.to_kegs_to_casks"
|
||||
named.to_kegs_to_casks
|
||||
end
|
||||
|
||||
def build_stable?
|
||||
!(HEAD? || devel?)
|
||||
!HEAD?
|
||||
end
|
||||
|
||||
def build_from_source_formulae
|
||||
if build_from_source? || build_bottle?
|
||||
formulae.map(&:full_name)
|
||||
named.to_formulae.map(&:full_name)
|
||||
else
|
||||
[]
|
||||
end
|
||||
@ -124,7 +115,7 @@ module Homebrew
|
||||
|
||||
def include_test_formulae
|
||||
if include_test?
|
||||
formulae.map(&:full_name)
|
||||
named.to_formulae.map(&:full_name)
|
||||
else
|
||||
[]
|
||||
end
|
||||
@ -171,8 +162,6 @@ module Homebrew
|
||||
def spec(default = :stable)
|
||||
if HEAD?
|
||||
:head
|
||||
elsif devel?
|
||||
:devel
|
||||
else
|
||||
default
|
||||
end
|
||||
|
@ -410,8 +410,6 @@ module Homebrew
|
||||
named_args = argv.reject { |arg| arg.start_with?("-") } + non_options
|
||||
spec = if argv.include?("--HEAD")
|
||||
:head
|
||||
elsif argv.include?("--devel")
|
||||
:devel
|
||||
else
|
||||
:stable
|
||||
end
|
||||
|
@ -166,10 +166,6 @@ module Homebrew
|
||||
specs << s
|
||||
end
|
||||
|
||||
if devel = f.devel
|
||||
specs << "devel #{devel.version}"
|
||||
end
|
||||
|
||||
specs << "HEAD" if f.head
|
||||
|
||||
attrs = []
|
||||
@ -229,7 +225,7 @@ module Homebrew
|
||||
end
|
||||
end
|
||||
|
||||
if !f.options.empty? || f.head || f.devel
|
||||
if !f.options.empty? || f.head
|
||||
ohai "Options"
|
||||
Options.dump_for_formula f
|
||||
end
|
||||
|
@ -54,8 +54,6 @@ module Homebrew
|
||||
"macOS, even if it would not normally be used for installation."
|
||||
switch "--include-test",
|
||||
description: "Install testing dependencies required to run `brew test` <formula>."
|
||||
switch "--devel",
|
||||
description: "If <formula> defines it, install the development version."
|
||||
switch "--HEAD",
|
||||
description: "If <formula> defines it, install the HEAD version, aka. master, trunk, unstable."
|
||||
switch "--fetch-HEAD",
|
||||
@ -133,31 +131,16 @@ module Homebrew
|
||||
|
||||
args.named.to_formulae.each do |f|
|
||||
# head-only without --HEAD is an error
|
||||
if !args.HEAD? && f.stable.nil? && f.devel.nil?
|
||||
if !args.HEAD? && f.stable.nil?
|
||||
raise <<~EOS
|
||||
#{f.full_name} is a head-only formula
|
||||
Install with `brew install --HEAD #{f.full_name}`
|
||||
EOS
|
||||
end
|
||||
|
||||
# devel-only without --devel is an error
|
||||
if !args.devel? && f.stable.nil? && f.head.nil?
|
||||
raise <<~EOS
|
||||
#{f.full_name} is a devel-only formula
|
||||
Install with `brew install --devel #{f.full_name}`
|
||||
EOS
|
||||
end
|
||||
|
||||
if !(args.HEAD? || args.devel?) && f.stable.nil?
|
||||
raise "#{f.full_name} has no stable download, please choose --devel or --HEAD"
|
||||
end
|
||||
|
||||
# --HEAD, fail with no head defined
|
||||
raise "No head is defined for #{f.full_name}" if args.HEAD? && f.head.nil?
|
||||
|
||||
# --devel, fail with no devel defined
|
||||
raise "No devel block is defined for #{f.full_name}" if args.devel? && f.devel.nil?
|
||||
|
||||
installed_head_version = f.latest_head_version
|
||||
if installed_head_version &&
|
||||
!f.head_version_outdated?(installed_head_version, fetch_head: args.fetch_HEAD?)
|
||||
|
@ -44,10 +44,9 @@ module Homebrew
|
||||
def outdated
|
||||
args = outdated_args.parse
|
||||
|
||||
case json_version(args.json)
|
||||
case (j = json_version(args.json))
|
||||
when :v1, :default
|
||||
# TODO: enable for next major/minor release
|
||||
# odeprecated "brew outdated --json#{json_version == :v1 ? "=v1" : ""}", "brew outdated --json=v2"
|
||||
odeprecated "brew outdated --json#{j == :v1 ? "=v1" : ""}", "brew outdated --json=v2"
|
||||
|
||||
outdated = if args.formula? || !args.cask?
|
||||
outdated_formulae args: args
|
||||
|
@ -36,12 +36,6 @@ module Homebrew
|
||||
description: "Include all formulae that specify <formula> as `:optional` type dependency."
|
||||
switch "--skip-recommended",
|
||||
description: "Skip all formulae that specify <formula> as `:recommended` type dependency."
|
||||
switch "--devel",
|
||||
description: "Show usage of <formula> by development builds."
|
||||
switch "--HEAD",
|
||||
description: "Show usage of <formula> by HEAD builds."
|
||||
|
||||
conflicts "--devel", "--HEAD"
|
||||
min_named :formula
|
||||
end
|
||||
end
|
||||
@ -49,9 +43,6 @@ module Homebrew
|
||||
def uses
|
||||
args = uses_args.parse
|
||||
|
||||
odeprecated "brew uses --devel" if args.devel?
|
||||
odeprecated "brew uses --HEAD" if args.HEAD?
|
||||
|
||||
Formulary.enable_factory_cache!
|
||||
|
||||
used_formulae_missing = false
|
||||
|
@ -6,7 +6,7 @@ module DependenciesHelpers
|
||||
module Compat
|
||||
def argv_includes_ignores(argv = nil)
|
||||
unless @printed_includes_ignores_warning
|
||||
odeprecated "Homebrew.argv_includes_ignores", "Homebrew.args_includes_ignores"
|
||||
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)
|
||||
|
@ -3,7 +3,7 @@
|
||||
class NilClass
|
||||
module Compat
|
||||
def chuzzle
|
||||
odeprecated "chuzzle", "chomp.presence"
|
||||
odisabled ".chuzzle", "&.chomp.presence"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -2,12 +2,8 @@
|
||||
|
||||
class String
|
||||
module Compat
|
||||
# String.chomp, but if result is empty: returns nil instead.
|
||||
# Allows `chuzzle || foo` short-circuits.
|
||||
def chuzzle
|
||||
odeprecated "chuzzle", "chomp.presence"
|
||||
s = chomp
|
||||
s unless s.empty?
|
||||
odisabled ".chuzzle", "&.chomp.presence"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -3,24 +3,17 @@
|
||||
class Formula
|
||||
module Compat
|
||||
def installed?
|
||||
odeprecated "Formula#installed?",
|
||||
odisabled "Formula#installed?",
|
||||
"Formula#latest_version_installed? (or Formula#any_version_installed? )"
|
||||
latest_version_installed?
|
||||
end
|
||||
|
||||
def prepare_patches
|
||||
if respond_to?(:patches)
|
||||
active_spec.add_legacy_patches(patches)
|
||||
odeprecated "patches", "patch do"
|
||||
end
|
||||
|
||||
super
|
||||
odisabled "patches", "patch do" if respond_to?(:patches)
|
||||
end
|
||||
|
||||
def installed_prefix
|
||||
# TODO: deprecate for Homebrew 2.5
|
||||
# odeprecated "Formula#installed_prefix",
|
||||
# "Formula#latest_installed_prefix (or Formula#any_installed_prefix)"
|
||||
odeprecated "Formula#installed_prefix",
|
||||
"Formula#latest_installed_prefix (or Formula#any_installed_prefix)"
|
||||
latest_installed_prefix
|
||||
end
|
||||
|
||||
@ -28,14 +21,12 @@ class Formula
|
||||
# if the formula is not installed.
|
||||
# @private
|
||||
def installed_version
|
||||
# TODO: deprecate for Homebrew 2.5
|
||||
# odeprecated "Formula#installed_version"
|
||||
odeprecated "Formula#installed_version"
|
||||
Keg.new(latest_installed_prefix).version
|
||||
end
|
||||
|
||||
def opt_or_installed_prefix_keg
|
||||
# TODO: deprecate for Homebrew 2.5
|
||||
# odeprecated "Formula#opt_or_installed_prefix_keg", "Formula#any_installed_keg"
|
||||
odeprecated "Formula#opt_or_installed_prefix_keg", "Formula#any_installed_keg"
|
||||
any_installed_keg
|
||||
end
|
||||
end
|
||||
|
@ -4,107 +4,30 @@ module Language
|
||||
module Haskell
|
||||
module Cabal
|
||||
module Compat
|
||||
def cabal_sandbox(options = {})
|
||||
odeprecated "Language::Haskell::Cabal.cabal_sandbox"
|
||||
|
||||
pwd = Pathname.pwd
|
||||
home = options[:home] || pwd
|
||||
|
||||
# pretend HOME is elsewhere, so that ~/.cabal is kept as untouched
|
||||
# as possible (except for ~/.cabal/setup-exe-cache)
|
||||
# https://github.com/haskell/cabal/issues/1234
|
||||
saved_home = ENV["HOME"]
|
||||
ENV["HOME"] = home
|
||||
|
||||
system "cabal", "v1-sandbox", "init"
|
||||
cabal_sandbox_bin = pwd/".cabal-sandbox/bin"
|
||||
mkdir_p cabal_sandbox_bin
|
||||
|
||||
# make available any tools that will be installed in the sandbox
|
||||
saved_path = ENV["PATH"]
|
||||
ENV.prepend_path "PATH", cabal_sandbox_bin
|
||||
|
||||
# avoid updating the cabal package database more than once
|
||||
system "cabal", "v1-update" unless (home/".cabal/packages").exist?
|
||||
|
||||
yield
|
||||
|
||||
# remove the sandbox and all build products
|
||||
rm_rf [".cabal-sandbox", "cabal.sandbox.config", "dist"]
|
||||
|
||||
# avoid installing any Haskell libraries, as a matter of policy
|
||||
rm_rf lib unless options[:keep_lib]
|
||||
|
||||
# restore the environment
|
||||
ENV["HOME"] = saved_home
|
||||
ENV["PATH"] = saved_path
|
||||
def cabal_sandbox(_options = {})
|
||||
odisabled "Language::Haskell::Cabal.cabal_sandbox"
|
||||
end
|
||||
|
||||
def cabal_sandbox_add_source(*args)
|
||||
odeprecated "Language::Haskell::Cabal.cabal_sandbox_add_source"
|
||||
|
||||
system "cabal", "v1-sandbox", "add-source", *args
|
||||
def cabal_sandbox_add_source(*_args)
|
||||
odisabled "Language::Haskell::Cabal.cabal_sandbox_add_source"
|
||||
end
|
||||
|
||||
def cabal_install(*args)
|
||||
odeprecated "Language::Haskell::Cabal.cabal_install",
|
||||
def cabal_install(*_args)
|
||||
odisabled "Language::Haskell::Cabal.cabal_install",
|
||||
"cabal v2-install directly with std_cabal_v2_args"
|
||||
|
||||
# cabal hardcodes 64 as the maximum number of parallel jobs
|
||||
# https://github.com/Homebrew/legacy-homebrew/issues/49509
|
||||
make_jobs = (ENV.make_jobs > 64) ? 64 : ENV.make_jobs
|
||||
|
||||
# cabal-install's dependency-resolution backtracking strategy can easily
|
||||
# need more than the default 2,000 maximum number of "backjumps," since
|
||||
# Hackage is a fast-moving, rolling-release target. The highest known
|
||||
# needed value by a formula at this time (February 2016) was 43,478 for
|
||||
# git-annex, so 100,000 should be enough to avoid most gratuitous
|
||||
# backjumps build failures.
|
||||
system "cabal", "v1-install", "--jobs=#{make_jobs}", "--max-backjumps=100000", *args
|
||||
end
|
||||
|
||||
def cabal_configure(flags)
|
||||
odeprecated "Language::Haskell::Cabal.cabal_configure"
|
||||
|
||||
system "cabal", "v1-configure", flags
|
||||
def cabal_configure(_flags)
|
||||
odisabled "Language::Haskell::Cabal.cabal_configure"
|
||||
end
|
||||
|
||||
def cabal_install_tools(*tools)
|
||||
odeprecated "Language::Haskell::Cabal.cabal_install_tools"
|
||||
|
||||
# install tools sequentially, as some tools can depend on other tools
|
||||
tools.each { |tool| cabal_install tool }
|
||||
|
||||
# unregister packages installed as dependencies for the tools, so
|
||||
# that they can't cause dependency conflicts for the main package
|
||||
rm_rf Dir[".cabal-sandbox/*packages.conf.d/"]
|
||||
def cabal_install_tools(*_tools)
|
||||
odisabled "Language::Haskell::Cabal.cabal_install_tools"
|
||||
end
|
||||
|
||||
def install_cabal_package(*args, **options)
|
||||
odeprecated "Language::Haskell::Cabal.install_cabal_package",
|
||||
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"
|
||||
|
||||
cabal_sandbox do
|
||||
cabal_install_tools(*options[:using]) if options[:using]
|
||||
|
||||
# if we have build flags, we have to pass them to cabal install to resolve the necessary
|
||||
# dependencies, and call cabal configure afterwards to set the flags again for compile
|
||||
flags = "--flags=#{options[:flags].join(" ")}" if options[:flags]
|
||||
|
||||
args_and_flags = args
|
||||
args_and_flags << flags unless flags.nil?
|
||||
|
||||
# install dependencies in the sandbox
|
||||
cabal_install "--only-dependencies", *args_and_flags
|
||||
|
||||
# call configure if build flags are set
|
||||
cabal_configure flags unless flags.nil?
|
||||
|
||||
# install the main package in the destination dir
|
||||
cabal_install "--prefix=#{prefix}", *args
|
||||
|
||||
yield if block_given?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -4,14 +4,9 @@ module Language
|
||||
module Java
|
||||
class << self
|
||||
module Compat
|
||||
def java_home_cmd(version = nil)
|
||||
odeprecated "Language::Java.java_home_cmd",
|
||||
def java_home_cmd(_version = nil)
|
||||
odisabled "Language::Java.java_home_cmd",
|
||||
"Language::Java.java_home or Language::Java.overridable_java_home_env"
|
||||
|
||||
# macOS provides /usr/libexec/java_home, but Linux does not.
|
||||
return system_java_home_cmd(version) if OS.mac?
|
||||
|
||||
raise NotImplementedError
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -4,12 +4,9 @@ module Language
|
||||
module Python
|
||||
class << self
|
||||
module Compat
|
||||
def rewrite_python_shebang(python_path)
|
||||
odeprecated "Language::Python.rewrite_python_shebang",
|
||||
def rewrite_python_shebang(_python_path)
|
||||
odisabled "Language::Python.rewrite_python_shebang",
|
||||
"Utils::Shebang.rewrite_shebang and Shebang.python_shebang_rewrite_info(python_path)"
|
||||
Pathname.pwd.find do |f|
|
||||
Utils::Shebang.rewrite_shebang(Shebang.python_shebang_rewrite_info(python_path), f)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -5,22 +5,15 @@ module OS
|
||||
class << self
|
||||
module Compat
|
||||
def preferred_arch
|
||||
odeprecated "MacOS.preferred_arch", "Hardware::CPU.arch (or ideally let the compiler handle it)"
|
||||
if Hardware::CPU.is_64_bit?
|
||||
Hardware::CPU.arch_64_bit
|
||||
else
|
||||
Hardware::CPU.arch_32_bit
|
||||
end
|
||||
odisabled "MacOS.preferred_arch", "Hardware::CPU.arch (or ideally let the compiler handle it)"
|
||||
end
|
||||
|
||||
def tcc_db
|
||||
odeprecated "MacOS.tcc_db"
|
||||
@tcc_db ||= Pathname.new("/Library/Application Support/com.apple.TCC/TCC.db")
|
||||
odisabled "MacOS.tcc_db"
|
||||
end
|
||||
|
||||
def pre_mavericks_accessibility_dotfile
|
||||
odeprecated "MacOS.pre_mavericks_accessibility_dotfile"
|
||||
@pre_mavericks_accessibility_dotfile ||= Pathname.new("/private/var/db/.AccessibilityAPIEnabled")
|
||||
odisabled "MacOS.pre_mavericks_accessibility_dotfile"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -229,7 +229,7 @@ module Homebrew
|
||||
@problems = []
|
||||
@new_formula_problems = []
|
||||
@text = FormulaText.new(formula.path)
|
||||
@specs = %w[stable devel head].map { |s| formula.send(s) }.compact
|
||||
@specs = %w[stable head].map { |s| formula.send(s) }.compact
|
||||
@spdx_license_data = options[:spdx_license_data]
|
||||
@spdx_exception_data = options[:spdx_exception_data]
|
||||
end
|
||||
@ -718,9 +718,8 @@ module Homebrew
|
||||
|
||||
def audit_specs
|
||||
problem "Head-only (no stable download)" if head_only?(formula)
|
||||
problem "Devel-only (no stable download)" if devel_only?(formula)
|
||||
|
||||
%w[Stable Devel HEAD].each do |name|
|
||||
%w[Stable HEAD].each do |name|
|
||||
spec_name = name.downcase.to_sym
|
||||
next unless spec = formula.send(spec_name)
|
||||
|
||||
@ -745,28 +744,16 @@ module Homebrew
|
||||
)
|
||||
end
|
||||
|
||||
%w[Stable Devel].each do |name|
|
||||
next unless spec = formula.send(name.downcase)
|
||||
|
||||
version = spec.version
|
||||
problem "#{name}: version (#{version}) is set to a string without a digit" if version.to_s !~ /\d/
|
||||
if stable = formula.stable
|
||||
version = stable.version
|
||||
problem "Stable: version (#{version}) is set to a string without a digit" if version.to_s !~ /\d/
|
||||
if version.to_s.start_with?("HEAD")
|
||||
problem "#{name}: non-HEAD version name (#{version}) should not begin with HEAD"
|
||||
end
|
||||
end
|
||||
|
||||
if formula.stable && formula.devel
|
||||
if formula.devel.version < formula.stable.version
|
||||
problem "devel version #{formula.devel.version} is older than stable version #{formula.stable.version}"
|
||||
elsif formula.devel.version == formula.stable.version
|
||||
problem "stable and devel versions are identical"
|
||||
problem "Stable: non-HEAD version name (#{version}) should not begin with HEAD"
|
||||
end
|
||||
end
|
||||
|
||||
return unless @core_tap
|
||||
|
||||
problem "Formulae in homebrew/core should not have a `devel` spec" if formula.devel
|
||||
|
||||
if formula.head && @versioned_formula
|
||||
head_spec_message = "Versioned formulae should not have a `HEAD` spec"
|
||||
problem head_spec_message unless VERSIONED_HEAD_SPEC_ALLOWLIST.include?(formula.name)
|
||||
@ -990,11 +977,7 @@ module Homebrew
|
||||
end
|
||||
|
||||
def head_only?(formula)
|
||||
formula.head && formula.devel.nil? && formula.stable.nil?
|
||||
end
|
||||
|
||||
def devel_only?(formula)
|
||||
formula.devel && formula.stable.nil?
|
||||
formula.head && formula.stable.nil?
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -54,8 +54,8 @@ module Homebrew
|
||||
Formula.installed
|
||||
elsif args.all?
|
||||
Formula
|
||||
elsif args.formulae.present?
|
||||
args.formulae
|
||||
elsif (formulae_args = args.named.to_formulae) && formulae_args.present?
|
||||
formulae_args
|
||||
elsif File.exist?(WATCHLIST_PATH)
|
||||
begin
|
||||
Pathname.new(WATCHLIST_PATH).read.lines.map do |line|
|
||||
|
@ -43,300 +43,6 @@ module Homebrew
|
||||
end
|
||||
|
||||
def pull
|
||||
odeprecated "brew pull", "hub checkout"
|
||||
|
||||
odie "You meant `git pull --rebase`." if ARGV[0] == "--rebase"
|
||||
|
||||
args = pull_args.parse
|
||||
|
||||
# Passthrough Git environment variables for e.g. git am
|
||||
Utils::Git.set_name_email!(author: false, committer: true)
|
||||
|
||||
# Depending on user configuration, git may try to invoke gpg.
|
||||
if Utils.popen_read("git config --get --bool commit.gpgsign").chomp == "true"
|
||||
begin
|
||||
gnupg = Formula["gnupg"]
|
||||
rescue FormulaUnavailableError # rubocop:disable Lint/SuppressedException
|
||||
else
|
||||
if gnupg.any_version_installed?
|
||||
path = PATH.new(ENV.fetch("PATH"))
|
||||
path.prepend(gnupg.any_installed_prefix/"bin")
|
||||
ENV["PATH"] = path
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
do_bump = args.bump? && !args.clean?
|
||||
|
||||
tap = nil
|
||||
|
||||
args.named.each do |arg|
|
||||
arg = "#{CoreTap.instance.default_remote}/pull/#{arg}" if arg.to_i.positive?
|
||||
if (api_match = arg.match HOMEBREW_PULL_API_REGEX)
|
||||
_, user, repo, issue = *api_match
|
||||
url = "https://github.com/#{user}/#{repo}/pull/#{issue}"
|
||||
tap = Tap.fetch(user, repo) if repo.match?(HOMEBREW_OFFICIAL_REPO_PREFIXES_REGEX)
|
||||
elsif (url_match = arg.match HOMEBREW_PULL_OR_COMMIT_URL_REGEX)
|
||||
url, user, repo, issue = *url_match
|
||||
tap = Tap.fetch(user, repo) if repo.match?(HOMEBREW_OFFICIAL_REPO_PREFIXES_REGEX)
|
||||
else
|
||||
odie "Not a GitHub pull request or commit: #{arg}"
|
||||
end
|
||||
|
||||
odie "No pull request detected!" if issue.blank?
|
||||
|
||||
if tap
|
||||
tap.install unless tap.installed?
|
||||
Dir.chdir tap.path
|
||||
else
|
||||
Dir.chdir HOMEBREW_REPOSITORY
|
||||
end
|
||||
|
||||
# The cache directory seems like a good place to put patches.
|
||||
HOMEBREW_CACHE.mkpath
|
||||
|
||||
# Store current revision and branch
|
||||
orig_revision = `git rev-parse --short HEAD`.strip
|
||||
branch = `git symbolic-ref --short HEAD`.strip
|
||||
|
||||
if branch != "master" && !args.clean? && !args.branch_okay?
|
||||
opoo "Current branch is #{branch}: do you need to pull inside master?"
|
||||
end
|
||||
|
||||
patch_puller = PatchPuller.new(url, args)
|
||||
patch_puller.fetch_patch
|
||||
patch_changes = files_changed_in_patch(patch_puller.patchpath, tap)
|
||||
|
||||
is_bumpable = patch_changes[:formulae].length == 1 && patch_changes[:others].empty?
|
||||
check_bumps(patch_changes) if do_bump
|
||||
old_versions = current_versions_from_info_external(patch_changes[:formulae].first) if is_bumpable
|
||||
patch_puller.apply_patch
|
||||
|
||||
end_revision = `git rev-parse --short HEAD`.strip
|
||||
|
||||
changed_formulae_names = []
|
||||
|
||||
if tap
|
||||
Utils.popen_read(
|
||||
"git", "diff-tree", "-r", "--name-only",
|
||||
"--diff-filter=AM", orig_revision, end_revision, "--", tap.formula_dir.to_s
|
||||
).each_line do |line|
|
||||
next unless line.end_with? ".rb\n"
|
||||
|
||||
name = "#{tap.name}/#{File.basename(line.chomp, ".rb")}"
|
||||
changed_formulae_names << name
|
||||
end
|
||||
end
|
||||
|
||||
changed_formulae_names.each do |name|
|
||||
next if Homebrew::EnvConfig.disable_load_formula?
|
||||
|
||||
begin
|
||||
f = Formula[name]
|
||||
rescue Exception # rubocop:disable Lint/RescueException
|
||||
# Make sure we catch syntax errors.
|
||||
next
|
||||
end
|
||||
|
||||
next unless f.stable
|
||||
|
||||
stable_urls = [f.stable.url] + f.stable.mirrors
|
||||
stable_urls.grep(%r{^https://dl.bintray.com/homebrew/mirror/}) do |mirror_url|
|
||||
check_bintray_mirror(f.full_name, mirror_url)
|
||||
end
|
||||
end
|
||||
|
||||
orig_message = message = `git log HEAD^.. --format=%B`
|
||||
if issue && !args.clean?
|
||||
ohai "Patch closes issue ##{issue}"
|
||||
close_message = "Closes ##{issue}."
|
||||
# If this is a pull request, append a close message.
|
||||
message += "\n#{close_message}" unless message.include? close_message
|
||||
end
|
||||
|
||||
if changed_formulae_names.empty?
|
||||
odie "Cannot bump: no changed formulae found after applying patch" if do_bump
|
||||
is_bumpable = false
|
||||
end
|
||||
|
||||
is_bumpable = false if args.clean?
|
||||
is_bumpable = false if Homebrew::EnvConfig.disable_load_formula?
|
||||
|
||||
if is_bumpable
|
||||
formula = Formula[changed_formulae_names.first]
|
||||
new_versions = current_versions_from_info_external(patch_changes[:formulae].first)
|
||||
orig_subject = message.empty? ? "" : message.lines.first.chomp
|
||||
bump_subject = subject_for_bump(formula, old_versions, new_versions)
|
||||
if do_bump
|
||||
odie "No version changes found for #{formula.name}" if bump_subject.nil?
|
||||
unless orig_subject == bump_subject
|
||||
ohai "New bump commit subject: #{bump_subject}"
|
||||
pbcopy bump_subject unless args.no_pbcopy?
|
||||
message = "#{bump_subject}\n\n#{message}"
|
||||
end
|
||||
elsif bump_subject != orig_subject && !bump_subject.nil?
|
||||
opoo "Nonstandard bump subject: #{orig_subject}"
|
||||
opoo "Subject should be: #{bump_subject}"
|
||||
end
|
||||
end
|
||||
|
||||
if message != orig_message && !args.clean?
|
||||
safe_system "git", "commit", "--amend", "--signoff", "--allow-empty", "-q", "-m", message
|
||||
end
|
||||
|
||||
ohai "Patch changed:"
|
||||
safe_system "git", "diff-tree", "-r", "--stat", orig_revision, end_revision
|
||||
end
|
||||
end
|
||||
|
||||
def check_bumps(patch_changes)
|
||||
if patch_changes[:formulae].empty?
|
||||
odie "No changed formulae found to bump"
|
||||
elsif patch_changes[:formulae].length > 1
|
||||
odie "Can only bump one changed formula; bumped #{patch_changes[:formulae]}"
|
||||
elsif !patch_changes[:others].empty?
|
||||
odie "Cannot bump if non-formula files are changed"
|
||||
end
|
||||
end
|
||||
|
||||
class PatchPuller
|
||||
attr_reader :base_url, :patch_url, :patchpath
|
||||
|
||||
def initialize(url, args, description = nil)
|
||||
@base_url = url
|
||||
# GitHub provides commits/pull-requests raw patches using this URL.
|
||||
@patch_url = "#{url}.patch"
|
||||
@patchpath = HOMEBREW_CACHE + File.basename(patch_url)
|
||||
@description = description
|
||||
@args = args
|
||||
end
|
||||
|
||||
def fetch_patch
|
||||
extra_msg = @description ? "(#{@description})" : nil
|
||||
ohai "Fetching patch #{extra_msg}"
|
||||
puts "Patch: #{patch_url}"
|
||||
curl_download patch_url, to: patchpath
|
||||
end
|
||||
|
||||
def apply_patch
|
||||
# Applies a patch previously downloaded with fetch_patch()
|
||||
# Deletes the patch file as a side effect, regardless of success
|
||||
|
||||
ohai "Applying patch"
|
||||
patch_args = []
|
||||
# Normally we don't want whitespace errors, but squashing them can break
|
||||
# patches so an option is provided to skip this step.
|
||||
patch_args << if @args.ignore_whitespace? || @args.clean?
|
||||
"--whitespace=nowarn"
|
||||
else
|
||||
"--whitespace=fix"
|
||||
end
|
||||
|
||||
# Fall back to three-way merge if patch does not apply cleanly
|
||||
patch_args << "-3"
|
||||
patch_args << patchpath
|
||||
|
||||
begin
|
||||
safe_system "git", "am", *patch_args
|
||||
rescue ErrorDuringExecution
|
||||
if @args.resolve?
|
||||
odie "Patch failed to apply: try to resolve it."
|
||||
else
|
||||
system "git", "am", "--abort"
|
||||
odie "Patch failed to apply: aborted."
|
||||
end
|
||||
ensure
|
||||
patchpath.unlink
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# List files changed by a patch, partitioned in to those that are (probably)
|
||||
# formula definitions, and those which aren't. Only applies to patches on
|
||||
# Homebrew core or taps, based simply on relative pathnames of affected files.
|
||||
def files_changed_in_patch(patchfile, tap)
|
||||
files = []
|
||||
formulae = []
|
||||
others = []
|
||||
File.foreach(patchfile) do |line|
|
||||
files << Regexp.last_match(1) if line =~ %r{^\+\+\+ b/(.*)}
|
||||
end
|
||||
files.each do |file|
|
||||
if tap&.formula_file?(file)
|
||||
formula_name = File.basename(file, ".rb")
|
||||
formulae << formula_name unless formulae.include?(formula_name)
|
||||
else
|
||||
others << file
|
||||
end
|
||||
end
|
||||
{ files: files, formulae: formulae, others: others }
|
||||
end
|
||||
|
||||
# Get current formula versions without loading formula definition in this process.
|
||||
# Returns info as a hash (type => version), for pull.rb's internal use.
|
||||
# Uses special key `:nonexistent => true` for nonexistent formulae.
|
||||
def current_versions_from_info_external(formula_name)
|
||||
info = FormulaInfo.lookup(formula_name)
|
||||
versions = {}
|
||||
if info
|
||||
[:stable, :devel, :head].each do |spec_type|
|
||||
versions[spec_type] = info.version(spec_type)
|
||||
end
|
||||
else
|
||||
versions[:nonexistent] = true
|
||||
end
|
||||
versions
|
||||
end
|
||||
|
||||
def subject_for_bump(formula, old, new)
|
||||
if old[:nonexistent]
|
||||
# New formula
|
||||
headline_ver = if new[:stable]
|
||||
new[:stable]
|
||||
elsif new[:devel]
|
||||
new[:devel]
|
||||
else
|
||||
new[:head]
|
||||
end
|
||||
subject = "#{formula.name} #{headline_ver} (new formula)"
|
||||
else
|
||||
# Update to existing formula
|
||||
subject_strs = []
|
||||
formula_name_str = formula.name
|
||||
if old[:stable] != new[:stable]
|
||||
if new[:stable].nil?
|
||||
subject_strs << "remove stable"
|
||||
formula_name_str += ":" # just for cosmetics
|
||||
else
|
||||
subject_strs << new[:stable]
|
||||
end
|
||||
end
|
||||
if old[:devel] != new[:devel]
|
||||
if new[:devel].nil?
|
||||
# Only bother mentioning if there's no accompanying stable change
|
||||
if !new[:stable].nil? && old[:stable] == new[:stable]
|
||||
subject_strs << "remove devel"
|
||||
formula_name_str += ":" # just for cosmetics
|
||||
end
|
||||
else
|
||||
subject_strs << "#{new[:devel]} (devel)"
|
||||
end
|
||||
end
|
||||
subject = subject_strs.empty? ? nil : "#{formula_name_str} #{subject_strs.join(", ")}"
|
||||
end
|
||||
subject
|
||||
end
|
||||
|
||||
def pbcopy(text)
|
||||
Utils.popen_write("pbcopy") { |io| io.write text }
|
||||
end
|
||||
|
||||
def check_bintray_mirror(name, url)
|
||||
headers, = curl_output("--connect-timeout", "15", "--location", "--head", url)
|
||||
status_code = headers.scan(%r{^HTTP/.* (\d+)}).last.first
|
||||
return if status_code.start_with?("2")
|
||||
|
||||
opoo "The Bintray mirror #{url} is not reachable (HTTP status code #{status_code})."
|
||||
opoo "Do you need to upload it with `brew mirror #{name}`?"
|
||||
odisabled "brew pull", "hub checkout"
|
||||
end
|
||||
end
|
||||
|
@ -85,11 +85,7 @@ module Homebrew
|
||||
#{f.path}
|
||||
].concat(args.options_only)
|
||||
|
||||
if f.head?
|
||||
exec_args << "--HEAD"
|
||||
elsif f.devel?
|
||||
exec_args << "--devel"
|
||||
end
|
||||
exec_args << "--HEAD" if f.head?
|
||||
|
||||
Utils.safe_fork do
|
||||
if Sandbox.available?
|
||||
|
@ -113,12 +113,10 @@ class Formula
|
||||
# @private
|
||||
attr_reader :stable
|
||||
|
||||
# The development {SoftwareSpec} for this {Formula}.
|
||||
# Installed when using `brew install --devel`
|
||||
# `nil` if there is no development version.
|
||||
# @see #stable
|
||||
# @private
|
||||
attr_reader :devel
|
||||
def devel
|
||||
odisabled "Formula#devel"
|
||||
end
|
||||
|
||||
# The HEAD {SoftwareSpec} for this {Formula}.
|
||||
# Installed when using `brew install --HEAD`
|
||||
@ -136,7 +134,7 @@ class Formula
|
||||
protected :active_spec
|
||||
|
||||
# A symbol to indicate currently active {SoftwareSpec}.
|
||||
# It's either :stable, :devel or :head
|
||||
# It's either :stable or :head
|
||||
# @see #active_spec
|
||||
# @private
|
||||
attr_reader :active_spec_sym
|
||||
@ -207,14 +205,11 @@ class Formula
|
||||
@full_alias_name = full_name_with_optional_tap(@alias_name)
|
||||
|
||||
spec_eval :stable
|
||||
spec_eval :devel
|
||||
spec_eval :head
|
||||
|
||||
@active_spec = determine_active_spec(spec)
|
||||
@active_spec_sym = if head?
|
||||
:head
|
||||
elsif devel?
|
||||
:devel
|
||||
else
|
||||
:stable
|
||||
end
|
||||
@ -258,7 +253,7 @@ class Formula
|
||||
end
|
||||
|
||||
def determine_active_spec(requested)
|
||||
spec = send(requested) || stable || devel || head
|
||||
spec = send(requested) || stable || head
|
||||
spec || raise(FormulaSpecificationError, "formulae require at least a URL")
|
||||
end
|
||||
|
||||
@ -326,10 +321,9 @@ class Formula
|
||||
active_spec == stable
|
||||
end
|
||||
|
||||
# Is the currently active {SoftwareSpec} a {#devel} build?
|
||||
# @private
|
||||
def devel?
|
||||
active_spec == devel
|
||||
odisabled "Formula#devel?"
|
||||
end
|
||||
|
||||
# Is the currently active {SoftwareSpec} a {#head} build?
|
||||
@ -533,7 +527,6 @@ class Formula
|
||||
|
||||
return true if tab.version_scheme < version_scheme
|
||||
return true if stable && tab.stable_version && tab.stable_version < stable.version
|
||||
return true if devel && tab.devel_version && tab.devel_version < devel.version
|
||||
return false unless fetch_head
|
||||
return false unless head&.downloader.is_a?(VCSDownloadStrategy)
|
||||
|
||||
@ -544,14 +537,11 @@ class Formula
|
||||
end
|
||||
end
|
||||
|
||||
# The latest prefix for this formula. Checks for {#head}, then {#devel}
|
||||
# and then {#stable}'s {#prefix}
|
||||
# The latest prefix for this formula. Checks for {#head} and then {#stable}'s {#prefix}
|
||||
# @private
|
||||
def latest_installed_prefix
|
||||
if head && (head_version = latest_head_version) && !head_version_outdated?(head_version)
|
||||
latest_head_prefix
|
||||
elsif devel && (devel_prefix = prefix(PkgVersion.new(devel.version, revision))).directory?
|
||||
devel_prefix
|
||||
elsif stable && (stable_prefix = prefix(PkgVersion.new(stable.version, revision))).directory?
|
||||
stable_prefix
|
||||
else
|
||||
@ -1713,7 +1703,6 @@ class Formula
|
||||
"homepage" => homepage,
|
||||
"versions" => {
|
||||
"stable" => stable&.version&.to_s,
|
||||
"devel" => devel&.version&.to_s,
|
||||
"head" => head&.version&.to_s,
|
||||
"bottle" => !bottle_specification.checksums.empty?,
|
||||
},
|
||||
@ -1750,18 +1739,15 @@ class Formula
|
||||
"disabled" => disabled?,
|
||||
}
|
||||
|
||||
%w[stable devel].each do |spec_sym|
|
||||
next unless spec = send(spec_sym)
|
||||
|
||||
hsh["urls"][spec_sym] = {
|
||||
"url" => spec.url,
|
||||
"tag" => spec.specs[:tag],
|
||||
"revision" => spec.specs[:revision],
|
||||
if stable
|
||||
hsh["urls"]["stable"] = {
|
||||
"url" => stable.url,
|
||||
"tag" => stable.specs[:tag],
|
||||
"revision" => stable.specs[:revision],
|
||||
}
|
||||
|
||||
next unless spec.bottle_defined?
|
||||
|
||||
bottle_spec = spec.bottle_specification
|
||||
if bottle_defined?
|
||||
bottle_spec = stable.bottle_specification
|
||||
bottle_info = {
|
||||
"rebuild" => bottle_spec.rebuild,
|
||||
"cellar" => (cellar = bottle_spec.cellar).is_a?(Symbol) ? cellar.inspect : cellar,
|
||||
@ -1777,7 +1763,8 @@ class Formula
|
||||
checksum.hash_type.to_s => checksum.hexdigest,
|
||||
}
|
||||
end
|
||||
hsh["bottle"][spec_sym] = bottle_info
|
||||
hsh["bottle"]["stable"] = bottle_info
|
||||
end
|
||||
end
|
||||
|
||||
hsh["options"] = options.map do |opt|
|
||||
@ -2203,18 +2190,9 @@ class Formula
|
||||
when :test
|
||||
define_method(:test_defined?) { true }
|
||||
when :patches
|
||||
odeprecated "a Formula#patches definition", "'patch do' block calls"
|
||||
odisabled "a Formula#patches definition", "'patch do' block calls"
|
||||
when :options
|
||||
odeprecated "a Formula#options definition", "'option do' block calls"
|
||||
instance = allocate
|
||||
|
||||
specs.each do |spec|
|
||||
instance.options.each do |opt, desc|
|
||||
spec.option(opt[/^--(.+)$/, 1], desc)
|
||||
end
|
||||
end
|
||||
|
||||
remove_method(:options)
|
||||
odisabled "a Formula#options definition", "'option do' block calls"
|
||||
end
|
||||
end
|
||||
|
||||
@ -2259,8 +2237,7 @@ class Formula
|
||||
@licenses
|
||||
else
|
||||
if args.is_a? Array
|
||||
# TODO: enable for next major/minor release
|
||||
# odeprecated "`license [...]`", "`license any_of: [...]`"
|
||||
odeprecated "`license [...]`", "`license any_of: [...]`"
|
||||
args = { any_of: args }
|
||||
end
|
||||
@licenses = args
|
||||
@ -2318,10 +2295,10 @@ class Formula
|
||||
# <pre>version_scheme 1</pre>
|
||||
attr_rw :version_scheme
|
||||
|
||||
# A list of the {.stable}, {.devel} and {.head} {SoftwareSpec}s.
|
||||
# A list of the {.stable} and {.head} {SoftwareSpec}s.
|
||||
# @private
|
||||
def specs
|
||||
@specs ||= [stable, devel, head].freeze
|
||||
@specs ||= [stable, head].freeze
|
||||
end
|
||||
|
||||
# @!attribute [w] url
|
||||
@ -2449,25 +2426,9 @@ class Formula
|
||||
@stable.instance_eval(&block)
|
||||
end
|
||||
|
||||
# @!attribute [w] devel
|
||||
# Adds a {.devel} {SoftwareSpec}.
|
||||
# This can be installed by passing the `--devel` option to allow
|
||||
# installing non-stable (e.g. beta) versions of software.
|
||||
#
|
||||
# <pre>devel do
|
||||
# url "https://example.com/archive-2.0-beta.tar.gz"
|
||||
# sha256 "2a2ba417eebaadcb4418ee7b12fe2998f26d6e6f7fda7983412ff66a741ab6f7"
|
||||
#
|
||||
# depends_on "cairo"
|
||||
# depends_on "pixman"
|
||||
# end</pre>
|
||||
# @private
|
||||
def devel(&block)
|
||||
@devel ||= SoftwareSpec.new(flags: build_flags)
|
||||
return @devel unless block_given?
|
||||
|
||||
odeprecated "'devel' blocks in formulae", "'head' blocks or @-versioned formulae"
|
||||
@devel.instance_eval(&block)
|
||||
def devel
|
||||
odisabled "'devel' blocks in formulae", "'head' blocks or @-versioned formulae"
|
||||
end
|
||||
|
||||
# @!attribute [w] head
|
||||
@ -2784,8 +2745,7 @@ class Formula
|
||||
# <pre>deprecate! date: "2020-08-27", because: :unmaintained</pre>
|
||||
# <pre>deprecate! date: "2020-08-27", because: "it has been replaced by"</pre>
|
||||
def deprecate!(date: nil, because: nil)
|
||||
# TODO: enable for next major/minor release
|
||||
# odeprecated "`deprecate!` without a reason", "`deprecate! because: \"reason\"`" if because.blank?
|
||||
odeprecated "`deprecate!` without a reason", "`deprecate! because: \"reason\"`" if because.blank?
|
||||
|
||||
return if date.present? && Date.parse(date) > Date.today
|
||||
|
||||
@ -2811,8 +2771,7 @@ class Formula
|
||||
# <pre>disable! date: "2020-08-27", because: :does_not_build</pre>
|
||||
# <pre>disable! date: "2020-08-27", because: "has been replaced by foo"</pre>
|
||||
def disable!(date: nil, because: nil)
|
||||
# TODO: enable for next major/minor release
|
||||
# odeprecated "`disable!` without a reason", "`disable! because: \"reason\"`" if because.blank?
|
||||
odeprecated "`disable!` without a reason", "`disable! because: \"reason\"`" if because.blank?
|
||||
|
||||
if date.present? && Date.parse(date) > Date.today
|
||||
@deprecation_reason = because if because.present?
|
||||
|
@ -605,8 +605,6 @@ class FormulaInstaller
|
||||
def display_options(formula)
|
||||
options = if formula.head?
|
||||
["--HEAD"]
|
||||
elsif formula.devel?
|
||||
["--devel"]
|
||||
else
|
||||
[]
|
||||
end
|
||||
@ -809,11 +807,7 @@ class FormulaInstaller
|
||||
args << "--env=std"
|
||||
end
|
||||
|
||||
if formula.head?
|
||||
args << "--HEAD"
|
||||
elsif formula.devel?
|
||||
args << "--devel"
|
||||
end
|
||||
args << "--HEAD" if formula.head?
|
||||
|
||||
args
|
||||
end
|
||||
|
@ -220,10 +220,10 @@ module Formulary
|
||||
def load_file(flags:)
|
||||
if url =~ %r{githubusercontent.com/[\w-]+/[\w-]+/[a-f0-9]{40}(/Formula)?/([\w+-.@]+).rb}
|
||||
formula_name = Regexp.last_match(2)
|
||||
odeprecated "Installation of #{formula_name} from a GitHub commit URL",
|
||||
odisabled "Installation of #{formula_name} from a GitHub commit URL",
|
||||
"'brew extract #{formula_name}' to stable tap on GitHub"
|
||||
elsif url.match?(%r{^(https?|ftp)://})
|
||||
odeprecated "Non-checksummed download of #{name} formula file from an arbitrary URL",
|
||||
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"
|
||||
end
|
||||
|
@ -84,7 +84,7 @@ class Livecheck
|
||||
@url = case val
|
||||
when nil
|
||||
return @url
|
||||
when :head, :stable, :devel
|
||||
when :head, :stable
|
||||
@formula.send(val).url
|
||||
when :homepage
|
||||
@formula.homepage
|
||||
|
@ -126,7 +126,6 @@ class Options
|
||||
f.options.sort_by(&:flag).each do |opt|
|
||||
puts "#{opt.flag}\n\t#{opt.description}"
|
||||
end
|
||||
puts "--devel\n\tInstall development version #{f.devel.version}" if f.devel
|
||||
puts "--HEAD\n\tInstall HEAD version" if f.head
|
||||
end
|
||||
end
|
||||
|
@ -191,25 +191,8 @@ end
|
||||
#
|
||||
# @api private
|
||||
class LegacyPatch < ExternalPatch
|
||||
def initialize(strip, url)
|
||||
odeprecated "legacy patches", "'patch do' blocks"
|
||||
def initialize(strip, _url)
|
||||
odisabled "legacy patches", "'patch do' blocks"
|
||||
super(strip)
|
||||
resource.url(url)
|
||||
resource.download_strategy = CurlDownloadStrategy
|
||||
end
|
||||
|
||||
def fetch
|
||||
clear_cache
|
||||
super
|
||||
end
|
||||
|
||||
def verify_download_integrity(_fn)
|
||||
# no-op
|
||||
end
|
||||
|
||||
def apply
|
||||
super
|
||||
ensure
|
||||
clear_cache
|
||||
end
|
||||
end
|
||||
|
@ -20,7 +20,7 @@ class MacOSRequirement < Requirement
|
||||
rescue MacOSVersionError => e
|
||||
raise if e.version != :mavericks
|
||||
|
||||
odeprecated "depends_on :macos => :mavericks"
|
||||
odisabled "depends_on :macos => :mavericks"
|
||||
end
|
||||
|
||||
@comparator = comparator
|
||||
|
@ -32,7 +32,6 @@ module RuboCop
|
||||
[{ name: :livecheck, type: :block_call }],
|
||||
[{ name: :bottle, type: :block_call }],
|
||||
[{ name: :pour_bottle?, type: :block_call }],
|
||||
[{ name: :devel, type: :block_call }],
|
||||
[{ name: :head, type: :block_call }],
|
||||
[{ name: :bottle, type: :method_call }],
|
||||
[{ name: :keg_only, type: :method_call }],
|
||||
|
@ -10,13 +10,13 @@ module RuboCop
|
||||
# - `url|checksum|mirror` should be inside `stable` block
|
||||
# - `head` and `head do` should not be simultaneously present
|
||||
# - `bottle :unneeded`/`:disable` and `bottle do` should not be simultaneously present
|
||||
# - `stable do` should not be present without a `head` or `devel` spec
|
||||
# - `stable do` should not be present without a `head` spec
|
||||
#
|
||||
# @api private
|
||||
class ComponentsRedundancy < FormulaCop
|
||||
HEAD_MSG = "`head` and `head do` should not be simultaneously present"
|
||||
BOTTLE_MSG = "`bottle :modifier` and `bottle do` should not be simultaneously present"
|
||||
STABLE_MSG = "`stable do` should not be present without a `head` or `devel` spec"
|
||||
STABLE_MSG = "`stable do` should not be present without a `head` spec"
|
||||
|
||||
def audit_formula(_node, _class_node, _parent_class_node, body_node)
|
||||
urls = find_method_calls_by_name(body_node, :url)
|
||||
@ -46,8 +46,7 @@ module RuboCop
|
||||
find_block(body_node, :bottle)
|
||||
|
||||
return if method_called?(body_node, :head) ||
|
||||
find_block(body_node, :head) ||
|
||||
find_block(body_node, :devel)
|
||||
find_block(body_node, :head)
|
||||
|
||||
problem STABLE_MSG if stable_block
|
||||
end
|
||||
|
@ -13,7 +13,7 @@ module RuboCop
|
||||
def audit_formula(_node, _class_node, _parent_class_node, body_node)
|
||||
check_dependency_nodes_order(body_node)
|
||||
check_uses_from_macos_nodes_order(body_node)
|
||||
[:devel, :head, :stable].each do |block_name|
|
||||
[:head, :stable].each do |block_name|
|
||||
block = find_block(body_node, block_name)
|
||||
next unless block
|
||||
|
||||
|
@ -43,7 +43,6 @@ class Tab < OpenStruct
|
||||
"spec" => formula.active_spec_sym.to_s,
|
||||
"versions" => {
|
||||
"stable" => formula.stable&.version.to_s,
|
||||
"devel" => formula.devel&.version.to_s,
|
||||
"head" => formula.head&.version.to_s,
|
||||
"version_scheme" => formula.version_scheme,
|
||||
},
|
||||
@ -93,7 +92,6 @@ class Tab < OpenStruct
|
||||
if attributes["source"]["versions"].nil?
|
||||
attributes["source"]["versions"] = {
|
||||
"stable" => nil,
|
||||
"devel" => nil,
|
||||
"head" => nil,
|
||||
"version_scheme" => 0,
|
||||
}
|
||||
@ -163,7 +161,6 @@ class Tab < OpenStruct
|
||||
"spec" => f.active_spec_sym.to_s,
|
||||
"versions" => {
|
||||
"stable" => f.stable&.version.to_s,
|
||||
"devel" => f.devel&.version.to_s,
|
||||
"head" => f.head&.version.to_s,
|
||||
"version_scheme" => f.version_scheme,
|
||||
},
|
||||
@ -195,7 +192,6 @@ class Tab < OpenStruct
|
||||
"spec" => "stable",
|
||||
"versions" => {
|
||||
"stable" => nil,
|
||||
"devel" => nil,
|
||||
"head" => nil,
|
||||
"version_scheme" => 0,
|
||||
},
|
||||
@ -234,10 +230,12 @@ class Tab < OpenStruct
|
||||
end
|
||||
|
||||
def universal?
|
||||
odeprecated "Tab#universal?"
|
||||
include?("universal")
|
||||
end
|
||||
|
||||
def cxx11?
|
||||
odeprecated "Tab#cxx11?"
|
||||
include?("c++11")
|
||||
end
|
||||
|
||||
@ -246,7 +244,7 @@ class Tab < OpenStruct
|
||||
end
|
||||
|
||||
def devel?
|
||||
spec == :devel
|
||||
odisabled "Tab#devel?"
|
||||
end
|
||||
|
||||
def stable?
|
||||
@ -314,7 +312,7 @@ class Tab < OpenStruct
|
||||
end
|
||||
|
||||
def devel_version
|
||||
Version.create(versions["devel"]) if versions["devel"]
|
||||
odisabled "Tab#devel_version"
|
||||
end
|
||||
|
||||
def head_version
|
||||
|
@ -14,12 +14,6 @@ describe BuildOptions do
|
||||
let(:opts) { Options.create(%w[--with-foo --with-bar --without-baz --without-qux]) }
|
||||
let(:bad_args) { Options.create(%w[--with-foo --with-bar --without-bas --without-qux --without-abc]) }
|
||||
|
||||
specify "#include?" do
|
||||
expect(subject).to include("with-foo")
|
||||
expect(subject).not_to include("with-qux")
|
||||
expect(subject).not_to include("--with-foo")
|
||||
end
|
||||
|
||||
specify "#with?" do
|
||||
expect(subject).to be_built_with("foo")
|
||||
expect(subject).to be_built_with("bar")
|
||||
|
@ -11,17 +11,18 @@ describe "brew outdated", :integration_test do
|
||||
setup_test_formula "testball"
|
||||
(HOMEBREW_CELLAR/"testball/0.0.1/foo").mkpath
|
||||
|
||||
expected_json = [
|
||||
{
|
||||
expected_json = {
|
||||
formulae: [{
|
||||
name: "testball",
|
||||
installed_versions: ["0.0.1"],
|
||||
current_version: "0.1",
|
||||
pinned: false,
|
||||
pinned_version: nil,
|
||||
},
|
||||
].to_json
|
||||
}],
|
||||
casks: [],
|
||||
}.to_json
|
||||
|
||||
expect { brew "outdated", "--json=v1" }
|
||||
expect { brew "outdated", "--json=v2" }
|
||||
.to output("#{expected_json}\n").to_stdout
|
||||
.and be_a_success
|
||||
end
|
||||
|
@ -1,20 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "cmd/shared_examples/args_parse"
|
||||
|
||||
describe "Homebrew.pull_args" do
|
||||
it_behaves_like "parseable arguments"
|
||||
end
|
||||
|
||||
describe "brew pull", :integration_test do
|
||||
it "fetches a patch from a GitHub commit or pull request and applies it", :needs_network do
|
||||
HOMEBREW_REPOSITORY.cd do
|
||||
system "git", "init"
|
||||
system "git", "remote", "add", "origin", "https://github.com/Homebrew/brew"
|
||||
end
|
||||
|
||||
expect { brew "pull", "https://github.com/Homebrew/brew/pull/1249" }
|
||||
.to output(/Fetching patch/).to_stdout
|
||||
.and be_a_failure
|
||||
end
|
||||
end
|
@ -24,7 +24,7 @@ describe Homebrew::Livecheck do
|
||||
desc "Deprecated test formula"
|
||||
homepage "https://brew.sh"
|
||||
url "https://brew.sh/test-0.0.1.tgz"
|
||||
deprecate!
|
||||
deprecate! because: :unmaintained
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -17,7 +17,6 @@ describe Formula do
|
||||
end
|
||||
|
||||
expect(f.class.stable.deps.first.name).to eq("foo")
|
||||
expect(f.class.devel.deps.first.name).to eq("foo")
|
||||
expect(f.class.head.deps.first.name).to eq("foo")
|
||||
end
|
||||
|
||||
@ -29,7 +28,6 @@ describe Formula do
|
||||
end
|
||||
|
||||
expect(f.class.stable.deps.first.name).to eq("foo")
|
||||
expect(f.class.devel.deps.first.name).to eq("foo")
|
||||
expect(f.class.head.deps.first.name).to eq("foo")
|
||||
end
|
||||
end
|
||||
|
@ -18,10 +18,8 @@ describe Formula do
|
||||
end
|
||||
|
||||
expect(f.class.stable.deps).to be_empty
|
||||
expect(f.class.devel.deps).to be_empty
|
||||
expect(f.class.head.deps).to be_empty
|
||||
expect(f.class.stable.uses_from_macos_elements.first).to eq("foo")
|
||||
expect(f.class.devel.uses_from_macos_elements.first).to eq("foo")
|
||||
expect(f.class.head.uses_from_macos_elements.first).to eq("foo")
|
||||
end
|
||||
|
||||
@ -33,10 +31,8 @@ describe Formula do
|
||||
end
|
||||
|
||||
expect(f.class.stable.deps.first.name).to eq("foo")
|
||||
expect(f.class.devel.deps.first.name).to eq("foo")
|
||||
expect(f.class.head.deps.first.name).to eq("foo")
|
||||
expect(f.class.stable.uses_from_macos_elements).to be_empty
|
||||
expect(f.class.devel.uses_from_macos_elements).to be_empty
|
||||
expect(f.class.head.uses_from_macos_elements).to be_empty
|
||||
end
|
||||
end
|
||||
|
@ -15,7 +15,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsRedundancy do
|
||||
# stuff
|
||||
end
|
||||
|
||||
devel do
|
||||
head do
|
||||
# stuff
|
||||
end
|
||||
end
|
||||
@ -72,19 +72,5 @@ describe RuboCop::Cop::FormulaAudit::ComponentsRedundancy do
|
||||
end
|
||||
RUBY
|
||||
end
|
||||
|
||||
it "When `stable do` is present with a `devel` block" do
|
||||
expect_no_offenses(<<~RUBY)
|
||||
class Foo < Formula
|
||||
stable do
|
||||
# stuff
|
||||
end
|
||||
|
||||
devel do
|
||||
# stuff
|
||||
end
|
||||
end
|
||||
RUBY
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -38,7 +38,6 @@ describe Tab do
|
||||
"spec" => "stable",
|
||||
"versions" => {
|
||||
"stable" => "0.10",
|
||||
"devel" => "0.14",
|
||||
"head" => "HEAD-1111111",
|
||||
},
|
||||
},
|
||||
@ -66,14 +65,12 @@ describe Tab do
|
||||
expect(tab).not_to be_built_as_bottle
|
||||
expect(tab).not_to be_poured_from_bottle
|
||||
expect(tab).to be_stable
|
||||
expect(tab).not_to be_devel
|
||||
expect(tab).not_to be_head
|
||||
expect(tab.tap).to be nil
|
||||
expect(tab.time).to be nil
|
||||
expect(tab.HEAD).to be nil
|
||||
expect(tab.runtime_dependencies).to be nil
|
||||
expect(tab.stable_version).to be nil
|
||||
expect(tab.devel_version).to be nil
|
||||
expect(tab.head_version).to be nil
|
||||
expect(tab.cxxstdlib.compiler).to eq(DevelopmentTools.default_compiler)
|
||||
expect(tab.cxxstdlib.type).to be nil
|
||||
@ -92,11 +89,6 @@ describe Tab do
|
||||
expect(subject).not_to be_built_with("baz")
|
||||
end
|
||||
|
||||
specify "#universal?" do
|
||||
tab = described_class.new(used_options: %w[--universal])
|
||||
expect(tab).to be_universal
|
||||
end
|
||||
|
||||
specify "#parsed_homebrew_version" do
|
||||
tab = described_class.new
|
||||
expect(tab.parsed_homebrew_version).to be Version::NULL
|
||||
@ -179,7 +171,6 @@ describe Tab do
|
||||
expect(tab).not_to be_built_as_bottle
|
||||
expect(tab).to be_poured_from_bottle
|
||||
expect(tab).to be_stable
|
||||
expect(tab).not_to be_devel
|
||||
expect(tab).not_to be_head
|
||||
expect(tab.tap.name).to eq("homebrew/core")
|
||||
expect(tab.spec).to eq(:stable)
|
||||
@ -189,7 +180,6 @@ describe Tab do
|
||||
expect(tab.cxxstdlib.type).to eq(:libcxx)
|
||||
expect(tab.runtime_dependencies).to eq(runtime_dependencies)
|
||||
expect(tab.stable_version.to_s).to eq("2.14")
|
||||
expect(tab.devel_version.to_s).to eq("2.15")
|
||||
expect(tab.head_version.to_s).to eq("HEAD-0000000")
|
||||
expect(tab.source["path"]).to eq(source_path)
|
||||
end
|
||||
@ -209,7 +199,6 @@ describe Tab do
|
||||
expect(tab).not_to be_built_as_bottle
|
||||
expect(tab).to be_poured_from_bottle
|
||||
expect(tab).to be_stable
|
||||
expect(tab).not_to be_devel
|
||||
expect(tab).not_to be_head
|
||||
expect(tab.tap.name).to eq("homebrew/core")
|
||||
expect(tab.spec).to eq(:stable)
|
||||
@ -219,7 +208,6 @@ describe Tab do
|
||||
expect(tab.cxxstdlib.type).to eq(:libcxx)
|
||||
expect(tab.runtime_dependencies).to eq(runtime_dependencies)
|
||||
expect(tab.stable_version.to_s).to eq("2.14")
|
||||
expect(tab.devel_version.to_s).to eq("2.15")
|
||||
expect(tab.head_version.to_s).to eq("HEAD-0000000")
|
||||
expect(tab.source["path"]).to eq(source_path)
|
||||
end
|
||||
@ -233,7 +221,6 @@ describe Tab do
|
||||
expect(tab).not_to be_built_as_bottle
|
||||
expect(tab).to be_poured_from_bottle
|
||||
expect(tab).to be_stable
|
||||
expect(tab).not_to be_devel
|
||||
expect(tab).not_to be_head
|
||||
expect(tab.tap.name).to eq("homebrew/core")
|
||||
expect(tab.spec).to eq(:stable)
|
||||
@ -385,7 +372,6 @@ describe Tab do
|
||||
expect(tab.stdlib).to eq(subject.stdlib)
|
||||
expect(tab.runtime_dependencies).to eq(subject.runtime_dependencies)
|
||||
expect(tab.stable_version).to eq(subject.stable_version)
|
||||
expect(tab.devel_version).to eq(subject.devel_version)
|
||||
expect(tab.head_version).to eq(subject.head_version)
|
||||
expect(tab.source["path"]).to eq(subject.source["path"])
|
||||
end
|
||||
|
@ -327,8 +327,6 @@ installed formulae or, every 30 days, for all formulae.
|
||||
Install from a bottle if it exists for the current or newest version of macOS, even if it would not normally be used for installation.
|
||||
* `--include-test`:
|
||||
Install testing dependencies required to run `brew test` *`formula`*.
|
||||
* `--devel`:
|
||||
If *`formula`* defines it, install the development version.
|
||||
* `--HEAD`:
|
||||
If *`formula`* defines it, install the HEAD version, aka. master, trunk, unstable.
|
||||
* `--fetch-HEAD`:
|
||||
@ -686,10 +684,6 @@ specify *`formula`* as a required or recommended dependency for their stable bui
|
||||
Include all formulae that specify *`formula`* as `:optional` type dependency.
|
||||
* `--skip-recommended`:
|
||||
Skip all formulae that specify *`formula`* as `:recommended` type dependency.
|
||||
* `--devel`:
|
||||
Show usage of *`formula`* by development builds.
|
||||
* `--HEAD`:
|
||||
Show usage of *`formula`* by HEAD builds.
|
||||
|
||||
### `--cache` [*`options`*] [*`formula|cask`*]
|
||||
|
||||
|
@ -67,7 +67,7 @@ brew install --only-dependencies <formula>
|
||||
```sh
|
||||
$ brew irb
|
||||
1.8.7 :001 > Formula.factory("ace").methods - Object.methods
|
||||
=> [:install, :path, :homepage, :downloader, :stable, :bottle, :devel, :head, :active_spec, :buildpath, :ensure_specs_set, :url, :version, :specs, :mirrors, :installed?, :explicitly_requested?, :linked_keg, :installed_prefix, :prefix, :rack, :bin, :doc, :include, :info, :lib, :libexec, :man, :man1, :man2, :man3, :man4, :man5, :man6, :man7, :man8, :sbin, :share, :etc, :var, :plist_name, :plist_path, :download_strategy, :cached_download, :caveats, :options, :patches, :keg_only?, :fails_with?, :skip_clean?, :brew, :std_cmake_args, :deps, :external_deps, :recursive_deps, :system, :fetch, :verify_download_integrity, :fails_with_llvm, :fails_with_llvm?, :std_cmake_parameters, :mkdir, :mktemp]
|
||||
=> [:install, :path, :homepage, :downloader, :stable, :bottle, :head, :active_spec, :buildpath, :ensure_specs_set, :url, :version, :specs, :mirrors, :installed?, :explicitly_requested?, :linked_keg, :installed_prefix, :prefix, :rack, :bin, :doc, :include, :info, :lib, :libexec, :man, :man1, :man2, :man3, :man4, :man5, :man6, :man7, :man8, :sbin, :share, :etc, :var, :plist_name, :plist_path, :download_strategy, :cached_download, :caveats, :options, :patches, :keg_only?, :fails_with?, :skip_clean?, :brew, :std_cmake_args, :deps, :external_deps, :recursive_deps, :system, :fetch, :verify_download_integrity, :fails_with_llvm, :fails_with_llvm?, :std_cmake_parameters, :mkdir, :mktemp]
|
||||
1.8.7 :002 >
|
||||
```
|
||||
|
||||
|
@ -484,10 +484,6 @@ Install from a bottle if it exists for the current or newest version of macOS, e
|
||||
Install testing dependencies required to run \fBbrew test\fR \fIformula\fR\.
|
||||
.
|
||||
.TP
|
||||
\fB\-\-devel\fR
|
||||
If \fIformula\fR defines it, install the development version\.
|
||||
.
|
||||
.TP
|
||||
\fB\-\-HEAD\fR
|
||||
If \fIformula\fR defines it, install the HEAD version, aka\. master, trunk, unstable\.
|
||||
.
|
||||
@ -968,14 +964,6 @@ Include all formulae that specify \fIformula\fR as \fB:optional\fR type dependen
|
||||
\fB\-\-skip\-recommended\fR
|
||||
Skip all formulae that specify \fIformula\fR as \fB:recommended\fR type dependency\.
|
||||
.
|
||||
.TP
|
||||
\fB\-\-devel\fR
|
||||
Show usage of \fIformula\fR by development builds\.
|
||||
.
|
||||
.TP
|
||||
\fB\-\-HEAD\fR
|
||||
Show usage of \fIformula\fR by HEAD builds\.
|
||||
.
|
||||
.SS "\fB\-\-cache\fR [\fIoptions\fR] [\fIformula|cask\fR]"
|
||||
Display Homebrew\'s download cache\. See also \fBHOMEBREW_CACHE\fR\.
|
||||
.
|
||||
|
Loading…
x
Reference in New Issue
Block a user