Merge branch 'master' into argv-env

This commit is contained in:
Mike McQuaid 2020-05-23 14:10:44 +01:00 committed by GitHub
commit 64602bc8ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 20 additions and 23 deletions

View File

@ -368,8 +368,8 @@ module Cask
fi.installed_on_request = false fi.installed_on_request = false
fi.show_header = true fi.show_header = true
fi.verbose = verbose? fi.verbose = verbose?
fi.fetch
fi.prelude fi.prelude
fi.fetch
fi.install fi.install
fi.finish fi.finish
end end

View File

@ -325,8 +325,8 @@ module Homebrew
fi.build_bottle = args.build_bottle? fi.build_bottle = args.build_bottle?
fi.interactive = args.interactive? fi.interactive = args.interactive?
fi.git = args.git? fi.git = args.git?
fi.fetch
fi.prelude fi.prelude
fi.fetch
fi.install fi.install
fi.finish fi.finish
rescue FormulaInstallationAlreadyAttemptedError rescue FormulaInstallationAlreadyAttemptedError

View File

@ -191,8 +191,8 @@ module Homebrew
end end
oh1 "Upgrading #{Formatter.identifier(f.full_specified_name)} #{upgrade_version} #{fi.options.to_a.join(" ")}" oh1 "Upgrading #{Formatter.identifier(f.full_specified_name)} #{upgrade_version} #{fi.options.to_a.join(" ")}"
fi.fetch
fi.prelude fi.prelude
fi.fetch
# first we unlink the currently active keg for this formula otherwise it is # first we unlink the currently active keg for this formula otherwise it is
# possible for the existing build to interfere with the build we are about to # possible for the existing build to interfere with the build we are about to

View File

@ -11,10 +11,6 @@ module HomebrewArgvExtension
flag?("--debug") || !ENV["HOMEBREW_DEBUG"].nil? flag?("--debug") || !ENV["HOMEBREW_DEBUG"].nil?
end end
def cc
value "cc"
end
private private
def options_only def options_only

View File

@ -162,7 +162,7 @@ module SharedEnvExtension
# ENV.append_to_cflags "-I ./missing/includes" # ENV.append_to_cflags "-I ./missing/includes"
# end</pre> # end</pre>
def compiler def compiler
@compiler ||= if (cc = ARGV.cc) @compiler ||= if (cc = Homebrew.args.cc)
warn_about_non_apple_gcc($&) if cc =~ GNU_GCC_REGEXP warn_about_non_apple_gcc($&) if cc =~ GNU_GCC_REGEXP
fetch_compiler(cc, "--cc") fetch_compiler(cc, "--cc")
elsif (cc = homebrew_cc) elsif (cc = homebrew_cc)

View File

@ -100,7 +100,7 @@ class FormulaInstaller
return false if !formula.bottled? && !formula.local_bottle_path return false if !formula.bottled? && !formula.local_bottle_path
return true if force_bottle? return true if force_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 if Homebrew.args.cc
return false unless options.empty? return false unless options.empty?
return false if formula.bottle_disabled? return false if formula.bottle_disabled?
@ -141,7 +141,6 @@ class FormulaInstaller
def prelude def prelude
Tab.clear_cache Tab.clear_cache
verify_deps_exist unless ignore_deps? verify_deps_exist unless ignore_deps?
lock
check_install_sanity check_install_sanity
end end
@ -221,6 +220,8 @@ class FormulaInstaller
end end
def install def install
lock
start_time = Time.now start_time = Time.now
if !formula.bottle_unneeded? && !pour_bottle? && DevelopmentTools.installed? if !formula.bottle_unneeded? && !pour_bottle? && DevelopmentTools.installed?
Homebrew::Install.perform_build_from_source_checks Homebrew::Install.perform_build_from_source_checks
@ -728,7 +729,7 @@ class FormulaInstaller
args << "--interactive" if interactive? args << "--interactive" if interactive?
args << "--verbose" if verbose? args << "--verbose" if verbose?
args << "--debug" if debug? args << "--debug" if debug?
args << "--cc=#{ARGV.cc}" if ARGV.cc args << "--cc=#{Homebrew.args.cc}" if Homebrew.args.cc
args << "--keep-tmp" if Homebrew.args.keep_tmp? args << "--keep-tmp" if Homebrew.args.keep_tmp?
if Homebrew.args.env.present? if Homebrew.args.env.present?
@ -969,9 +970,10 @@ class FormulaInstaller
end end
def fetch_dependencies def fetch_dependencies
deps = compute_dependencies return if ignore_deps?
return if deps.empty? || ignore_deps? deps = compute_dependencies
return if deps.empty?
deps.each { |dep, _options| fetch_dependency(dep) } deps.each { |dep, _options| fetch_dependency(dep) }
end end

