Remove unnecessary code
This commit is contained in:
parent
827acd3dc6
commit
e53ccbc3cd
@ -45,8 +45,8 @@ class CaskDependent
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def recursive_dependencies(ignore_missing: false, &block)
|
def recursive_dependencies(&block)
|
||||||
Dependency.expand(self, ignore_missing: ignore_missing, &block)
|
Dependency.expand(self, &block)
|
||||||
end
|
end
|
||||||
|
|
||||||
def recursive_requirements(&block)
|
def recursive_requirements(&block)
|
||||||
|
@ -88,22 +88,6 @@ module Homebrew
|
|||||||
def reinstall
|
def reinstall
|
||||||
args = reinstall_args.parse
|
args = reinstall_args.parse
|
||||||
|
|
||||||
# We need to use the bottle API instead of just using the formula file
|
|
||||||
# from an installed keg because it will not contain bottle information.
|
|
||||||
# As a consequence, `brew reinstall` will also upgrade outdated formulae
|
|
||||||
if Homebrew::EnvConfig.install_from_api?
|
|
||||||
args.named.each do |name|
|
|
||||||
formula = Formulary.factory(name)
|
|
||||||
next unless formula.any_version_installed?
|
|
||||||
next if formula.tap.present? && !formula.core_formula?
|
|
||||||
next unless Homebrew::API::Bottle.available?(name)
|
|
||||||
|
|
||||||
Homebrew::API::Bottle.fetch_bottles(name)
|
|
||||||
rescue FormulaUnavailableError
|
|
||||||
next
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
formulae, casks = args.named.to_formulae_and_casks(method: :resolve)
|
formulae, casks = args.named.to_formulae_and_casks(method: :resolve)
|
||||||
.partition { |o| o.is_a?(Formula) }
|
.partition { |o| o.is_a?(Formula) }
|
||||||
|
|
||||||
|
@ -46,15 +46,6 @@ class Dependency
|
|||||||
formula
|
formula
|
||||||
end
|
end
|
||||||
|
|
||||||
def unavailable_core_formula?
|
|
||||||
to_formula
|
|
||||||
false
|
|
||||||
rescue CoreTapFormulaUnavailableError
|
|
||||||
true
|
|
||||||
rescue
|
|
||||||
false
|
|
||||||
end
|
|
||||||
|
|
||||||
def installed?
|
def installed?
|
||||||
to_formula.latest_version_installed?
|
to_formula.latest_version_installed?
|
||||||
end
|
end
|
||||||
@ -98,7 +89,7 @@ class Dependency
|
|||||||
# the list.
|
# the list.
|
||||||
# The default filter, which is applied when a block is not given, omits
|
# The default filter, which is applied when a block is not given, omits
|
||||||
# optionals and recommendeds based on what the dependent has asked for
|
# optionals and recommendeds based on what the dependent has asked for
|
||||||
def expand(dependent, deps = dependent.deps, cache_key: nil, ignore_missing: false, &block)
|
def expand(dependent, deps = dependent.deps, cache_key: nil, &block)
|
||||||
# Keep track dependencies to avoid infinite cyclic dependency recursion.
|
# Keep track dependencies to avoid infinite cyclic dependency recursion.
|
||||||
@expand_stack ||= []
|
@expand_stack ||= []
|
||||||
@expand_stack.push dependent.name
|
@expand_stack.push dependent.name
|
||||||
@ -115,19 +106,19 @@ class Dependency
|
|||||||
# avoid downloading build dependency bottles
|
# avoid downloading build dependency bottles
|
||||||
next if dep.build? && dependent.pour_bottle? && Homebrew::EnvConfig.install_from_api?
|
next if dep.build? && dependent.pour_bottle? && Homebrew::EnvConfig.install_from_api?
|
||||||
|
|
||||||
case action(dependent, dep, ignore_missing: ignore_missing, &block)
|
case action(dependent, dep, &block)
|
||||||
when :prune
|
when :prune
|
||||||
next
|
next
|
||||||
when :skip
|
when :skip
|
||||||
next if @expand_stack.include? dep.name
|
next if @expand_stack.include? dep.name
|
||||||
|
|
||||||
expanded_deps.concat(expand(dep.to_formula, cache_key: cache_key, ignore_missing: ignore_missing, &block))
|
expanded_deps.concat(expand(dep.to_formula, cache_key: cache_key, &block))
|
||||||
when :keep_but_prune_recursive_deps
|
when :keep_but_prune_recursive_deps
|
||||||
expanded_deps << dep
|
expanded_deps << dep
|
||||||
else
|
else
|
||||||
next if @expand_stack.include? dep.name
|
next if @expand_stack.include? dep.name
|
||||||
|
|
||||||
expanded_deps.concat(expand(dep.to_formula, cache_key: cache_key, ignore_missing: ignore_missing, &block))
|
expanded_deps.concat(expand(dep.to_formula, cache_key: cache_key, &block))
|
||||||
expanded_deps << dep
|
expanded_deps << dep
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -139,10 +130,8 @@ class Dependency
|
|||||||
@expand_stack.pop
|
@expand_stack.pop
|
||||||
end
|
end
|
||||||
|
|
||||||
def action(dependent, dep, ignore_missing: false, &block)
|
def action(dependent, dep, &block)
|
||||||
catch(:action) do
|
catch(:action) do
|
||||||
prune if ignore_missing && dep.unavailable_core_formula?
|
|
||||||
|
|
||||||
if block
|
if block
|
||||||
yield dependent, dep
|
yield dependent, dep
|
||||||
elsif dep.optional? || dep.recommended?
|
elsif dep.optional? || dep.recommended?
|
||||||
|
@ -234,13 +234,6 @@ class TapFormulaUnavailableError < FormulaUnavailableError
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Raised when a formula in a the core tap is unavailable.
|
|
||||||
class CoreTapFormulaUnavailableError < TapFormulaUnavailableError
|
|
||||||
def initialize(name)
|
|
||||||
super CoreTap.instance, name
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Raised when a formula in a specific tap does not contain a formula class.
|
# Raised when a formula in a specific tap does not contain a formula class.
|
||||||
class TapFormulaClassUnavailableError < TapFormulaUnavailableError
|
class TapFormulaClassUnavailableError < TapFormulaUnavailableError
|
||||||
include FormulaClassUnavailableErrorModule
|
include FormulaClassUnavailableErrorModule
|
||||||
|
@ -218,11 +218,6 @@ class FormulaInstaller
|
|||||||
def verify_deps_exist
|
def verify_deps_exist
|
||||||
begin
|
begin
|
||||||
compute_dependencies
|
compute_dependencies
|
||||||
rescue CoreTapFormulaUnavailableError => e
|
|
||||||
raise unless Homebrew::API::Bottle.available? e.name
|
|
||||||
|
|
||||||
Homebrew::API::Bottle.fetch_bottles(e.name)
|
|
||||||
retry
|
|
||||||
rescue TapFormulaUnavailableError => e
|
rescue TapFormulaUnavailableError => e
|
||||||
raise if e.tap.installed?
|
raise if e.tap.installed?
|
||||||
|
|
||||||
|
@ -447,10 +447,6 @@ module Formulary
|
|||||||
rescue FormulaClassUnavailableError => e
|
rescue FormulaClassUnavailableError => e
|
||||||
raise TapFormulaClassUnavailableError.new(tap, name, e.path, e.class_name, e.class_list), "", e.backtrace
|
raise TapFormulaClassUnavailableError.new(tap, name, e.path, e.class_name, e.class_list), "", e.backtrace
|
||||||
rescue FormulaUnavailableError => e
|
rescue FormulaUnavailableError => e
|
||||||
if tap.core_tap? && Homebrew::EnvConfig.install_from_api?
|
|
||||||
raise CoreTapFormulaUnavailableError.new(name), "", e.backtrace
|
|
||||||
end
|
|
||||||
|
|
||||||
raise TapFormulaUnavailableError.new(tap, name), "", e.backtrace
|
raise TapFormulaUnavailableError.new(tap, name), "", e.backtrace
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -469,10 +465,6 @@ module Formulary
|
|||||||
end
|
end
|
||||||
|
|
||||||
def get_formula(*)
|
def get_formula(*)
|
||||||
if !CoreTap.instance.installed? && Homebrew::EnvConfig.install_from_api?
|
|
||||||
raise CoreTapFormulaUnavailableError, name
|
|
||||||
end
|
|
||||||
|
|
||||||
raise FormulaUnavailableError, name
|
raise FormulaUnavailableError, name
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user