diff options
| author | Jack Nagel | 2013-06-03 15:08:47 -0500 |
|---|---|---|
| committer | Jack Nagel | 2013-06-03 16:52:00 -0500 |
| commit | b2972dc1f9c88eff02175fbf17f67aea6e8e370f (patch) | |
| tree | f638231efa04e652c72d4b1381d94e6874236600 /Library/Homebrew/build.rb | |
| parent | 17bf43ef705cae45545f3c43cf37b6be6e12d509 (diff) | |
| download | homebrew-b2972dc1f9c88eff02175fbf17f67aea6e8e370f.tar.bz2 | |
Allow explicit conversion of requirements to deps
Fixes #19857.
Diffstat (limited to 'Library/Homebrew/build.rb')
| -rwxr-xr-x | Library/Homebrew/build.rb | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/Library/Homebrew/build.rb b/Library/Homebrew/build.rb index e59b5be6a..96245f022 100755 --- a/Library/Homebrew/build.rb +++ b/Library/Homebrew/build.rb @@ -59,8 +59,10 @@ class Build def initialize(f) @f = f + # Expand requirements before dependencies, as requirements + # may add dependencies if a default formula is activated. + @reqs = expand_reqs @deps = expand_deps - @reqs = f.recursive_requirements end def post_superenv_hacks @@ -77,6 +79,19 @@ class Build not ARGV.include? '--env=super' end + def expand_reqs + f.recursive_requirements do |dependent, req| + if (req.optional? || req.recommended?) && dependent.build.without?(req.name) + Requirement.prune + elsif req.build? && dependent != f + Requirement.prune + elsif req.satisfied? && req.default_formula? && (dep = req.to_dependency).installed? + dependent.deps << dep + Requirement.prune + end + end + end + def expand_deps f.recursive_dependencies do |dependent, dep| if dep.optional? || dep.recommended? @@ -84,18 +99,18 @@ class Build elsif dep.build? Dependency.prune unless dependent == f end - end.map(&:to_formula) + end end def install - keg_only_deps = deps.select(&:keg_only?) + keg_only_deps = deps.map(&:to_formula).select(&:keg_only?) pre_superenv_hacks require 'superenv' deps.each do |dep| opt = HOMEBREW_PREFIX/:opt/dep - fixopt(dep) unless opt.directory? or ARGV.ignore_deps? + fixopt(dep.to_formula) unless opt.directory? or ARGV.ignore_deps? end if superenv? @@ -105,9 +120,11 @@ class Build ENV.setup_build_environment post_superenv_hacks reqs.each(&:modify_build_environment) + deps.each(&:modify_build_environment) else ENV.setup_build_environment reqs.each(&:modify_build_environment) + deps.each(&:modify_build_environment) keg_only_deps.each do |dep| opt = dep.opt_prefix |
