Extract HOMEBREW_TEMP constant

This commit is contained in:
Jack Nagel 2013-12-14 09:35:58 -06:00
parent 68f6936070
commit c6c7b9b165
4 changed files with 7 additions and 9 deletions

View File

@ -681,8 +681,7 @@ def check_for_multiple_volumes
# Find the volumes for the TMP folder & HOMEBREW_CELLAR
real_cellar = HOMEBREW_CELLAR.realpath
tmp_prefix = ENV['HOMEBREW_TEMP'] || '/tmp'
tmp = Pathname.new with_system_path { `mktemp -d #{tmp_prefix}/homebrew-brew-doctor-XXXX` }.strip
tmp = Pathname.new with_system_path { `mktemp -d #{HOMEBREW_TEMP}/homebrew-brew-doctor-XXXX` }.strip
real_temp = tmp.realpath.parent
where_cellar = volumes.which real_cellar
@ -703,8 +702,7 @@ end
def check_filesystem_case_sensitive
volumes = Volumes.new
tmp_prefix = Pathname.new(ENV['HOMEBREW_TEMP'] || '/tmp')
case_sensitive_vols = [HOMEBREW_PREFIX, HOMEBREW_REPOSITORY, HOMEBREW_CELLAR, tmp_prefix].select do |dir|
case_sensitive_vols = [HOMEBREW_PREFIX, HOMEBREW_REPOSITORY, HOMEBREW_CELLAR, HOMEBREW_TEMP].select do |dir|
# We select the dir as being case-sensitive if either the UPCASED or the
# downcased variant is missing.
# Of course, on a case-insensitive fs, both exist because the os reports so.

View File

@ -13,8 +13,8 @@ module FileUtils extend self
# If the user has FileVault enabled, then we can't mv symlinks from the
# /tmp volume to the other volume. So we let the user override the tmp
# prefix if they need to.
tmp = ENV['HOMEBREW_TEMP'].chuzzle || '/tmp'
tempd = with_system_path { `mktemp -d #{tmp}/#{prefix}-XXXX` }.chuzzle
tempd = with_system_path { `mktemp -d #{HOMEBREW_TEMP}/#{prefix}-XXXX` }.chuzzle
raise "Failed to create sandbox" if tempd.nil?
prevd = pwd
cd tempd

View File

@ -66,6 +66,8 @@ end
HOMEBREW_LOGS = Pathname.new(ENV['HOMEBREW_LOGS'] || '~/Library/Logs/Homebrew/').expand_path
HOMEBREW_TEMP = Pathname.new(ENV.fetch('HOMEBREW_TEMP', '/tmp'))
RUBY_BIN = Pathname.new(RbConfig::CONFIG['bindir'])
RUBY_PATH = RUBY_BIN + RbConfig::CONFIG['ruby_install_name'] + RbConfig::CONFIG['EXEEXT']

View File

@ -3,15 +3,13 @@ class Keg
CELLAR_PLACEHOLDER = "@@HOMEBREW_CELLAR@@".freeze
def fix_install_names options={}
tmp = ENV['HOMEBREW_TEMP'] ? Regexp.escape(ENV['HOMEBREW_TEMP']) : '/tmp'
mach_o_files.each do |file|
file.ensure_writable do
change_dylib_id(dylib_id_for(file, options), file) if file.dylib?
each_install_name_for(file) do |bad_name|
# Don't fix absolute paths unless they are rooted in the build directory
next if bad_name.start_with? '/' and not %r[^#{tmp}] === bad_name
next if bad_name.start_with? '/' and not %r[^#{HOMEBREW_TEMP}] === bad_name
new_name = fixed_name(file, bad_name)
change_install_name(bad_name, new_name, file) unless new_name == bad_name