diff --git a/Library/Homebrew/cask/installer.rb b/Library/Homebrew/cask/installer.rb index 503962e308..369b05f1d0 100644 --- a/Library/Homebrew/cask/installer.rb +++ b/Library/Homebrew/cask/installer.rb @@ -368,8 +368,8 @@ module Cask fi.installed_on_request = false fi.show_header = true fi.verbose = verbose? - fi.fetch fi.prelude + fi.fetch fi.install fi.finish end diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index 03f373447d..ef95b00c76 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -325,8 +325,8 @@ module Homebrew fi.build_bottle = args.build_bottle? fi.interactive = args.interactive? fi.git = args.git? - fi.fetch fi.prelude + fi.fetch fi.install fi.finish rescue FormulaInstallationAlreadyAttemptedError diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb index df2481fb10..c9099de741 100644 --- a/Library/Homebrew/cmd/upgrade.rb +++ b/Library/Homebrew/cmd/upgrade.rb @@ -191,8 +191,8 @@ module Homebrew end oh1 "Upgrading #{Formatter.identifier(f.full_specified_name)} #{upgrade_version} #{fi.options.to_a.join(" ")}" - fi.fetch fi.prelude + fi.fetch # 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 diff --git a/Library/Homebrew/extend/ARGV.rb b/Library/Homebrew/extend/ARGV.rb index b4ffab5b52..7b2a6fa32b 100644 --- a/Library/Homebrew/extend/ARGV.rb +++ b/Library/Homebrew/extend/ARGV.rb @@ -11,10 +11,6 @@ module HomebrewArgvExtension flag?("--debug") || !ENV["HOMEBREW_DEBUG"].nil? end - def cc - value "cc" - end - private def options_only diff --git a/Library/Homebrew/extend/ENV/shared.rb b/Library/Homebrew/extend/ENV/shared.rb index 36b84cf50b..6c995e8f16 100644 --- a/Library/Homebrew/extend/ENV/shared.rb +++ b/Library/Homebrew/extend/ENV/shared.rb @@ -162,7 +162,7 @@ module SharedEnvExtension # ENV.append_to_cflags "-I ./missing/includes" # end def compiler - @compiler ||= if (cc = ARGV.cc) + @compiler ||= if (cc = Homebrew.args.cc) warn_about_non_apple_gcc($&) if cc =~ GNU_GCC_REGEXP fetch_compiler(cc, "--cc") elsif (cc = homebrew_cc) diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 9aed235eb5..150eaec404 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -100,7 +100,7 @@ class FormulaInstaller return false if !formula.bottled? && !formula.local_bottle_path return true if force_bottle? 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 if formula.bottle_disabled? @@ -141,7 +141,6 @@ class FormulaInstaller def prelude Tab.clear_cache verify_deps_exist unless ignore_deps? - lock check_install_sanity end @@ -221,6 +220,8 @@ class FormulaInstaller end def install + lock + start_time = Time.now if !formula.bottle_unneeded? && !pour_bottle? && DevelopmentTools.installed? Homebrew::Install.perform_build_from_source_checks @@ -728,7 +729,7 @@ class FormulaInstaller args << "--interactive" if interactive? args << "--verbose" if verbose? 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? if Homebrew.args.env.present? @@ -969,9 +970,10 @@ class FormulaInstaller end 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) } end diff --git a/Library/Homebrew/install.rb b/Library/Homebrew/install.rb index 4a3f031327..18bc534d85 100644 --- a/Library/Homebrew/install.rb +++ b/Library/Homebrew/install.rb @@ -37,11 +37,11 @@ module Homebrew end def check_cc_argv - return unless ARGV.cc + return unless Homebrew.args.cc @checks ||= Diagnostic::Checks.new opoo <<~EOS - You passed `--cc=#{ARGV.cc}`. + You passed `--cc=#{Homebrew.args.cc}`. #{@checks.please_create_pull_requests} EOS end diff --git a/Library/Homebrew/reinstall.rb b/Library/Homebrew/reinstall.rb index ff3c5707f2..be7f9c847e 100644 --- a/Library/Homebrew/reinstall.rb +++ b/Library/Homebrew/reinstall.rb @@ -35,8 +35,8 @@ module Homebrew fi.installed_as_dependency = tab.installed_as_dependency fi.installed_on_request = tab.installed_on_request end - fi.fetch fi.prelude + fi.fetch oh1 "Reinstalling #{Formatter.identifier(f.full_name)} #{options.to_a.join " "}" diff --git a/Library/Homebrew/test/formula_installer_bottle_spec.rb b/Library/Homebrew/test/formula_installer_bottle_spec.rb index b5e715260f..87842ff27b 100644 --- a/Library/Homebrew/test/formula_installer_bottle_spec.rb +++ b/Library/Homebrew/test/formula_installer_bottle_spec.rb @@ -4,6 +4,7 @@ require "formula" require "formula_installer" require "keg" require "tab" +require "cmd/install" require "test/support/fixtures/testball" require "test/support/fixtures/testball_bottle" @@ -49,7 +50,7 @@ describe FormulaInstaller do specify "basic bottle install" do allow(DevelopmentTools).to receive(:installed?).and_return(false) - + Homebrew.install_args.parse("testball_bottle") temporarily_install_bottle(TestballBottle.new) do |f| # Copied directly from formula_installer_spec.rb # as we expect the same behavior. diff --git a/Library/Homebrew/test/formula_installer_spec.rb b/Library/Homebrew/test/formula_installer_spec.rb index cd5856a0bf..53fd117e03 100644 --- a/Library/Homebrew/test/formula_installer_spec.rb +++ b/Library/Homebrew/test/formula_installer_spec.rb @@ -4,6 +4,7 @@ require "formula" require "formula_installer" require "keg" require "tab" +require "cmd/install" require "test/support/fixtures/testball" require "test/support/fixtures/testball_bottle" require "test/support/fixtures/failball" @@ -90,11 +91,8 @@ describe FormulaInstaller do end specify "Formula is not poured from bottle when compiler specified" do - expect(ARGV.cc).to be nil - - cc_arg = "--cc=clang" - ARGV << cc_arg - + expect(Homebrew.args.cc).to be nil + Homebrew.install_args.parse(["--cc=clang", "testball_bottle"]) temporary_install(TestballBottle.new) do |f| tab = Tab.for_formula(f) expect(tab.compiler).to eq("clang") diff --git a/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb b/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb index 3f4468a3a7..cbc933817d 100644 --- a/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb +++ b/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb @@ -176,8 +176,8 @@ RSpec.shared_context "integration test" do setup_test_formula(name, content) fi = FormulaInstaller.new(Formula[name]) fi.build_bottle = build_bottle - fi.fetch fi.prelude + fi.fetch fi.install fi.finish end