diff options
| author | Jack Nagel | 2013-02-09 13:55:15 -0600 |
|---|---|---|
| committer | Jack Nagel | 2013-02-09 14:37:36 -0600 |
| commit | 97f9f93f25f54890f7b9005d455baa5c0dd460cc (patch) | |
| tree | 8690dced1f59805d2a2fe0fb2e1b73a4ca088f80 /Library | |
| parent | 1e47298456149b9284542a88b3bdd8ef5ede3b5a (diff) | |
| download | brew-97f9f93f25f54890f7b9005d455baa5c0dd460cc.tar.bz2 | |
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.
Diffstat (limited to 'Library')
| -rwxr-xr-x | Library/Homebrew/build.rb | 14 |
1 files changed, 12 insertions, 2 deletions
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) |
