diff options
| author | Jack Nagel | 2013-12-14 09:35:58 -0600 |
|---|---|---|
| committer | Jack Nagel | 2013-12-14 09:35:58 -0600 |
| commit | 8e2e76d99a3fdf0fab6dbcef5af2ec21677a63c0 (patch) | |
| tree | 910a366a7e412d4efc57a3714c47a4012ae1ec28 | |
| parent | 1ed7284548d6e242667ece2d94f4da0b997ebc09 (diff) | |
| download | homebrew-8e2e76d99a3fdf0fab6dbcef5af2ec21677a63c0.tar.bz2 | |
Extract HOMEBREW_TEMP constant
| -rw-r--r-- | Library/Homebrew/cmd/doctor.rb | 6 | ||||
| -rw-r--r-- | Library/Homebrew/extend/fileutils.rb | 4 | ||||
| -rw-r--r-- | Library/Homebrew/global.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/keg_fix_install_names.rb | 4 |
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 |
