diff options
| author | Max Howell | 2012-08-27 12:02:57 -0400 |
|---|---|---|
| committer | Max Howell | 2012-08-29 12:41:36 -0400 |
| commit | 0efd1b9efefe107f637784c90643d512bd060c2c (patch) | |
| tree | 85cde2ee3418a62a3b8905250591901f9b56ac69 | |
| parent | d89b3272f441ebdc71d0ffb0448dd1c364f1ca52 (diff) | |
| download | brew-0efd1b9efefe107f637784c90643d512bd060c2c.tar.bz2 | |
Attempt to fix opt link if absent
This is mainly to prevent errors when users for the transitionary period where most installed kegs do not have an opt link.
| -rwxr-xr-x | Library/Homebrew/build.rb | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/Library/Homebrew/build.rb b/Library/Homebrew/build.rb index eb3431b9c..3c15be352 100755 --- a/Library/Homebrew/build.rb +++ b/Library/Homebrew/build.rb @@ -67,10 +67,7 @@ def install f keg_only_deps.each do |dep| opt = HOMEBREW_PREFIX/:opt/dep.name - - #TODO try to fix, if only one key, easy, otherwise check formula.version - raise "#{opt} not present\nReinstall #{dep}. Sorry :(" unless opt.directory? - + fixopt(dep) unless opt.directory? if not superenv? ENV.prepend_path 'PATH', "#{opt}/bin" ENV.prepend_path 'PKG_CONFIG_PATH', "#{opt}/lib/pkgconfig" @@ -128,3 +125,18 @@ def install f end end end + +def fixopt f + path = if f.linked_keg.directory? and f.linked_keg.symlink? + f.linked_keg.readlink + elsif f.prefix.directory? + f.prefix + elsif (kids = f.rack.children).size == 1 + kids.first + else + raise + end + Keg.new(path).optlink +rescue StandardError + "#{opt} not present or broken\nPlease reinstall #{dep}. Sorry :(" +end |
