diff options
| author | Samuel John | 2013-08-08 11:04:04 +0200 |
|---|---|---|
| committer | Samuel John | 2013-08-14 21:46:42 +0200 |
| commit | ad80b10de4aaeb2aaa64f082b349f39f27fc60d7 (patch) | |
| tree | 1a116da0137d56fcdc80db16095fe9d111483f03 /Library | |
| parent | fb187e2132fc9c7c5233fcade06d06c19f8e8f02 (diff) | |
| download | brew-ad80b10de4aaeb2aaa64f082b349f39f27fc60d7.tar.bz2 | |
Keg should link symlinks directly.
If the `src` in the Cellar of a formula is a symlink to another dir
in the same Cellar (for example `Frameworks/QtGui.framework` is a
symlink to `lib/QtGui.framework`), then we should make a symlink
directly instead of possibly creating an empty dir.
This is needed because Ruby's `find` does not follow symlinks (newer
versions can, but we have to support 10.8 for a long time).
Currently this probably only occurs for Qt, where we put symlinks
into the Cellar/Frameworks and the frameworks linking code is a bit
special to create a directory to "merge" together different versions
of the same framework from different formulae. See `python` and
`python3`; both install `Python.framework` and only one can be the
`Current` but the other should still be put into
`Python.framework/Versions`. Therefore `Python.framework` has to
be a dir and no symlink.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/keg.rb | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb index 4791255d1..4a3fd2ddd 100644 --- a/Library/Homebrew/keg.rb +++ b/Library/Homebrew/keg.rb @@ -47,9 +47,7 @@ class Keg < Pathname dirs << dst if dst.directory? && !dst.symlink? # check whether the file to be unlinked is from the current keg first - if !dst.symlink? || !dst.exist? || src != dst.resolved_path - next - end + next if !dst.symlink? || !dst.exist? || src != dst.resolved_path dst.uninstall_info if dst.to_s =~ INFOFILE_RX and ENV['HOMEBREW_KEEP_INFO'] dst.unlink @@ -262,6 +260,15 @@ class Keg < Pathname make_relative_symlink dst, src, mode end elsif src.directory? + # If the `src` in the Cellar is a symlink itself, link it directly. + # For example Qt has `Frameworks/QtGui.framework -> lib/QtGui.framework` + # Not making a link here, would result in an empty dir because the + # `src` is not followed by `find`. + if src.symlink? && !dst.exist? + make_relative_symlink dst, src, mode + Find.prune + end + # if the dst dir already exists, then great! walk the rest of the tree tho next if dst.directory? and not dst.symlink? # no need to put .app bundles in the path, the user can just use |
