diff options
| author | Max Howell | 2009-08-08 14:10:32 +0100 |
|---|---|---|
| committer | Max Howell | 2009-08-10 18:11:23 +0100 |
| commit | 2dbe54c2dfa137aa0f0a15b82c70586abf99ddc1 (patch) | |
| tree | 7ec7b3a97dd573ff3bd72e1ca7a6a7f43ee45f66 | |
| parent | 7c0bd6fcb0439e939ff23691e29945b4155fd86d (diff) | |
| download | homebrew-2dbe54c2dfa137aa0f0a15b82c70586abf99ddc1.tar.bz2 | |
Ensure ENV is pristine for each installation
Because we modified the ENV global each install this propagated to consecutive
formulae. So exec a new brew process each install. This is the safest way
although Ruby exceptions don't propagate to the parent process so I worry
about it somewhat.
| -rw-r--r-- | Library/Homebrew/brew.h.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/keg.rb | 2 | ||||
| -rwxr-xr-x | bin/brew | 41 |
3 files changed, 29 insertions, 16 deletions
diff --git a/Library/Homebrew/brew.h.rb b/Library/Homebrew/brew.h.rb index a858a0bf2..8f5408e1b 100644 --- a/Library/Homebrew/brew.h.rb +++ b/Library/Homebrew/brew.h.rb @@ -179,7 +179,7 @@ def prune else # always showing symlinks text is deliberate print "Pruned #{$n} symbolic links " - print "and #{$n} directories " if $d > 0 + print "and #{$d} directories " if $d > 0 puts "from #{HOMEBREW_PREFIX}" end end diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb index 69e11983d..a2ef1701c 100644 --- a/Library/Homebrew/keg.rb +++ b/Library/Homebrew/keg.rb @@ -38,7 +38,7 @@ class Keg <Pathname # these dirs REMEMBER that *NOT* everything needs to be in the main tree link_dir('etc') {:mkpath} link_dir('bin') {:link} - link_dir('lib') {|path| :mkpath if %w[pkgconfig php].include? path.to_s} + link_dir('lib') {|path| :mkpath if %w[pkgconfig php perl5].include? path.to_s} link_dir('include') {:link} link_dir('share') {|path| :mkpath if mkpaths.include? path.to_s} @@ -52,23 +52,36 @@ begin end when 'install' - require 'keg' + # we need to ensure a pristine ENV for each process or the formula + # will start with the ENV from the previous build ARGV.formulae.each do |f| - raise "#{f.name} is already installed" if f.installed? unless ARGV.force? - start_time=Time.now - begin - install f - ohai "Caveats", f.caveats, '' - ohai 'Finishing up' - clean f - raise "Nothing was installed to #{f.prefix}" unless f.installed? - Keg.new(f.prefix).link - rescue - f.prefix.rmtree if f.prefix.directory? - raise + pid=fork + if pid.nil? + exec "brew", "install-just-one", f.name, *ARGV.options + else + Process.wait pid end - puts "#{f.prefix}: "+f.prefix.abv+", built in #{pretty_duration Time.now-start_time}" + exit! 1 if $? != 0 # exception in other brew will be visible on screen + end + + # this is an internal option, don't expose it to the user + when 'install-just-one' + require 'keg' + f=ARGV.formulae.shift + raise "#{f.name} is already installed" if f.installed? unless ARGV.force? + BEGINNING=Time.now + begin + install f + ohai "Caveats", f.caveats, '' + ohai 'Finishing up' + clean f + raise "Nothing was installed to #{f.prefix}" unless f.installed? + Keg.new(f.prefix).link + rescue Exception + f.prefix.rmtree if f.prefix.directory? + raise end + puts "#{f.prefix}: #{f.prefix.abv}, built in #{pretty_duration Time.now-BEGINNING}" when 'ln', 'link' ARGV.kegs.each {|keg| puts "#{keg.link} links created for #{keg}"} |
