Merge pull request #13494 from Bo98/bottle-dep-fix
Fix `Keg.bottle_dependencies` including unneeded build dependencies
This commit is contained in:
commit
0815a4481a
@ -100,18 +100,11 @@ module Homebrew
|
|||||||
return merge(args: args)
|
return merge(args: args)
|
||||||
end
|
end
|
||||||
|
|
||||||
ensure_relocation_formulae_installed! unless args.skip_relocation?
|
|
||||||
args.named.to_resolved_formulae(uniq: false).each do |f|
|
args.named.to_resolved_formulae(uniq: false).each do |f|
|
||||||
bottle_formula f, args: args
|
bottle_formula f, args: args
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def ensure_relocation_formulae_installed!
|
|
||||||
Keg.relocation_formulae.each do |f|
|
|
||||||
ensure_formula_installed!(f, latest: true)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def keg_contain?(string, keg, ignores, formula_and_runtime_deps_names = nil, args:)
|
def keg_contain?(string, keg, ignores, formula_and_runtime_deps_names = nil, args:)
|
||||||
@put_string_exists_header, @put_filenames = nil
|
@put_string_exists_header, @put_filenames = nil
|
||||||
|
|
||||||
|
|||||||
@ -83,12 +83,11 @@ class Keg
|
|||||||
|
|
||||||
def self.bottle_dependencies
|
def self.bottle_dependencies
|
||||||
@bottle_dependencies ||= begin
|
@bottle_dependencies ||= begin
|
||||||
formulae = relocation_formulae
|
formulae = []
|
||||||
gcc = Formulary.factory(CompilerSelector.preferred_gcc)
|
gcc = Formulary.factory(CompilerSelector.preferred_gcc)
|
||||||
if !Homebrew::EnvConfig.simulate_macos_on_linux? &&
|
if !Homebrew::EnvConfig.simulate_macos_on_linux? &&
|
||||||
DevelopmentTools.non_apple_gcc_version("gcc") < gcc.version.to_i
|
DevelopmentTools.non_apple_gcc_version("gcc") < gcc.version.to_i
|
||||||
formulae += gcc.recursive_dependencies.map(&:name)
|
formulae << gcc
|
||||||
formulae << gcc.name
|
|
||||||
end
|
end
|
||||||
formulae
|
formulae
|
||||||
end
|
end
|
||||||
|
|||||||
@ -577,9 +577,8 @@ class FormulaInstaller
|
|||||||
unsatisfied_reqs
|
unsatisfied_reqs
|
||||||
end
|
end
|
||||||
|
|
||||||
def expand_dependencies
|
def expand_dependencies_for_formula(formula, inherited_options)
|
||||||
inherited_options = Hash.new { |hash, key| hash[key] = Options.new }
|
any_bottle_used = false
|
||||||
pour_bottle = pour_bottle?
|
|
||||||
|
|
||||||
# Cache for this expansion only. FormulaInstaller has a lot of inputs which can alter expansion.
|
# Cache for this expansion only. FormulaInstaller has a lot of inputs which can alter expansion.
|
||||||
cache_key = "FormulaInstaller-#{formula.full_name}-#{Time.now.to_f}"
|
cache_key = "FormulaInstaller-#{formula.full_name}-#{Time.now.to_f}"
|
||||||
@ -600,27 +599,35 @@ class FormulaInstaller
|
|||||||
elsif dep.satisfied?(inherited_options[dep.name])
|
elsif dep.satisfied?(inherited_options[dep.name])
|
||||||
Dependency.skip
|
Dependency.skip
|
||||||
else
|
else
|
||||||
pour_bottle ||= install_bottle_for?(dep.to_formula, build)
|
any_bottle_used ||= install_bottle_for?(dep.to_formula, build)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
[expanded_deps, any_bottle_used]
|
||||||
|
end
|
||||||
|
|
||||||
|
def expand_dependencies
|
||||||
|
inherited_options = Hash.new { |hash, key| hash[key] = Options.new }
|
||||||
|
any_bottle_used = pour_bottle?
|
||||||
|
|
||||||
|
expanded_deps, any_dep_bottle_used = expand_dependencies_for_formula(formula, inherited_options)
|
||||||
|
any_bottle_used ||= any_dep_bottle_used
|
||||||
|
|
||||||
# We require some dependencies (glibc, GCC 5, etc.) if binaries were built.
|
# We require some dependencies (glibc, GCC 5, etc.) if binaries were built.
|
||||||
# Native binaries shouldn't exist in cross-platform `all` bottles.
|
# Native binaries shouldn't exist in cross-platform `all` bottles.
|
||||||
if pour_bottle && !formula.bottled?(:all) && !Keg.bottle_dependencies.empty?
|
if any_bottle_used && !formula.bottled?(:all) && !Keg.bottle_dependencies.empty?
|
||||||
bottle_deps = if Keg.bottle_dependencies.exclude?(formula.name)
|
all_bottle_deps = Keg.bottle_dependencies.flat_map do |bottle_dep|
|
||||||
Keg.bottle_dependencies
|
bottle_dep.recursive_dependencies.map(&:name) + [bottle_dep.name]
|
||||||
elsif Keg.relocation_formulae.exclude?(formula.name)
|
|
||||||
Keg.relocation_formulae
|
|
||||||
else
|
|
||||||
[]
|
|
||||||
end
|
end
|
||||||
bottle_deps = bottle_deps.map { |formula| Dependency.new(formula) }
|
|
||||||
.reject do |dep|
|
if all_bottle_deps.exclude?(formula.name)
|
||||||
inherited_options[dep.name] |= inherited_options_for(dep)
|
bottle_deps = Keg.bottle_dependencies.flat_map do |bottle_dep|
|
||||||
dep.satisfied? inherited_options[dep.name]
|
expanded_bottle_deps, = expand_dependencies_for_formula(bottle_dep, inherited_options)
|
||||||
|
expanded_bottle_deps
|
||||||
end
|
end
|
||||||
expanded_deps = Dependency.merge_repeats(bottle_deps + expanded_deps)
|
expanded_deps = Dependency.merge_repeats(bottle_deps + expanded_deps)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
expanded_deps.map { |dep| [dep, inherited_options[dep.name]] }
|
expanded_deps.map { |dep| [dep, inherited_options[dep.name]] }
|
||||||
end
|
end
|
||||||
|
|||||||
@ -367,12 +367,8 @@ class Keg
|
|||||||
[]
|
[]
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.relocation_formulae
|
|
||||||
[]
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.bottle_dependencies
|
def self.bottle_dependencies
|
||||||
relocation_formulae
|
[]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user