diff options
| author | Max Howell | 2009-06-08 11:43:28 +0100 |
|---|---|---|
| committer | Max Howell | 2009-06-08 11:43:28 +0100 |
| commit | 71a628740987ed5737440ec2f2f350e73c51452b (patch) | |
| tree | 670fa52697960ef47fac2946a12eb3ce3793b977 /bin | |
| parent | cbbc7b0f0f00132c1c9a1beeadd230e4ad6e63e1 (diff) | |
| download | brew-71a628740987ed5737440ec2f2f350e73c51452b.tar.bz2 | |
Handle exceptions during install correctly
rm -rf the prefix and build dirs when appropriate.
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/brew | 34 |
1 files changed, 21 insertions, 13 deletions
@@ -212,20 +212,28 @@ begin shift_formulae_from_ARGV.each do |name| beginning = Time.now o=__obj(name) - raise "#{o.prefix} already exists!" if o.prefix.exist? - o.prefix.mkpath - o.brew { o.install } - ohai 'Finishing up' - #TODO copy changelog or CHANGES file to pkg root, - #TODO maybe README, etc. to versioned root - o.clean - ln name - if o.caveats - ohai "Caveats" - puts o.caveats - ohai "Summary" + begin + raise "#{o.prefix} already exists!" if o.prefix.exist? + o.prefix.mkpath + o.brew do + o.install + ['README','ChangeLog','COPYING','AUTHORS'].each do |file| + FileUtils.cp file, o.prefix if File.file? file + end + end + ohai 'Finishing up' + o.clean + ln name + if o.caveats + ohai "Caveats" + puts o.caveats + ohai "Summary" + end + puts "#{o.prefix}: "+abv(name)+", built in #{Time.now - beginning} seconds" + rescue Exception + FileUtils.rm_rf o.prefix + raise end - puts "#{o.prefix}: "+abv(name)+", built in #{Time.now - beginning} seconds" end when 'ln' n=0 |
