diff options
| author | Max Howell | 2012-08-10 16:33:22 -0400 |
|---|---|---|
| committer | Max Howell | 2012-08-29 12:41:33 -0400 |
| commit | 0c74cd92cf02242b40d447e362273a9b63ed7170 (patch) | |
| tree | 007a5b7e7869ae020ea03f396a9fa2a1a8eb846b /Library/Homebrew/cmd | |
| parent | 8c87b475a977afe1e32f617c3c748a3ab54e965d (diff) | |
| download | homebrew-0c74cd92cf02242b40d447e362273a9b63ed7170.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.rb | 9 |
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 |
