Skip pouring from a bottle if --cc is passed
A formula should be built from source by default if the --cc option is passed to specify a particular compiler. Added a test to test_formula_installer: test_not_poured_from_bottle_when_compiler_specified Modified test_formula_installer to assert that the formula was not poured from a bottle. Similarly modified test_formula_installer_bottle to assert that the formula *was* installed from a bottle. Added an install method to the TestballBottle formula (the same as the Testball formula's install method) so that the TestballBottle formula can be "built from source". Fixes Homebrew/homebrew#46046 - Build from source should be the default behavior if --cc option is passed Closes Homebrew/homebrew#46162. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
This commit is contained in:
parent
1855dd1da8
commit
af10515f81
@ -80,6 +80,7 @@ class FormulaInstaller
|
|||||||
bottle = formula.bottle
|
bottle = formula.bottle
|
||||||
return true if force_bottle? && bottle
|
return true if force_bottle? && bottle
|
||||||
return false if build_from_source? || build_bottle? || interactive?
|
return false if build_from_source? || build_bottle? || interactive?
|
||||||
|
return false if ARGV.cc
|
||||||
return false unless options.empty?
|
return false unless options.empty?
|
||||||
return false if formula.bottle_disabled?
|
return false if formula.bottle_disabled?
|
||||||
return true if formula.local_bottle_path
|
return true if formula.local_bottle_path
|
||||||
|
|||||||
@ -3,7 +3,9 @@ require "formula"
|
|||||||
require "compat/formula_specialties"
|
require "compat/formula_specialties"
|
||||||
require "formula_installer"
|
require "formula_installer"
|
||||||
require "keg"
|
require "keg"
|
||||||
|
require "tab"
|
||||||
require "testball"
|
require "testball"
|
||||||
|
require "testball_bottle"
|
||||||
|
|
||||||
class InstallTests < Homebrew::TestCase
|
class InstallTests < Homebrew::TestCase
|
||||||
def temporary_install(formula)
|
def temporary_install(formula)
|
||||||
@ -18,6 +20,8 @@ class InstallTests < Homebrew::TestCase
|
|||||||
assert_predicate formula, :installed?
|
assert_predicate formula, :installed?
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
refute_predicate Tab.for_keg(keg), :poured_from_bottle
|
||||||
|
|
||||||
yield formula
|
yield formula
|
||||||
ensure
|
ensure
|
||||||
keg.unlink
|
keg.unlink
|
||||||
@ -67,4 +71,19 @@ class InstallTests < Homebrew::TestCase
|
|||||||
assert_predicate f, :installed?
|
assert_predicate f, :installed?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_not_poured_from_bottle_when_compiler_specified
|
||||||
|
assert_nil ARGV.cc
|
||||||
|
|
||||||
|
cc_arg = "--cc=llvm-gcc"
|
||||||
|
ARGV << cc_arg
|
||||||
|
begin
|
||||||
|
temporary_install(TestballBottle.new) do |f|
|
||||||
|
tab = Tab.for_formula(f)
|
||||||
|
assert_equal "llvm", tab.compiler
|
||||||
|
end
|
||||||
|
ensure
|
||||||
|
ARGV.delete_if { |x| x == cc_arg }
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -3,8 +3,9 @@ require "formula"
|
|||||||
require "compat/formula_specialties"
|
require "compat/formula_specialties"
|
||||||
require "formula_installer"
|
require "formula_installer"
|
||||||
require "keg"
|
require "keg"
|
||||||
require "testball_bottle"
|
require "tab"
|
||||||
require "testball"
|
require "testball"
|
||||||
|
require "testball_bottle"
|
||||||
|
|
||||||
class InstallBottleTests < Homebrew::TestCase
|
class InstallBottleTests < Homebrew::TestCase
|
||||||
def temporary_bottle_install(formula)
|
def temporary_bottle_install(formula)
|
||||||
@ -21,6 +22,8 @@ class InstallBottleTests < Homebrew::TestCase
|
|||||||
assert_predicate formula, :installed?
|
assert_predicate formula, :installed?
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
assert_predicate Tab.for_keg(keg), :poured_from_bottle
|
||||||
|
|
||||||
yield formula
|
yield formula
|
||||||
ensure
|
ensure
|
||||||
keg.unlink
|
keg.unlink
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
require "bundler"
|
||||||
require "testing_env"
|
require "testing_env"
|
||||||
|
|
||||||
class IntegrationCommandTests < Homebrew::TestCase
|
class IntegrationCommandTests < Homebrew::TestCase
|
||||||
|
|||||||
@ -12,4 +12,9 @@ class TestballBottle < Formula
|
|||||||
end
|
end
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def install
|
||||||
|
prefix.install "bin"
|
||||||
|
prefix.install "libexec"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user