From ad7e1d48a5e184ffa8242a43dc02de71dc16c259 Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Sun, 5 Apr 2020 23:01:57 +0530 Subject: [PATCH] Revert "ARGV: Deprecate ARGV.build_formula_from_source? and ARGV.build_from_source?" --- Library/Homebrew/cli/args.rb | 8 -------- Library/Homebrew/extend/ARGV.rb | 12 ++++++++++++ Library/Homebrew/fetch.rb | 2 +- Library/Homebrew/formula_installer.rb | 8 ++++---- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/Library/Homebrew/cli/args.rb b/Library/Homebrew/cli/args.rb index c8620a17e9..dfb413f059 100644 --- a/Library/Homebrew/cli/args.rb +++ b/Library/Homebrew/cli/args.rb @@ -158,14 +158,6 @@ module Homebrew !(HEAD? || devel?) end - # Whether a given formula should be built from source during the current - # installation run. - def build_formula_from_source?(f) - return false if !build_from_source && !build_bottle - - formulae.any? { |args_f| args_f.full_name == f.full_name } - end - private def downcased_unique_named diff --git a/Library/Homebrew/extend/ARGV.rb b/Library/Homebrew/extend/ARGV.rb index c1fd1cf99e..ff1bd86a8f 100644 --- a/Library/Homebrew/extend/ARGV.rb +++ b/Library/Homebrew/extend/ARGV.rb @@ -52,6 +52,18 @@ module HomebrewArgvExtension arch&.to_sym end + def build_from_source? + switch?("s") || include?("--build-from-source") + end + + # Whether a given formula should be built from source during the current + # installation run. + def build_formula_from_source?(f) + return false if !build_from_source? && !build_bottle? + + formulae.any? { |argv_f| argv_f.full_name == f.full_name } + end + def force_bottle? include?("--force-bottle") end diff --git a/Library/Homebrew/fetch.rb b/Library/Homebrew/fetch.rb index 145a600974..4d9a13719d 100644 --- a/Library/Homebrew/fetch.rb +++ b/Library/Homebrew/fetch.rb @@ -7,7 +7,7 @@ module Homebrew def fetch_bottle?(f) return true if ARGV.force_bottle? && f.bottle return false unless f.bottle && f.pour_bottle? - return false if Homebrew.args.build_formula_from_source?(f) + return false if ARGV.build_formula_from_source?(f) return false unless f.bottle.compatible_cellar? true diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index ef9318272d..bb7f2bdca5 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -50,7 +50,7 @@ class FormulaInstaller @show_header = false @ignore_deps = false @only_deps = false - @build_from_source = Homebrew.args.build_from_source + @build_from_source = ARGV.build_from_source? @build_bottle = false @force_bottle = ARGV.force_bottle? @include_test = ARGV.include?("--include-test") @@ -98,7 +98,7 @@ class FormulaInstaller return false if !formula.bottled? && !formula.local_bottle_path return true if force_bottle? - return false if Homebrew.args.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 if formula.bottle_disabled? @@ -129,7 +129,7 @@ class FormulaInstaller def install_bottle_for?(dep, build) return pour_bottle? if dep == formula - return false if Homebrew.args.build_formula_from_source?(dep) + return false if ARGV.build_formula_from_source?(dep) return false unless dep.bottle && dep.pour_bottle? return false unless build.used_options.empty? return false unless dep.bottle.compatible_cellar? @@ -592,7 +592,7 @@ class FormulaInstaller fi.options |= Tab.remap_deprecated_options(df.deprecated_options, dep.options) fi.options |= inherited_options fi.options &= df.options - fi.build_from_source = Homebrew.args.build_formula_from_source?(df) + fi.build_from_source = ARGV.build_formula_from_source?(df) fi.force_bottle = false fi.verbose = verbose? fi.quiet = quiet?