aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2012-02-26 19:28:46 -0600
committerJack Nagel2012-03-04 23:56:22 -0600
commited1a674c6256cdeb1089c1b1028199eac9249337 (patch)
treed597ad0796be9720df4f092dbf372e34cee038e9 /Library
parent71a53dc415efd35d70ff0526db3148e4f3fc0816 (diff)
downloadhomebrew-ed1a674c6256cdeb1089c1b1028199eac9249337.tar.bz2
keg: allow selective linking at the file level
Some parts of a keg's tree are not subject to the cleaner, and sometimes we still want to remove things in directories marked skip_clean; this allows us that freedom. If 'lib' is marked skip_clean, we still want to avoid linking the charset.alias file into the top of the tree. The same needs to be done for the locale.alias file in share/locale. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cleaner.rb2
-rw-r--r--Library/Homebrew/keg.rb32
2 files changed, 21 insertions, 13 deletions
diff --git a/Library/Homebrew/cleaner.rb b/Library/Homebrew/cleaner.rb
index ea5ece779..14a69c3ae 100644
--- a/Library/Homebrew/cleaner.rb
+++ b/Library/Homebrew/cleaner.rb
@@ -78,8 +78,6 @@ class Cleaner
elsif path.extname == '.la'
# *.la files are stupid
path.unlink unless @f.skip_clean? path
- elsif path == @f.lib+'charset.alias'
- path.unlink unless @f.skip_clean? path
elsif not path.symlink?
clean_file path
end
diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb
index e4971bc00..edc948f76 100644
--- a/Library/Homebrew/keg.rb
+++ b/Library/Homebrew/keg.rb
@@ -9,7 +9,7 @@ class Keg < Pathname
# locale-specific directories have the form language[_territory][.codeset][@modifier]
LOCALEDIR_RX = /(locale|man)\/([a-z]{2}|C|POSIX)(_[A-Z]{2})?(\.[a-zA-Z\-0-9]+(@.+)?)?/
- INFOFILE_RX = %r[/share/info/[^.].*?\.info$]
+ INFOFILE_RX = %r[info/[^.].*?\.info$]
# if path is a file in a keg then this will return the containing Keg object
def self.for path
@@ -68,20 +68,23 @@ class Keg < Pathname
# yeah indeed, you have to force anything you need in the main tree into
# these dirs REMEMBER that *NOT* everything needs to be in the main tree
link_dir('etc') {:mkpath}
- link_dir('bin') {:skip}
- link_dir('sbin') {:link}
+ link_dir('bin') { |path| :skip if path.directory? }
+ link_dir('sbin') { |path| :skip if path.directory? }
link_dir('include') {:link}
link_dir('share') do |path|
- if path.to_s =~ LOCALEDIR_RX
- :mkpath
- elsif share_mkpaths.include? path.to_s
- :mkpath
+ case path.to_s
+ when 'locale/locale.alias' then :skip
+ when INFOFILE_RX then :info if ENV['HOMEBREW_KEEP_INFO']
+ when LOCALEDIR_RX then :mkpath
+ when *share_mkpaths then :mkpath
+ else :link
end
end
link_dir('lib') do |path|
case path.to_s
+ when 'charset.alias' then :skip
# pkg-config database gets explicitly created
when 'pkgconfig' then :mkpath
# lib/language folders also get explicitly created
@@ -131,10 +134,17 @@ protected
dst.extend ObserverPathnameExtension
if src.file?
- # Do the symlink.
- dst.make_relative_symlink src unless File.basename(src) == '.DS_Store'
- # Install info file entries in the info directory file
- dst.install_info if dst.to_s =~ INFOFILE_RX and ENV['HOMEBREW_KEEP_INFO']
+ Find.prune if File.basename(src) == '.DS_Store'
+
+ case yield src.relative_path_from(root)
+ when :skip
+ Find.prune
+ when :info
+ dst.make_relative_symlink(src)
+ dst.install_info
+ else
+ dst.make_relative_symlink(src)
+ end
elsif src.directory?
# if the dst dir already exists, then great! walk the rest of the tree tho
next if dst.directory? and not dst.symlink?