aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd
diff options
context:
space:
mode:
authorMax Howell2012-08-10 16:33:22 -0400
committerMax Howell2012-08-29 12:41:33 -0400
commitf02d81ecbf636aea7bcb842ef6350afe947a4839 (patch)
tree3c15f5e91190fd4819f48e710b569610d377e132 /Library/Homebrew/cmd
parent50767c60773b290eb8d203695852a6a0c21c71e4 (diff)
downloadbrew-f02d81ecbf636aea7bcb842ef6350afe947a4839.tar.bz2
Create active symlinks for installed formula
Similar to the LinkedKegs record, we write a symlink for installed kegs to PREFIX/opt. Unlike the linked-keg record, unlinking doesn't remove the link, only uninstalling, and keg-only formula have a record too. The reason for this addition is so that formula that depend on keg-only formula can build against the opt directory and not the cellar keg. Thus surviving upgrades. To enforce this fix_install_names and built were adapted to use the opt path. Standard kegs also create an opt symlink so that caveats can now refer to the opt directory and thus provide steps that survive upgrades too. Thus the choice of /opt. It is short, neat and the right choice: POSIX dictates that opt is for stand-alone prefixes of software.
Diffstat (limited to 'Library/Homebrew/cmd')
-rw-r--r--Library/Homebrew/cmd/uninstall.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/Library/Homebrew/cmd/uninstall.rb b/Library/Homebrew/cmd/uninstall.rb
index cc13a18c8..d719be96a 100644
--- a/Library/Homebrew/cmd/uninstall.rb
+++ b/Library/Homebrew/cmd/uninstall.rb
@@ -10,6 +10,7 @@ module Homebrew extend self
puts "Uninstalling #{keg}..."
keg.unlink
keg.uninstall
+ rm_opt_link keg.fname
end
else
ARGV.named.each do |name|
@@ -30,10 +31,18 @@ module Homebrew extend self
end
rack.rmtree
end
+
+ rm_opt_link name
end
end
rescue MultipleVersionsInstalledError => e
ofail e
puts "Use `brew remove --force #{e.name}` to remove all versions."
end
+
+ def rm_opt_link name
+ optlink = HOMEBREW_PREFIX/:opt/name
+ optlink.unlink if optlink.symlink?
+ end
+
end