diff options
| author | Max Howell | 2012-03-06 13:02:10 +0000 |
|---|---|---|
| committer | Max Howell | 2012-03-16 21:06:16 +0000 |
| commit | 765ae9618050e415c039edabce02671581c1ffb1 (patch) | |
| tree | ae9a679dab52748ffc5e55088fbe1fc9f4380b4e /Library | |
| parent | 921f0e567420b841be535b1e9acf20d8320cb2ea (diff) | |
| download | brew-765ae9618050e415c039edabce02671581c1ffb1.tar.bz2 | |
Leave kegs keg-only if linking step fails
Rationale: well, it should always have been like this!
However now we are opening ourselves up to more-mixed installations of formula not maintained by us, it's important that
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/cmd/link.rb | 7 | ||||
| -rw-r--r-- | Library/Homebrew/extend/pathname.rb | 13 | ||||
| -rw-r--r-- | Library/Homebrew/formula_installer.rb | 5 |
3 files changed, 9 insertions, 16 deletions
diff --git a/Library/Homebrew/cmd/link.rb b/Library/Homebrew/cmd/link.rb index df3445aa5..d882ee7ec 100644 --- a/Library/Homebrew/cmd/link.rb +++ b/Library/Homebrew/cmd/link.rb @@ -11,12 +11,7 @@ module Homebrew extend self ARGV.kegs.each do |keg| print "Linking #{keg}... " puts if ARGV.verbose? - begin - puts "#{keg.link} symlinks created" - rescue Exception - puts - raise - end + puts "#{keg.link} symlinks created" end end end diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb index d0ed3108b..bc58c885f 100644 --- a/Library/Homebrew/extend/pathname.rb +++ b/Library/Homebrew/extend/pathname.rb @@ -273,15 +273,10 @@ class Pathname self.dirname.mkpath Dir.chdir self.dirname do - # TODO use Ruby function so we get exceptions - # NOTE Ruby functions may work, but I had a lot of problems - rv = system 'ln', '-sf', src.relative_path_from(self.dirname), self.basename - unless rv and $? == 0 - raise <<-EOS.undent - Could not create symlink #{to_s}. - Check that you have permissions on #{self.dirname} - EOS - end + # NOTE only system ln -s will create RELATIVE symlinks + system 'ln', '-s', src.relative_path_from(self.dirname), self.basename + # ln outputs useful error message for us + raise "Could not create symlink: #{to_s}." unless $?.success? end end diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 479232cd1..96dae5bac 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -214,11 +214,14 @@ class FormulaInstaller f.linked_keg.unlink end - Keg.new(f.prefix).link + keg = Keg.new(f.prefix) + keg.link rescue Exception => e onoe "The linking step did not complete successfully" puts "The formula built, but is not symlinked into #{HOMEBREW_PREFIX}" puts "You can try again using `brew link #{f.name}'" + keg.unlink + ohai e, e.backtrace if ARGV.debug? @show_summary_heading = true end |
