diff options
| author | Jack Nagel | 2014-07-12 19:56:58 -0500 |
|---|---|---|
| committer | Jack Nagel | 2014-07-12 19:56:58 -0500 |
| commit | 7b26c885bd4cdb6ae50331082b368118c6c81ed1 (patch) | |
| tree | 875b7d29562d44bb3b87edd0c3b80e7a4368d010 /Library | |
| parent | 1fb16775328d6022643856de146d54d4654e880e (diff) | |
| download | brew-7b26c885bd4cdb6ae50331082b368118c6c81ed1.tar.bz2 | |
Always link symlinks directly
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/keg.rb | 11 | ||||
| -rw-r--r-- | Library/Homebrew/test/test_keg.rb | 18 |
2 files changed, 19 insertions, 10 deletions
diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb index 6a00ed16b..45aab7eb4 100644 --- a/Library/Homebrew/keg.rb +++ b/Library/Homebrew/keg.rb @@ -384,7 +384,7 @@ class Keg dst = HOMEBREW_PREFIX + src.relative_path_from(path) dst.extend ObserverPathnameExtension - if src.file? + if src.symlink? || src.file? Find.prune if File.basename(src) == '.DS_Store' # Don't link pyc files because Python overwrites these cached object # files and next time brew wants to link, the pyc file is in the way. @@ -403,15 +403,6 @@ class Keg 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 diff --git a/Library/Homebrew/test/test_keg.rb b/Library/Homebrew/test/test_keg.rb index c30096ea3..e415be433 100644 --- a/Library/Homebrew/test/test_keg.rb +++ b/Library/Homebrew/test/test_keg.rb @@ -199,4 +199,22 @@ class LinkTests < Homebrew::TestCase @dst.delete assert_equal 3, @keg.unlink end + + def test_pkgconfig_is_mkpathed + link = HOMEBREW_PREFIX.join("lib", "pkgconfig") + @keg.join("lib", "pkgconfig").mkpath + @keg.link + assert_predicate link.lstat, :directory? + end + + def test_symlinks_are_linked_directly + link = HOMEBREW_PREFIX.join("lib", "pkgconfig") + + @keg.join("lib", "example").mkpath + @keg.join("lib", "pkgconfig").make_symlink "example" + @keg.link + + assert_predicate link.resolved_path, :symlink? + assert_predicate link.lstat, :symlink? + end end |
