update-report: also link docs, completions.
These are more files in the HOMEBREW_REPOSITORY that we want to link to the HOMEBREW_PREFIX.
This commit is contained in:
parent
3ebc5a88e8
commit
1160d0e347
@ -88,7 +88,7 @@ module Homebrew
|
||||
puts if ARGV.include?("--preinstall")
|
||||
end
|
||||
|
||||
link_manpages
|
||||
link_completions_and_docs
|
||||
Tap.each(&:link_manpages)
|
||||
|
||||
Homebrew.failed = true if ENV["HOMEBREW_UPDATE_FAILED"]
|
||||
@ -163,9 +163,16 @@ module Homebrew
|
||||
end
|
||||
end
|
||||
|
||||
def link_manpages
|
||||
def link_completions_and_docs
|
||||
return if HOMEBREW_PREFIX.to_s == HOMEBREW_REPOSITORY.to_s
|
||||
link_path_manpages(HOMEBREW_REPOSITORY/"share", "brew update")
|
||||
command = "brew update"
|
||||
link_src_dst_dirs(HOMEBREW_REPOSITORY/"etc/bash_completion.d",
|
||||
HOMEBREW_PREFIX/"etc/bash_completion.d", command)
|
||||
link_src_dst_dirs(HOMEBREW_REPOSITORY/"share/doc/homebrew",
|
||||
HOMEBREW_PREFIX/"share/doc/homebrew", command, link_dir: true)
|
||||
link_src_dst_dirs(HOMEBREW_REPOSITORY/"share/zsh/site-functions",
|
||||
HOMEBREW_PREFIX/"share/zsh/site-functions", command)
|
||||
link_path_manpages(HOMEBREW_REPOSITORY/"share", command)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -589,18 +589,19 @@ def truncate_text_to_approximate_size(s, max_bytes, options = {})
|
||||
out
|
||||
end
|
||||
|
||||
def link_src_dst_dirs(src_dir, dst_dir, command)
|
||||
def link_src_dst_dirs(src_dir, dst_dir, command, link_dir: false)
|
||||
return unless src_dir.exist?
|
||||
conflicts = []
|
||||
src_dir.find do |src|
|
||||
next if src.directory?
|
||||
dst = dst_dir/src.relative_path_from(src_dir.parent)
|
||||
src_paths = link_dir ? [src_dir] : src_dir.find
|
||||
src_paths.each do |src|
|
||||
next if src.directory? && !link_dir
|
||||
dst = dst_dir.parent/src.relative_path_from(src_dir.parent)
|
||||
next if dst.symlink? && src == dst.resolved_path
|
||||
if dst.exist?
|
||||
conflicts << dst
|
||||
next
|
||||
end
|
||||
dst_dir.mkpath
|
||||
dst_dir.parent.mkpath
|
||||
dst.make_relative_symlink(src)
|
||||
end
|
||||
unless conflicts.empty?
|
||||
@ -614,5 +615,5 @@ def link_src_dst_dirs(src_dir, dst_dir, command)
|
||||
end
|
||||
|
||||
def link_path_manpages(path, command)
|
||||
link_src_dst_dirs(path/"man", HOMEBREW_PREFIX/"share", command)
|
||||
link_src_dst_dirs(path/"man", HOMEBREW_PREFIX/"share/man", command)
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user