Remove unnecessary code
This commit is contained in:
parent
827acd3dc6
commit
e53ccbc3cd
@ -45,8 +45,8 @@ class CaskDependent
|
||||
end
|
||||
end
|
||||
|
||||
def recursive_dependencies(ignore_missing: false, &block)
|
||||
Dependency.expand(self, ignore_missing: ignore_missing, &block)
|
||||
def recursive_dependencies(&block)
|
||||
Dependency.expand(self, &block)
|
||||
end
|
||||
|
||||
def recursive_requirements(&block)
|
||||
|
@ -88,22 +88,6 @@ module Homebrew
|
||||
def reinstall
|
||||
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)
|
||||
.partition { |o| o.is_a?(Formula) }
|
||||
|
||||
|
@ -46,15 +46,6 @@ class Dependency
|
||||
formula
|
||||
end
|
||||
|
||||
def unavailable_core_formula?
|
||||
to_formula
|
||||
false
|
||||
rescue CoreTapFormulaUnavailableError
|
||||
true
|
||||
rescue
|
||||
false
|
||||
end
|
||||
|
||||
def installed?
|
||||
to_formula.latest_version_installed?
|
||||
end
|
||||
@ -98,7 +89,7 @@ class Dependency
|
||||
# the list.
|
||||
# The default filter, which is applied when a block is not given, omits
|
||||
# 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.
|
||||
@expand_stack ||= []
|
||||
@expand_stack.push dependent.name
|
||||
@ -115,19 +106,19 @@ class Dependency
|
||||
# avoid downloading build dependency bottles
|
||||
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
|
||||
next
|
||||
when :skip
|
||||
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
|
||||
expanded_deps << dep
|
||||
else
|
||||
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
|
||||
end
|
||||
end
|
||||
@ -139,10 +130,8 @@ class Dependency
|
||||
@expand_stack.pop
|
||||
end
|
||||
|
||||
def action(dependent, dep, ignore_missing: false, &block)
|
||||
def action(dependent, dep, &block)
|
||||
catch(:action) do
|
||||
prune if ignore_missing && dep.unavailable_core_formula?
|
||||
|
||||
if block
|
||||
yield dependent, dep
|
||||
elsif dep.optional? || dep.recommended?
|
||||
|
@ -234,13 +234,6 @@ class TapFormulaUnavailableError < FormulaUnavailableError
|
||||
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.
|
||||
class TapFormulaClassUnavailableError < TapFormulaUnavailableError
|
||||
include FormulaClassUnavailableErrorModule
|
||||
|
@ -218,11 +218,6 @@ class FormulaInstaller
|
||||
def verify_deps_exist
|
||||
begin
|
||||
compute_dependencies
|
||||
rescue CoreTapFormulaUnavailableError => e
|
||||
raise unless Homebrew::API::Bottle.available? e.name
|
||||
|
||||
Homebrew::API::Bottle.fetch_bottles(e.name)
|
||||
retry
|
||||
rescue TapFormulaUnavailableError => e
|
||||
raise if e.tap.installed?
|
||||
|
||||
|
@ -447,10 +447,6 @@ module Formulary
|
||||
rescue FormulaClassUnavailableError => e
|
||||
raise TapFormulaClassUnavailableError.new(tap, name, e.path, e.class_name, e.class_list), "", e.backtrace
|
||||
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
|
||||
end
|
||||
|
||||
@ -469,10 +465,6 @@ module Formulary
|
||||
end
|
||||
|
||||
def get_formula(*)
|
||||
if !CoreTap.instance.installed? && Homebrew::EnvConfig.install_from_api?
|
||||
raise CoreTapFormulaUnavailableError, name
|
||||
end
|
||||
|
||||
raise FormulaUnavailableError, name
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user