uses: properly handle recursive deps exceptions
Fixes #1776. If any known formula had a dependency on an untapped tap, Formula#recursive_dependencies would throw an exception, which would be caught by the outer exception handler, causing the rest of the dependencies for that formula to be skipped and incomplete output to be generated. To fix this, I added a check to avoid analysing the dependencies of formulae from uninstalled taps. Additionally, I removed the aforementioned outer exception handler added in 5fdb89aed90f03413cdb21af430411c4a722876e, because the only other place that should be capable of throwing such an exception is the statement that was surrounded by another wider exception handler in Homebrew/legacy-homebrew#40682.
This commit is contained in:
parent
4c061fc183
commit
536b6e2396
@ -47,7 +47,6 @@ module Homebrew
|
||||
|
||||
uses = formulae.select do |f|
|
||||
used_formulae.all? do |ff|
|
||||
begin
|
||||
if recursive
|
||||
deps = f.recursive_dependencies do |dependent, dep|
|
||||
if dep.recommended?
|
||||
@ -57,6 +56,12 @@ module Homebrew
|
||||
elsif dep.build?
|
||||
Dependency.prune unless includes.include?("build?")
|
||||
end
|
||||
|
||||
# If a tap isn't installed, we can't find the dependencies of one
|
||||
# its formulae, and an exception will be thrown if we try.
|
||||
if dep.is_a?(TapDependency) && !dep.tap.installed?
|
||||
Dependency.keep_but_prune_recursive_deps
|
||||
end
|
||||
end
|
||||
reqs = f.recursive_requirements do |dependent, req|
|
||||
if req.recommended?
|
||||
@ -86,10 +91,6 @@ module Homebrew
|
||||
reqs.any? do |req|
|
||||
req.name == ff.name || [ff.name, ff.full_name].include?(req.default_formula)
|
||||
end
|
||||
rescue FormulaUnavailableError
|
||||
# Silently ignore this case as we don't care about things used in
|
||||
# taps that aren't currently tapped.
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user