aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2013-12-14 09:35:58 -0600
committerJack Nagel2013-12-14 09:35:58 -0600
commitc6c7b9b165df22fe3ac94b155ecdf8952159a18f (patch)
treef55a5c7fa89d23dea689a7e37a79c76396849fc8 /Library
parent68f6936070808c23e6a1e6699defa6a23cebbb82 (diff)
downloadbrew-c6c7b9b165df22fe3ac94b155ecdf8952159a18f.tar.bz2
Extract HOMEBREW_TEMP constant
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/doctor.rb6
-rw-r--r--Library/Homebrew/extend/fileutils.rb4
-rw-r--r--Library/Homebrew/global.rb2
-rw-r--r--Library/Homebrew/keg_fix_install_names.rb4
4 files changed, 7 insertions, 9 deletions
diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb
index 62d266c08..cd0f23a79 100644
--- a/Library/Homebrew/cmd/doctor.rb
+++ b/Library/Homebrew/cmd/doctor.rb
@@ -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.
diff --git a/Library/Homebrew/extend/fileutils.rb b/Library/Homebrew/extend/fileutils.rb
index 881c56590..6a45ad51f 100644
--- a/Library/Homebrew/extend/fileutils.rb
+++ b/Library/Homebrew/extend/fileutils.rb
@@ -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
diff --git a/Library/Homebrew/global.rb b/Library/Homebrew/global.rb
index aa4f52a64..3e0055747 100644
--- a/Library/Homebrew/global.rb
+++ b/Library/Homebrew/global.rb
@@ -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']
diff --git a/Library/Homebrew/keg_fix_install_names.rb b/Library/Homebrew/keg_fix_install_names.rb
index 600e1498b..1d32e6c80 100644
--- a/Library/Homebrew/keg_fix_install_names.rb
+++ b/Library/Homebrew/keg_fix_install_names.rb
@@ -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