aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Nagel2014-07-12 19:56:58 -0500
committerJack Nagel2014-07-12 19:56:58 -0500
commitd2d257af4a223144f2b9c8310fad82758c211e89 (patch)
treecc607da471e359a49a7829f45722a63f8490006c
parent87decf20c1c4f644fe1094c8a9c91f30cc5a4d6d (diff)
downloadhomebrew-d2d257af4a223144f2b9c8310fad82758c211e89.tar.bz2
Always link symlinks directly
-rw-r--r--Library/Homebrew/keg.rb11
-rw-r--r--Library/Homebrew/test/test_keg.rb18
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