diff options
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Contributions/manpages/brew.1.md | 5 | ||||
| -rw-r--r-- | Library/Homebrew/cleaner.rb | 9 | ||||
| -rw-r--r-- | Library/Homebrew/extend/pathname.rb | 22 | ||||
| -rw-r--r-- | Library/Homebrew/keg.rb | 6 |
4 files changed, 40 insertions, 2 deletions
diff --git a/Library/Contributions/manpages/brew.1.md b/Library/Contributions/manpages/brew.1.md index 66fb3eb41..617088415 100644 --- a/Library/Contributions/manpages/brew.1.md +++ b/Library/Contributions/manpages/brew.1.md @@ -366,7 +366,10 @@ creating your own can be found on the wiki: * HOMEBREW\_KEEP\_INFO: If set, Homebrew will not remove files from `share/info`, allowing them - to be linked from the Cellar. + to be linked from the Cellar. To access these info files, prepend + `share/info` to your `INFOPATH` environment variable. + + *Example:* `export INFOPATH='/usr/local/share/info:/usr/share/info'` * HOMEBREW\_MAKE\_JOBS: If set, instructs Homebrew to use the value of `HOMEBREW_MAKE_JOBS` as diff --git a/Library/Homebrew/cleaner.rb b/Library/Homebrew/cleaner.rb index 426fbec6a..14a69c3ae 100644 --- a/Library/Homebrew/cleaner.rb +++ b/Library/Homebrew/cleaner.rb @@ -3,7 +3,14 @@ class Cleaner @f = Formula.factory f [f.bin, f.sbin, f.lib].select{ |d| d.exist? }.each{ |d| clean_dir d } - unless ENV['HOMEBREW_KEEP_INFO'] + if ENV['HOMEBREW_KEEP_INFO'] + # Get rid of the directory file, so it no longer bother us at link stage. + info_dir_file = f.info + 'dir' + if info_dir_file.file? and not f.skip_clean? info_dir_file + puts "rm #{info_dir_file}" if ARGV.verbose? + info_dir_file.unlink + end + else f.info.rmtree if f.info.directory? and not f.skip_clean? f.info end diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb index 4ab94a502..1562bfbcd 100644 --- a/Library/Homebrew/extend/pathname.rb +++ b/Library/Homebrew/extend/pathname.rb @@ -262,6 +262,20 @@ class Pathname ensure chmod saved_perms if saved_perms end + + def install_info + unless self.symlink? + raise "Cannot install info entry for unbrewed info file '#{self}'" + end + system '/usr/bin/install-info', self.to_s, (self.dirname+'dir').to_s + end + + def uninstall_info + unless self.symlink? + raise "Cannot uninstall info entry for unbrewed info file '#{self}'" + end + system '/usr/bin/install-info', '--delete', '--quiet', self.to_s, (self.dirname+'dir').to_s + end end # sets $n and $d so you can observe creation of stuff @@ -286,6 +300,14 @@ module ObserverPathnameExtension puts "ln #{to_s}" if ARGV.verbose? $n+=1 end + def install_info + super + puts "info #{to_s}" if ARGV.verbose? + end + def uninstall_info + super + puts "uninfo #{to_s}" if ARGV.verbose? + end end $n=0 diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb index 8a98c1656..e6ef3e6a8 100644 --- a/Library/Homebrew/keg.rb +++ b/Library/Homebrew/keg.rb @@ -7,6 +7,8 @@ class Keg < Pathname raise "#{to_s} is not a directory" unless directory? end + INFOFILE_RX = %r[/share/info/[^.].*?\.info$] + # if path is a file in a keg then this will return the containing Keg object def self.for path path = path.realpath @@ -29,6 +31,7 @@ class Keg < Pathname next if src == self dst=HOMEBREW_PREFIX+src.relative_path_from(self) next unless dst.symlink? + dst.uninstall_info if dst.to_s =~ INFOFILE_RX and ENV['HOMEBREW_KEEP_INFO'] dst.unlink n+=1 Find.prune if src.directory? @@ -127,7 +130,10 @@ 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'] 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? |
