From 20bd4280ff9f61c09f2268144c1784b8f659e39b Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Mon, 27 Jul 2020 11:37:07 +0200 Subject: [PATCH] Pass `args.cc` to `Install`. --- Library/Homebrew/cmd/gist-logs.rb | 4 ++-- Library/Homebrew/cmd/install.rb | 3 +-- Library/Homebrew/cmd/reinstall.rb | 4 +--- Library/Homebrew/cmd/upgrade.rb | 4 +--- Library/Homebrew/extend/os/linux/install.rb | 4 ++-- Library/Homebrew/install.rb | 10 ++++++---- 6 files changed, 13 insertions(+), 16 deletions(-) diff --git a/Library/Homebrew/cmd/gist-logs.rb b/Library/Homebrew/cmd/gist-logs.rb index a7f95f353a..912266b6df 100644 --- a/Library/Homebrew/cmd/gist-logs.rb +++ b/Library/Homebrew/cmd/gist-logs.rb @@ -144,8 +144,8 @@ module Homebrew def gist_logs gist_logs_args.parse - perform_preinstall_checks(all_fatal: true) - perform_build_from_source_checks(all_fatal: true) + Install.perform_preinstall_checks(all_fatal: true) + Install.perform_build_from_source_checks(all_fatal: true) gistify_logs(args.resolved_formulae.first) end end diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index 29f6cd51b9..52a3b18ca3 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -10,7 +10,6 @@ require "cli/parser" require "upgrade" module Homebrew - extend Install extend Search module_function @@ -256,7 +255,7 @@ module Homebrew return if formulae.empty? - perform_preinstall_checks + Install.perform_preinstall_checks(cc: args.cc) formulae.each do |f| Migrator.migrate_if_needed(f, force: args.force?) diff --git a/Library/Homebrew/cmd/reinstall.rb b/Library/Homebrew/cmd/reinstall.rb index 8b32398e92..0ccecf0973 100644 --- a/Library/Homebrew/cmd/reinstall.rb +++ b/Library/Homebrew/cmd/reinstall.rb @@ -13,8 +13,6 @@ require "cask/macos" require "upgrade" module Homebrew - extend Install - module_function def reinstall_args @@ -61,7 +59,7 @@ module Homebrew FormulaInstaller.prevent_build_flags unless DevelopmentTools.installed? - perform_preinstall_checks + Install.perform_preinstall_checks resolved_formulae, casks = args.resolved_formulae_casks resolved_formulae.each do |f| diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb index 0b50f13034..012172bcc4 100644 --- a/Library/Homebrew/cmd/upgrade.rb +++ b/Library/Homebrew/cmd/upgrade.rb @@ -9,8 +9,6 @@ require "cask/utils" require "cask/macos" module Homebrew - extend Install - module_function def upgrade_args @@ -79,7 +77,7 @@ module Homebrew def upgrade_outdated_formulae(formulae) FormulaInstaller.prevent_build_flags unless DevelopmentTools.installed? - perform_preinstall_checks + Install.perform_preinstall_checks if formulae.blank? outdated = Formula.installed.select do |f| diff --git a/Library/Homebrew/extend/os/linux/install.rb b/Library/Homebrew/extend/os/linux/install.rb index 7940896db0..073c0c813d 100644 --- a/Library/Homebrew/extend/os/linux/install.rb +++ b/Library/Homebrew/extend/os/linux/install.rb @@ -43,8 +43,8 @@ module Homebrew FileUtils.ln_sf ld_so, brew_ld_so end - def perform_preinstall_checks(all_fatal: false) - generic_perform_preinstall_checks(all_fatal: all_fatal) + def perform_preinstall_checks(all_fatal: false, cc: nil) + generic_perform_preinstall_checks(all_fatal: all_fatal, cc: cc) symlink_ld_so end end diff --git a/Library/Homebrew/install.rb b/Library/Homebrew/install.rb index a6bd00b252..f858d8f9d8 100644 --- a/Library/Homebrew/install.rb +++ b/Library/Homebrew/install.rb @@ -7,6 +7,8 @@ require "development_tools" module Homebrew module Install + module_function + def check_cpu return if Hardware::CPU.intel? && Hardware::CPU.is_64_bit? @@ -37,8 +39,8 @@ module Homebrew end end - def check_cc_argv - return unless (cc = args.cc) + def check_cc_argv(cc) + return unless cc @checks ||= Diagnostic::Checks.new opoo <<~EOS @@ -47,10 +49,10 @@ module Homebrew EOS end - def perform_preinstall_checks(all_fatal: false) + def perform_preinstall_checks(all_fatal: false, cc: nil) check_cpu attempt_directory_creation - check_cc_argv + check_cc_argv(cc) diagnostic_checks(:supported_configuration_checks, fatal: all_fatal) diagnostic_checks(:fatal_preinstall_checks) end