View File

@ -37,11 +37,11 @@ module Homebrew
end end
def check_cc_argv def check_cc_argv
return unless ARGV.cc return unless Homebrew.args.cc
@checks ||= Diagnostic::Checks.new @checks ||= Diagnostic::Checks.new
opoo <<~EOS opoo <<~EOS
You passed `--cc=#{ARGV.cc}`. You passed `--cc=#{Homebrew.args.cc}`.
#{@checks.please_create_pull_requests} #{@checks.please_create_pull_requests}
EOS EOS
end end

View File

@ -35,8 +35,8 @@ module Homebrew
fi.installed_as_dependency = tab.installed_as_dependency fi.installed_as_dependency = tab.installed_as_dependency
fi.installed_on_request = tab.installed_on_request fi.installed_on_request = tab.installed_on_request
end end
fi.fetch
fi.prelude fi.prelude
fi.fetch
oh1 "Reinstalling #{Formatter.identifier(f.full_name)} #{options.to_a.join " "}" oh1 "Reinstalling #{Formatter.identifier(f.full_name)} #{options.to_a.join " "}"

View File

@ -4,6 +4,7 @@ require "formula"
require "formula_installer" require "formula_installer"
require "keg" require "keg"
require "tab" require "tab"
require "cmd/install"
require "test/support/fixtures/testball" require "test/support/fixtures/testball"
require "test/support/fixtures/testball_bottle" require "test/support/fixtures/testball_bottle"
@ -49,7 +50,7 @@ describe FormulaInstaller do
specify "basic bottle install" do specify "basic bottle install" do
allow(DevelopmentTools).to receive(:installed?).and_return(false) allow(DevelopmentTools).to receive(:installed?).and_return(false)
Homebrew.install_args.parse("testball_bottle")
temporarily_install_bottle(TestballBottle.new) do |f| temporarily_install_bottle(TestballBottle.new) do |f|
# Copied directly from formula_installer_spec.rb # Copied directly from formula_installer_spec.rb
# as we expect the same behavior. # as we expect the same behavior.

View File

@ -4,6 +4,7 @@ require "formula"
require "formula_installer" require "formula_installer"
require "keg" require "keg"
require "tab" require "tab"
require "cmd/install"
require "test/support/fixtures/testball" require "test/support/fixtures/testball"
require "test/support/fixtures/testball_bottle" require "test/support/fixtures/testball_bottle"
require "test/support/fixtures/failball" require "test/support/fixtures/failball"
@ -90,11 +91,8 @@ describe FormulaInstaller do
end end
specify "Formula is not poured from bottle when compiler specified" do specify "Formula is not poured from bottle when compiler specified" do
expect(ARGV.cc).to be nil expect(Homebrew.args.cc).to be nil
Homebrew.install_args.parse(["--cc=clang", "testball_bottle"])
cc_arg = "--cc=clang"
ARGV << cc_arg
temporary_install(TestballBottle.new) do |f| temporary_install(TestballBottle.new) do |f|
tab = Tab.for_formula(f) tab = Tab.for_formula(f)
expect(tab.compiler).to eq("clang") expect(tab.compiler).to eq("clang")

View File

@ -176,8 +176,8 @@ RSpec.shared_context "integration test" do
setup_test_formula(name, content) setup_test_formula(name, content)
fi = FormulaInstaller.new(Formula[name]) fi = FormulaInstaller.new(Formula[name])
fi.build_bottle = build_bottle fi.build_bottle = build_bottle
fi.fetch
fi.prelude fi.prelude
fi.fetch
fi.install fi.install
fi.finish fi.finish
end end