From 97f9f93f25f54890f7b9005d455baa5c0dd460cc Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Sat, 9 Feb 2013 13:55:15 -0600 Subject: build: ignore non-explicit build-time dependencies Given the following dependency tree: foo bar (bottled) baz (build-time only) We skip installing baz because it is a build-time dependency of something that is bottled. However, during the build of foo, this filter is not applied because the dependent-dep relationship is not considered at this stage. If baz wasn't installed prior to this build, fixopt(baz) will fail. Further, build-time deps are tightly coupled to the formula they are specified by, and we shouldn't rely on them coming from dependencies several levels down. Fixes Homebrew/homebrew#17697. --- Library/Homebrew/build.rb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'Library') diff --git a/Library/Homebrew/build.rb b/Library/Homebrew/build.rb index 561017296..2390b811d 100755 --- a/Library/Homebrew/build.rb +++ b/Library/Homebrew/build.rb @@ -69,8 +69,18 @@ def pre_superenv_hacks f not ARGV.include? '--env=super' end +def expand_deps f + f.recursive_dependencies do |dependent, dep| + if dep.optional? || dep.recommended? + Dependency.prune unless dependent.build.with?(dep.name) + elsif dep.build? + Dependency.prune unless dependent == f + end + end.map(&:to_formula) +end + def install f - deps = f.recursive_dependencies.map(&:to_formula) + deps = expand_deps(f) keg_only_deps = deps.select(&:keg_only?) pre_superenv_hacks(f) @@ -83,7 +93,7 @@ def install f if superenv? ENV.deps = keg_only_deps.map(&:to_s) - ENV.all_deps = f.recursive_dependencies.map(&:to_s) + ENV.all_deps = deps.map(&:to_s) ENV.x11 = f.recursive_requirements.detect { |rq| rq.kind_of?(X11Dependency) } ENV.setup_build_environment post_superenv_hacks(f) -- cgit v1.2.3