aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorWilliam Woodruff2015-07-26 16:49:16 -0400
committerMisty De Meo2015-08-21 11:02:33 -0700
commit1face808f5f1dc43c887cab421b5c01f7e20fdf7 (patch)
tree0d1308a216ba4b316470c84d3e02e7b09e752803 /Library
parentf58506ea6f7000e7e6d3f6538dc5ff2c43ea7926 (diff)
downloadbrew-1face808f5f1dc43c887cab421b5c01f7e20fdf7.tar.bz2
Add guards to calls that would trigger Xcode install requests
add guard in Formula#file_modified? to prevent git popup add guard in Superenv.bin before calling MacOS::Xcode.version add guard against missing Xcode/CLT in Xcode.uncached_version return nil instread of 0 in uncached_version when Xcode/CLT are not present, to distinguish from linuxbrew behavior checks against pour_bottle? and needs_relocation?, add guard around keg.relocate_install_names to check pour_bottle?/needs_relocation? as well needs_relocation? becomes skip_relocation?, use cellar attr to indicate relocation instead of does_not_need_relocation MacOS.can_build? becomes MacOS.has_apple_developer_tools?
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/config.rb10
-rw-r--r--Library/Homebrew/cmd/install.rb7
-rw-r--r--Library/Homebrew/cmd/reinstall.rb2
-rw-r--r--Library/Homebrew/cmd/upgrade.rb2
-rw-r--r--Library/Homebrew/extend/ENV/std.rb2
-rw-r--r--Library/Homebrew/extend/ENV/super.rb2
-rw-r--r--Library/Homebrew/formula.rb6
-rw-r--r--Library/Homebrew/formula_installer.rb16
-rw-r--r--Library/Homebrew/keg_relocate.rb2
-rw-r--r--Library/Homebrew/os/mac.rb2
-rw-r--r--Library/Homebrew/os/mac/xcode.rb2
-rw-r--r--Library/Homebrew/software_spec.rb15
12 files changed, 33 insertions, 35 deletions
diff --git a/Library/Homebrew/cmd/config.rb b/Library/Homebrew/cmd/config.rb
index 7627d6e97..74b4f436e 100644
--- a/Library/Homebrew/cmd/config.rb
+++ b/Library/Homebrew/cmd/config.rb
@@ -7,23 +7,23 @@ module Homebrew
end
def llvm
- @llvm ||= MacOS.llvm_build_version
+ @llvm ||= MacOS.llvm_build_version if MacOS.has_apple_developer_tools?
end
def gcc_42
- @gcc_42 ||= MacOS.gcc_42_build_version
+ @gcc_42 ||= MacOS.gcc_42_build_version if MacOS.has_apple_developer_tools?
end
def gcc_40
- @gcc_40 ||= MacOS.gcc_40_build_version
+ @gcc_40 ||= MacOS.gcc_40_build_version if MacOS.has_apple_developer_tools?
end
def clang
- @clang ||= MacOS.clang_version
+ @clang ||= MacOS.clang_version if MacOS.has_apple_developer_tools?
end
def clang_build
- @clang_build ||= MacOS.clang_build_version
+ @clang_build ||= MacOS.clang_build_version if MacOS.has_apple_developer_tools?
end
def xcode
diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb
index f41450be1..41628b435 100644
--- a/Library/Homebrew/cmd/install.rb
+++ b/Library/Homebrew/cmd/install.rb
@@ -40,7 +40,7 @@ module Homebrew
# if the user's flags will prevent bottle only-installations when no
# developer tools are available, we need to stop them early on
- FormulaInstaller.prevent_build_flags unless MacOS.can_build?
+ FormulaInstaller.prevent_build_flags unless MacOS.has_apple_developer_tools?
ARGV.formulae.each do |f|
# head-only without --HEAD is an error
@@ -126,11 +126,6 @@ module Homebrew
end
def check_xcode
- # TODO: reinstate check_for_bad_install_name_tool and check_for_installed_developer_tools
- # currently check_for_bad_install_name_tool fails because it tries to call
- # the /usr/bin/otool stub program on systems without XCode/CLT
- # check_for_installed_developer_tools doesn't fail, but produces a warning
- # when one is no longer required
checks = Checks.new
%w[
check_for_unsupported_osx
diff --git a/Library/Homebrew/cmd/reinstall.rb b/Library/Homebrew/cmd/reinstall.rb
index 4de1ad9c2..3c6f9ac20 100644
--- a/Library/Homebrew/cmd/reinstall.rb
+++ b/Library/Homebrew/cmd/reinstall.rb
@@ -2,7 +2,7 @@ require "formula_installer"
module Homebrew
def reinstall
- FormulaInstaller.prevent_build_flags unless MacOS.can_build?
+ FormulaInstaller.prevent_build_flags unless MacOS.has_apple_developer_tools?
ARGV.resolved_formulae.each { |f| reinstall_formula(f) }
end
diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb
index 9bb5d46ad..fb122a659 100644
--- a/Library/Homebrew/cmd/upgrade.rb
+++ b/Library/Homebrew/cmd/upgrade.rb
@@ -3,7 +3,7 @@ require "cmd/outdated"
module Homebrew
def upgrade
- FormulaInstaller.prevent_build_flags unless MacOS.can_build?
+ FormulaInstaller.prevent_build_flags unless MacOS.has_apple_developer_tools?
Homebrew.perform_preinstall_checks
diff --git a/Library/Homebrew/extend/ENV/std.rb b/Library/Homebrew/extend/ENV/std.rb
index 6798e6cd3..d05ccf1a3 100644
--- a/Library/Homebrew/extend/ENV/std.rb
+++ b/Library/Homebrew/extend/ENV/std.rb
@@ -29,7 +29,7 @@ module Stdenv
self["PKG_CONFIG_LIBDIR"] = determine_pkg_config_libdir
# make any aclocal stuff installed in Homebrew available
- self["ACLOCAL_PATH"] = "#{HOMEBREW_PREFIX}/share/aclocal" if MacOS::Xcode.provides_autotools?
+ self["ACLOCAL_PATH"] = "#{HOMEBREW_PREFIX}/share/aclocal" if MacOS.has_apple_developer_tools? && MacOS::Xcode.provides_autotools?
self["MAKEFLAGS"] = "-j#{make_jobs}"
diff --git a/Library/Homebrew/extend/ENV/super.rb b/Library/Homebrew/extend/ENV/super.rb
index 911602919..bcfcd2f0f 100644
--- a/Library/Homebrew/extend/ENV/super.rb
+++ b/Library/Homebrew/extend/ENV/super.rb
@@ -23,6 +23,8 @@ module Superenv
end
def self.bin
+ return unless MacOS.has_apple_developer_tools?
+
bin = (HOMEBREW_REPOSITORY/"Library/ENV").subdirs.reject { |d| d.basename.to_s > MacOS::Xcode.version }.max
bin.realpath unless bin.nil?
end
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index 87746eada..915db64bb 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -720,7 +720,11 @@ class Formula
end
def file_modified?
- return false unless which("git")
+ git_dir = MacOS.locate("git").dirname.to_s
+
+ # /usr/bin/git is a popup stub when Xcode/CLT aren't installed, so bail out
+ return false if git_dir == "/usr/bin" && !MacOS.has_apple_developer_tools?
+
path.parent.cd do
diff = Utils.popen_read("git", "diff", "origin/master", "--", "#{path}")
!diff.empty? && $?.exitstatus == 0
diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb
index cb2b4923b..99d6c786a 100644
--- a/Library/Homebrew/formula_installer.rb
+++ b/Library/Homebrew/formula_installer.rb
@@ -154,7 +154,7 @@ class FormulaInstaller
check_conflicts
- if !pour_bottle? && !MacOS.can_build?
+ if !pour_bottle? && !MacOS.has_apple_developer_tools?
raise BuildToolsError.new([formula])
end
@@ -182,7 +182,7 @@ class FormulaInstaller
if pour_bottle?(:warn => true)
begin
- install_relocation_tools if formula.bottle.needs_relocation?
+ install_relocation_tools unless formula.bottle.skip_relocation?
pour
rescue => e
raise if ARGV.homebrew_developer?
@@ -243,7 +243,7 @@ class FormulaInstaller
def check_dependencies_bottled(deps)
unbottled = deps.select do |dep, _|
formula = dep.to_formula
- !formula.pour_bottle? && !MacOS.can_build?
+ !formula.pour_bottle? && !MacOS.has_apple_developer_tools?
end
raise BuildToolsError.new(unbottled) unless unbottled.empty?
@@ -434,9 +434,7 @@ class FormulaInstaller
keg = Keg.new(formula.prefix)
link(keg)
- # this needs to be changed to a test against build_bottle? and
- # formula.bottle.needs_relocation?
- fix_install_names(keg) unless formula.name == 'cctools'
+ fix_install_names(keg) unless @poured_bottle && formula.bottle.skip_relocation?
if build_bottle? && formula.post_install_defined?
ohai "Not running post_install as we're building a bottle"
@@ -668,8 +666,10 @@ class FormulaInstaller
end
keg = Keg.new(formula.prefix)
- keg.relocate_install_names Keg::PREFIX_PLACEHOLDER, HOMEBREW_PREFIX.to_s,
- Keg::CELLAR_PLACEHOLDER, HOMEBREW_CELLAR.to_s, :keg_only => formula.keg_only?
+ unless formula.bottle.skip_relocation?
+ keg.relocate_install_names Keg::PREFIX_PLACEHOLDER, HOMEBREW_PREFIX.to_s,
+ Keg::CELLAR_PLACEHOLDER, HOMEBREW_CELLAR.to_s, :keg_only => formula.keg_only?
+ end
Pathname.glob("#{formula.bottle_prefix}/{etc,var}/**/*") do |path|
path.extend(InstallRenamed)
diff --git a/Library/Homebrew/keg_relocate.rb b/Library/Homebrew/keg_relocate.rb
index 59ff1c9d7..05d19db4d 100644
--- a/Library/Homebrew/keg_relocate.rb
+++ b/Library/Homebrew/keg_relocate.rb
@@ -99,7 +99,7 @@ class Keg
def install_name_tool(*args)
tool = MacOS.install_name_tool
- system(tool, *args) || raise ErrorDuringExecution.new(tool, args)
+ system(tool, *args) or raise ErrorDuringExecution.new(tool, args)
end
# If file is a dylib or bundle itself, look for the dylib named by
diff --git a/Library/Homebrew/os/mac.rb b/Library/Homebrew/os/mac.rb
index 4e69a6035..814ef70a2 100644
--- a/Library/Homebrew/os/mac.rb
+++ b/Library/Homebrew/os/mac.rb
@@ -52,7 +52,7 @@ module OS
end
end
- def can_build?
+ def has_apple_developer_tools?
Xcode.installed? || CLT.installed?
end
diff --git a/Library/Homebrew/os/mac/xcode.rb b/Library/Homebrew/os/mac/xcode.rb
index 83ba84ff8..40446a8ad 100644
--- a/Library/Homebrew/os/mac/xcode.rb
+++ b/Library/Homebrew/os/mac/xcode.rb
@@ -76,6 +76,8 @@ module OS
return "0" unless OS.mac?
+ return nil if !MacOS::Xcode.installed? && !MacOS::CLT.installed?
+
%W[#{prefix}/usr/bin/xcodebuild #{which("xcodebuild")}].uniq.each do |path|
if File.file? path
Utils.popen_read(path, "-version") =~ /Xcode (\d(\.\d)*)/
diff --git a/Library/Homebrew/software_spec.rb b/Library/Homebrew/software_spec.rb
index 8f1e14c09..edc5f7645 100644
--- a/Library/Homebrew/software_spec.rb
+++ b/Library/Homebrew/software_spec.rb
@@ -245,8 +245,8 @@ class Bottle
@spec.compatible_cellar?
end
- def needs_relocation?
- @spec.needs_relocation?
+ def skip_relocation?
+ @spec.skip_relocation?
end
def stage
@@ -274,7 +274,6 @@ class BottleSpecification
@prefix = DEFAULT_PREFIX
@cellar = DEFAULT_CELLAR
@collector = BottleCollector.new
- @does_not_need_relocation = false
end
def root_url(var = nil)
@@ -286,15 +285,11 @@ class BottleSpecification
end
def compatible_cellar?
- cellar == :any || cellar == HOMEBREW_CELLAR.to_s
+ cellar == :any || cellar == :any_skip_relocation || cellar == HOMEBREW_CELLAR.to_s
end
- def does_not_need_relocation
- @does_not_need_relocation = true
- end
-
- def needs_relocation?
- !@does_not_need_relocation
+ def skip_relocation?
+ cellar == :any_skip_relocation
end
def tag?(tag)