aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorMike McQuaid2015-07-14 11:56:34 -0700
committerMike McQuaid2015-07-18 19:52:56 -0700
commitb9cdfe21fc7c1dbfa2f6ce7a087a47556dfff5df (patch)
tree15195aa383c6c9e3a1eecd8c5f1a33f9c1957864 /Library/Homebrew
parentda2e4d417d797d54b04fb8e1106e3c98af97a2d1 (diff)
downloadbrew-b9cdfe21fc7c1dbfa2f6ce7a087a47556dfff5df.tar.bz2
keg_relocate: relocate all text files.
Work out what's text and what's not using `file`. Also, rename `keg_fix_install_names` to `keg_relocate` because that's a more accurate description of what it does now. Closes Homebrew/homebrew#41663. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/keg.rb2
-rw-r--r--Library/Homebrew/keg_relocate.rb (renamed from Library/Homebrew/keg_fix_install_names.rb)58
2 files changed, 8 insertions, 52 deletions
diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb
index 20e24d1ec..cf4be6cc0 100644
--- a/Library/Homebrew/keg.rb
+++ b/Library/Homebrew/keg.rb
@@ -1,5 +1,5 @@
require "extend/pathname"
-require "keg_fix_install_names"
+require "keg_relocate"
require "formula_lock"
require "ostruct"
diff --git a/Library/Homebrew/keg_fix_install_names.rb b/Library/Homebrew/keg_relocate.rb
index a6ddb970f..a66670273 100644
--- a/Library/Homebrew/keg_fix_install_names.rb
+++ b/Library/Homebrew/keg_relocate.rb
@@ -38,10 +38,7 @@ class Keg
end
end
- files = pkgconfig_files | libtool_files | script_files | plist_files
- files << tab_file if tab_file.file?
-
- files.group_by { |f| f.stat.ino }.each_value do |first, *rest|
+ text_files.group_by { |f| f.stat.ino }.each_value do |first, *rest|
s = first.open("rb", &:read)
changed = s.gsub!(old_cellar, new_cellar)
changed = s.gsub!(old_prefix, new_prefix) || changed
@@ -161,55 +158,14 @@ class Keg
mach_o_files
end
- def script_files
- script_files = []
-
- # find all files with shebangs
- find do |pn|
+ def text_files
+ text_files = []
+ path.find do |pn|
next if pn.symlink? or pn.directory?
- script_files << pn if pn.text_executable?
- end
-
- script_files
- end
-
- def pkgconfig_files
- pkgconfig_files = []
-
- %w[lib share].each do |dir|
- pcdir = path.join(dir, "pkgconfig")
-
- pcdir.find do |pn|
- next if pn.symlink? or pn.directory? or pn.extname != '.pc'
- pkgconfig_files << pn
- end if pcdir.directory?
+ next if Metafiles::EXTENSIONS.include? pn.extname
+ text_files << pn if Utils.popen_read("/usr/bin/file", pn).include?("text")
end
- pkgconfig_files
- end
-
- def libtool_files
- libtool_files = []
-
- # find .la files, which are stored in lib/
- lib.find do |pn|
- next if pn.symlink? or pn.directory? or pn.extname != '.la'
- libtool_files << pn
- end if lib.directory?
- libtool_files
- end
-
- def plist_files
- plist_files = []
-
- self.find do |pn|
- next if pn.symlink? or pn.directory? or pn.extname != '.plist'
- plist_files << pn
- end
- plist_files
- end
-
- def tab_file
- join(Tab::FILENAME)
+ text_files
end
end